@@ -74,8 +74,6 @@ pub struct Config {
7474 env : HashMap < String , String > ,
7575 /// Profiles loaded from config.
7676 profiles : LazyCell < ConfigProfiles > ,
77- /// Use `clippy-driver` instead of `rustc`
78- clippy_override : bool ,
7977}
8078
8179impl Config {
@@ -131,7 +129,6 @@ impl Config {
131129 target_dir : None ,
132130 env,
133131 profiles : LazyCell :: new ( ) ,
134- clippy_override : false ,
135132 }
136133 }
137134
@@ -193,36 +190,14 @@ impl Config {
193190 . map ( AsRef :: as_ref)
194191 }
195192
196- /// Sets the clippy override. If this is true, clippy-driver is invoked instead of rustc.
197- pub fn set_clippy_override ( & mut self , val : bool ) {
198- self . clippy_override = val;
199- }
200-
201193 /// Gets the path to the `rustc` executable.
202- pub fn rustc ( & self , ws : Option < & Workspace < ' _ > > ) -> CargoResult < Rustc > {
194+ pub fn load_global_rustc ( & self , ws : Option < & Workspace < ' _ > > ) -> CargoResult < Rustc > {
203195 let cache_location = ws. map ( |ws| {
204196 ws. target_dir ( )
205197 . join ( ".rustc_info.json" )
206198 . into_path_unlocked ( )
207199 } ) ;
208- let wrapper = if self . clippy_override {
209- let tool = self . get_tool ( "clippy-driver" ) ?;
210- let tool = paths:: resolve_executable ( & tool) . map_err ( |e| {
211- let rustup_in_path = self
212- . get_tool ( "rustup" )
213- . and_then ( |tool| paths:: resolve_executable ( & tool) )
214- . is_ok ( ) ;
215- let has_rustup_env = std:: env:: var ( "RUSTUP_TOOLCHAIN" ) . is_ok ( ) ;
216- if rustup_in_path || has_rustup_env {
217- failure:: format_err!( "{}: please run `rustup component add clippy`" , e)
218- } else {
219- failure:: format_err!( "{}: please install clippy" , e)
220- }
221- } ) ?;
222- Some ( tool)
223- } else {
224- self . maybe_get_tool ( "rustc-wrapper" ) ?
225- } ;
200+ let wrapper = self . maybe_get_tool ( "rustc-wrapper" ) ?;
226201 Rustc :: new (
227202 self . get_tool ( "rustc" ) ?,
228203 wrapper,
@@ -782,7 +757,7 @@ impl Config {
782757
783758 /// Looks for a path for `tool` in an environment variable or config path, defaulting to `tool`
784759 /// as a path.
785- fn get_tool ( & self , tool : & str ) -> CargoResult < PathBuf > {
760+ pub fn get_tool ( & self , tool : & str ) -> CargoResult < PathBuf > {
786761 self . maybe_get_tool ( tool)
787762 . map ( |t| t. unwrap_or_else ( || PathBuf :: from ( tool) ) )
788763 }
0 commit comments