File tree Expand file tree Collapse file tree 6 files changed +15
-19
lines changed Expand file tree Collapse file tree 6 files changed +15
-19
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ impl CargoOutput {
46
46
warnings : true ,
47
47
output : OutputKind :: Forward ,
48
48
debug : match std:: env:: var_os ( "CC_ENABLE_DEBUG_OUTPUT" ) {
49
- Some ( v) => v != "0" && v != "false" && v != "" ,
49
+ Some ( v) => v != "0" && v != "false" && !v . is_empty ( ) ,
50
50
None => false ,
51
51
} ,
52
52
checked_dbg_var : Arc :: new ( AtomicBool :: new ( false ) ) ,
Original file line number Diff line number Diff line change @@ -185,7 +185,7 @@ impl<'this> RustcCodegenFlags<'this> {
185
185
} ;
186
186
187
187
let clang_or_gnu =
188
- matches ! ( family, ToolFamily :: Clang { .. } ) || matches ! ( family, ToolFamily :: Gnu { .. } ) ;
188
+ matches ! ( family, ToolFamily :: Clang { .. } ) || matches ! ( family, ToolFamily :: Gnu ) ;
189
189
190
190
// Flags shared between clang and gnu
191
191
if clang_or_gnu {
@@ -315,7 +315,7 @@ impl<'this> RustcCodegenFlags<'this> {
315
315
}
316
316
}
317
317
}
318
- ToolFamily :: Gnu { .. } => { }
318
+ ToolFamily :: Gnu => { }
319
319
ToolFamily :: Msvc { .. } => {
320
320
// https://learn.microsoft.com/en-us/cpp/build/reference/guard-enable-control-flow-guard
321
321
if let Some ( value) = self . control_flow_guard {
Original file line number Diff line number Diff line change @@ -1392,13 +1392,9 @@ impl Build {
1392
1392
1393
1393
fn get_canonical_library_names ( name : & str ) -> ( & str , String , String ) {
1394
1394
let lib_striped = name. strip_prefix ( "lib" ) . unwrap_or ( name) ;
1395
- let lib_name = if lib_striped. ends_with ( ".a" ) {
1396
- & lib_striped[ ..lib_striped. len ( ) - 2 ]
1397
- } else if lib_striped. ends_with ( ".so" ) {
1398
- & lib_striped[ ..lib_striped. len ( ) - 3 ]
1399
- } else {
1400
- lib_striped
1401
- } ;
1395
+ let static_striped = lib_striped. strip_suffix ( ".a" ) . unwrap_or ( lib_striped) ;
1396
+ let lib_name = lib_striped. strip_suffix ( ".so" ) . unwrap_or ( static_striped) ;
1397
+
1402
1398
(
1403
1399
lib_name,
1404
1400
format ! ( "lib{lib_name}.a" ) ,
Original file line number Diff line number Diff line change @@ -477,13 +477,13 @@ mod tests {
477
477
let ( full_arch, _rest) = target. split_once ( '-' ) . expect ( "target to have arch" ) ;
478
478
479
479
let mut target = TargetInfo {
480
- full_arch : full_arch . into ( ) ,
481
- arch : "invalid-none-set" . into ( ) ,
482
- vendor : "invalid-none-set" . into ( ) ,
483
- os : "invalid-none-set" . into ( ) ,
484
- env : "invalid-none-set" . into ( ) ,
480
+ full_arch,
481
+ arch : "invalid-none-set" ,
482
+ vendor : "invalid-none-set" ,
483
+ os : "invalid-none-set" ,
484
+ env : "invalid-none-set" ,
485
485
// Not set in older Rust versions
486
- abi : "" . into ( ) ,
486
+ abi : "" ,
487
487
} ;
488
488
489
489
for cfg in cfgs. lines ( ) {
Original file line number Diff line number Diff line change @@ -117,7 +117,7 @@ fn clang_cl() {
117
117
for exe_suffix in [ "" , ".exe" ] {
118
118
let test = Test :: clang ( ) ;
119
119
let bin = format ! ( "clang{exe_suffix}" ) ;
120
- env:: set_var ( "CC" , & format ! ( "{bin} --driver-mode=cl" ) ) ;
120
+ env:: set_var ( "CC" , format ! ( "{bin} --driver-mode=cl" ) ) ;
121
121
let test_compiler = |build : cc:: Build | {
122
122
let compiler = build. get_compiler ( ) ;
123
123
assert_eq ! ( compiler. path( ) , Path :: new( & * bin) ) ;
Original file line number Diff line number Diff line change @@ -532,8 +532,8 @@ fn gnu_apple_sysroot() {
532
532
test. shim ( "fake-gcc" )
533
533
. gcc ( )
534
534
. compiler ( "fake-gcc" )
535
- . target ( & target)
536
- . host ( & target)
535
+ . target ( target)
536
+ . host ( target)
537
537
. file ( "foo.c" )
538
538
. compile ( "foo" ) ;
539
539
You can’t perform that action at this time.
0 commit comments