@@ -375,6 +375,32 @@ enum DownloadSource {
375375
376376/// Functions that are only ever called once, but named for clarify and to avoid thousand-line functions.
377377impl Config {
378+ pub ( crate ) fn download_clippy ( & self ) -> PathBuf {
379+ self . verbose ( "downloading stage0 clippy artifacts" ) ;
380+
381+ let date = & self . stage0_metadata . compiler . date ;
382+ let version = & self . stage0_metadata . compiler . version ;
383+ let host = self . build ;
384+
385+ let bin_root = self . out . join ( host. triple ) . join ( "stage0" ) ;
386+ let clippy_stamp = bin_root. join ( ".clippy-stamp" ) ;
387+ let cargo_clippy = bin_root. join ( "bin" ) . join ( exe ( "cargo-clippy" , host) ) ;
388+ if cargo_clippy. exists ( ) && !program_out_of_date ( & clippy_stamp, & date) {
389+ return cargo_clippy;
390+ }
391+
392+ let filename = format ! ( "clippy-{version}-{host}.tar.xz" ) ;
393+ self . download_component ( DownloadSource :: Dist , filename, "clippy-preview" , date, "stage0" ) ;
394+ if self . should_fix_bins_and_dylibs ( ) {
395+ self . fix_bin_or_dylib ( & cargo_clippy) ;
396+ self . fix_bin_or_dylib ( & cargo_clippy. with_file_name ( exe ( "clippy-driver" , host) ) ) ;
397+ }
398+
399+ cargo_clippy
400+ }
401+
402+ /// NOTE: rustfmt is a completely different toolchain than the bootstrap compiler, so it can't
403+ /// reuse target directories or artifacts
378404 pub ( crate ) fn maybe_download_rustfmt ( & self ) -> Option < PathBuf > {
379405 let RustfmtMetadata { date, version } = self . stage0_metadata . rustfmt . as_ref ( ) ?;
380406 let channel = format ! ( "{version}-{date}" ) ;
0 commit comments