@@ -107,8 +107,8 @@ impl Std {
107
107
) -> Vec < ( PathBuf , DependencyType ) > {
108
108
let mut deps = Vec :: new ( ) ;
109
109
if !self . is_for_mir_opt_tests {
110
- deps. extend ( copy_third_party_objects ( builder, & compiler, target) ) ;
111
- deps. extend ( copy_self_contained_objects ( builder, & compiler, target) ) ;
110
+ deps. extend ( copy_third_party_objects ( builder, compiler, target) ) ;
111
+ deps. extend ( copy_self_contained_objects ( builder, compiler, target) ) ;
112
112
}
113
113
deps
114
114
}
@@ -186,7 +186,7 @@ impl Step for Std {
186
186
187
187
// Profiler information requires LLVM's compiler-rt
188
188
if builder. config . profiler {
189
- builder. update_submodule ( & Path :: new ( "src/llvm-project" ) ) ;
189
+ builder. update_submodule ( Path :: new ( "src/llvm-project" ) ) ;
190
190
}
191
191
192
192
let mut target_deps = builder. ensure ( StartupObjects { compiler, target } ) ;
@@ -271,7 +271,7 @@ impl Step for Std {
271
271
if target. is_synthetic ( ) {
272
272
cargo. env ( "RUSTC_BOOTSTRAP_SYNTHETIC_TARGET" , "1" ) ;
273
273
}
274
- for rustflag in self . extra_rust_args . into_iter ( ) {
274
+ for rustflag in self . extra_rust_args . iter ( ) {
275
275
cargo. rustflag ( rustflag) ;
276
276
}
277
277
@@ -333,7 +333,7 @@ fn copy_third_party_objects(
333
333
// The sanitizers are only copied in stage1 or above,
334
334
// to avoid creating dependency on LLVM.
335
335
target_deps. extend (
336
- copy_sanitizers ( builder, & compiler, target)
336
+ copy_sanitizers ( builder, compiler, target)
337
337
. into_iter ( )
338
338
. map ( |d| ( d, DependencyType :: Target ) ) ,
339
339
) ;
@@ -487,7 +487,7 @@ pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, stage: u32, car
487
487
488
488
// for no-std targets we only compile a few no_std crates
489
489
cargo
490
- . args ( & [ "-p" , "alloc" ] )
490
+ . args ( [ "-p" , "alloc" ] )
491
491
. arg ( "--manifest-path" )
492
492
. arg ( builder. src . join ( "library/alloc/Cargo.toml" ) )
493
493
. arg ( "--features" )
@@ -626,20 +626,20 @@ impl Step for StdLink {
626
626
. build
627
627
. config
628
628
. initial_rustc
629
- . starts_with ( builder. out . join ( & compiler. host . triple ) . join ( "stage0/bin" ) )
629
+ . starts_with ( builder. out . join ( compiler. host . triple ) . join ( "stage0/bin" ) )
630
630
{
631
631
// Copy bin files from stage0/bin to stage0-sysroot/bin
632
- let sysroot = builder. out . join ( & compiler. host . triple ) . join ( "stage0-sysroot" ) ;
632
+ let sysroot = builder. out . join ( compiler. host . triple ) . join ( "stage0-sysroot" ) ;
633
633
634
634
let host = compiler. host . triple ;
635
- let stage0_bin_dir = builder. out . join ( & host) . join ( "stage0/bin" ) ;
635
+ let stage0_bin_dir = builder. out . join ( host) . join ( "stage0/bin" ) ;
636
636
let sysroot_bin_dir = sysroot. join ( "bin" ) ;
637
637
t ! ( fs:: create_dir_all( & sysroot_bin_dir) ) ;
638
638
builder. cp_r ( & stage0_bin_dir, & sysroot_bin_dir) ;
639
639
640
640
// Copy all *.so files from stage0/lib to stage0-sysroot/lib
641
- let stage0_lib_dir = builder. out . join ( & host) . join ( "stage0/lib" ) ;
642
- if let Ok ( files) = fs:: read_dir ( & stage0_lib_dir) {
641
+ let stage0_lib_dir = builder. out . join ( host) . join ( "stage0/lib" ) ;
642
+ if let Ok ( files) = fs:: read_dir ( stage0_lib_dir) {
643
643
for file in files {
644
644
let file = t ! ( file) ;
645
645
let path = file. path ( ) ;
@@ -654,9 +654,9 @@ impl Step for StdLink {
654
654
t ! ( fs:: create_dir_all( & sysroot_codegen_backends) ) ;
655
655
let stage0_codegen_backends = builder
656
656
. out
657
- . join ( & host)
657
+ . join ( host)
658
658
. join ( "stage0/lib/rustlib" )
659
- . join ( & host)
659
+ . join ( host)
660
660
. join ( "codegen-backends" ) ;
661
661
if stage0_codegen_backends. exists ( ) {
662
662
builder. cp_r ( & stage0_codegen_backends, & sysroot_codegen_backends) ;
@@ -1179,7 +1179,7 @@ fn rustc_llvm_env(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetSelect
1179
1179
// The config can also specify its own llvm linker flags.
1180
1180
if let Some ( ref s) = builder. config . llvm_ldflags {
1181
1181
if !llvm_linker_flags. is_empty ( ) {
1182
- llvm_linker_flags. push_str ( " " ) ;
1182
+ llvm_linker_flags. push ( ' ' ) ;
1183
1183
}
1184
1184
llvm_linker_flags. push_str ( s) ;
1185
1185
}
@@ -1270,7 +1270,7 @@ fn needs_codegen_config(run: &RunConfig<'_>) -> bool {
1270
1270
for path_set in & run. paths {
1271
1271
needs_codegen_cfg = match path_set {
1272
1272
PathSet :: Set ( set) => set. iter ( ) . any ( |p| is_codegen_cfg_needed ( p, run) ) ,
1273
- PathSet :: Suite ( suite) => is_codegen_cfg_needed ( & suite, run) ,
1273
+ PathSet :: Suite ( suite) => is_codegen_cfg_needed ( suite, run) ,
1274
1274
}
1275
1275
}
1276
1276
needs_codegen_cfg
@@ -1279,7 +1279,7 @@ fn needs_codegen_config(run: &RunConfig<'_>) -> bool {
1279
1279
pub ( crate ) const CODEGEN_BACKEND_PREFIX : & str = "rustc_codegen_" ;
1280
1280
1281
1281
fn is_codegen_cfg_needed ( path : & TaskPath , run : & RunConfig < ' _ > ) -> bool {
1282
- if path. path . to_str ( ) . unwrap ( ) . contains ( & CODEGEN_BACKEND_PREFIX ) {
1282
+ if path. path . to_str ( ) . unwrap ( ) . contains ( CODEGEN_BACKEND_PREFIX ) {
1283
1283
let mut needs_codegen_backend_config = true ;
1284
1284
for & backend in run. builder . config . codegen_backends ( run. target ) {
1285
1285
if path
@@ -1300,7 +1300,7 @@ fn is_codegen_cfg_needed(path: &TaskPath, run: &RunConfig<'_>) -> bool {
1300
1300
}
1301
1301
}
1302
1302
1303
- return false ;
1303
+ false
1304
1304
}
1305
1305
1306
1306
impl Step for CodegenBackend {
@@ -1393,7 +1393,7 @@ impl Step for CodegenBackend {
1393
1393
}
1394
1394
let stamp = codegen_backend_stamp ( builder, compiler, target, backend) ;
1395
1395
let codegen_backend = codegen_backend. to_str ( ) . unwrap ( ) ;
1396
- t ! ( fs:: write( & stamp, & codegen_backend) ) ;
1396
+ t ! ( fs:: write( stamp, codegen_backend) ) ;
1397
1397
}
1398
1398
}
1399
1399
@@ -1441,7 +1441,7 @@ fn copy_codegen_backends_to_sysroot(
1441
1441
let dot = filename. find ( '.' ) . unwrap ( ) ;
1442
1442
format ! ( "{}-{}{}" , & filename[ ..dash] , builder. rust_release( ) , & filename[ dot..] )
1443
1443
} ;
1444
- builder. copy ( & file, & dst. join ( target_filename) ) ;
1444
+ builder. copy ( file, & dst. join ( target_filename) ) ;
1445
1445
}
1446
1446
}
1447
1447
@@ -1519,7 +1519,7 @@ impl Step for Sysroot {
1519
1519
/// 1-3.
1520
1520
fn run ( self , builder : & Builder < ' _ > ) -> Interned < PathBuf > {
1521
1521
let compiler = self . compiler ;
1522
- let host_dir = builder. out . join ( & compiler. host . triple ) ;
1522
+ let host_dir = builder. out . join ( compiler. host . triple ) ;
1523
1523
1524
1524
let sysroot_dir = |stage| {
1525
1525
if stage == 0 {
@@ -1578,7 +1578,7 @@ impl Step for Sysroot {
1578
1578
let mut add_filtered_files = |suffix, contents| {
1579
1579
for path in contents {
1580
1580
let path = Path :: new ( & path) ;
1581
- if path. parent ( ) . map_or ( false , |parent| parent. ends_with ( & suffix) ) {
1581
+ if path. parent ( ) . map_or ( false , |parent| parent. ends_with ( suffix) ) {
1582
1582
filtered_files. push ( path. file_name ( ) . unwrap ( ) . to_owned ( ) ) ;
1583
1583
}
1584
1584
}
@@ -1802,7 +1802,7 @@ impl Step for Assemble {
1802
1802
if let Some ( lld_install) = lld_install {
1803
1803
let src_exe = exe ( "lld" , target_compiler. host ) ;
1804
1804
let dst_exe = exe ( "rust-lld" , target_compiler. host ) ;
1805
- builder. copy ( & lld_install. join ( "bin" ) . join ( & src_exe) , & libdir_bin. join ( & dst_exe) ) ;
1805
+ builder. copy ( & lld_install. join ( "bin" ) . join ( src_exe) , & libdir_bin. join ( dst_exe) ) ;
1806
1806
let self_contained_lld_dir = libdir_bin. join ( "gcc-ld" ) ;
1807
1807
t ! ( fs:: create_dir_all( & self_contained_lld_dir) ) ;
1808
1808
let lld_wrapper_exe = builder. ensure ( crate :: core:: build_steps:: tool:: LldWrapper {
@@ -1850,7 +1850,7 @@ impl Step for Assemble {
1850
1850
let out_dir = builder. cargo_out ( build_compiler, Mode :: Rustc , host) ;
1851
1851
let rustc = out_dir. join ( exe ( "rustc-main" , host) ) ;
1852
1852
let bindir = sysroot. join ( "bin" ) ;
1853
- t ! ( fs:: create_dir_all( & bindir) ) ;
1853
+ t ! ( fs:: create_dir_all( bindir) ) ;
1854
1854
let compiler = builder. rustc ( target_compiler) ;
1855
1855
builder. copy ( & rustc, & compiler) ;
1856
1856
@@ -1869,9 +1869,9 @@ pub fn add_to_sysroot(
1869
1869
stamp : & Path ,
1870
1870
) {
1871
1871
let self_contained_dst = & sysroot_dst. join ( "self-contained" ) ;
1872
- t ! ( fs:: create_dir_all( & sysroot_dst) ) ;
1873
- t ! ( fs:: create_dir_all( & sysroot_host_dst) ) ;
1874
- t ! ( fs:: create_dir_all( & self_contained_dst) ) ;
1872
+ t ! ( fs:: create_dir_all( sysroot_dst) ) ;
1873
+ t ! ( fs:: create_dir_all( sysroot_host_dst) ) ;
1874
+ t ! ( fs:: create_dir_all( self_contained_dst) ) ;
1875
1875
for ( path, dependency_type) in builder. read_stamp_file ( stamp) {
1876
1876
let dst = match dependency_type {
1877
1877
DependencyType :: Host => sysroot_host_dst,
@@ -2009,14 +2009,14 @@ pub fn run_cargo(
2009
2009
. map ( |e| ( e. path ( ) , e. file_name ( ) . into_string ( ) . unwrap ( ) , t ! ( e. metadata( ) ) ) )
2010
2010
. collect :: < Vec < _ > > ( ) ;
2011
2011
for ( prefix, extension, expected_len) in toplevel {
2012
- let candidates = contents. iter ( ) . filter ( |& & ( _, ref filename, ref meta) | {
2012
+ let candidates = contents. iter ( ) . filter ( |& ( _, filename, meta) | {
2013
2013
meta. len ( ) == expected_len
2014
2014
&& filename
2015
2015
. strip_prefix ( & prefix[ ..] )
2016
2016
. map ( |s| s. starts_with ( '-' ) && s. ends_with ( & extension[ ..] ) )
2017
2017
. unwrap_or ( false )
2018
2018
} ) ;
2019
- let max = candidates. max_by_key ( |& & ( _, _, ref metadata) | {
2019
+ let max = candidates. max_by_key ( |& ( _, _, metadata) | {
2020
2020
metadata. modified ( ) . expect ( "mtime should be available on all relevant OSes" )
2021
2021
} ) ;
2022
2022
let path_to_add = match max {
@@ -2045,7 +2045,7 @@ pub fn run_cargo(
2045
2045
new_contents. extend ( dep. to_str ( ) . unwrap ( ) . as_bytes ( ) ) ;
2046
2046
new_contents. extend ( b"\0 " ) ;
2047
2047
}
2048
- t ! ( fs:: write( & stamp, & new_contents) ) ;
2048
+ t ! ( fs:: write( stamp, & new_contents) ) ;
2049
2049
deps. into_iter ( ) . map ( |( d, _) | d) . collect ( )
2050
2050
}
2051
2051
0 commit comments