@@ -456,9 +456,8 @@ impl<'a> Linker for GccLinker<'a> {
456
456
457
457
fn finalize ( & mut self ) -> Command {
458
458
self . hint_dynamic ( ) ; // Reset to default before returning the composed command line.
459
- let mut cmd = Command :: new ( "" ) ;
460
- :: std:: mem:: swap ( & mut cmd, & mut self . cmd ) ;
461
- cmd
459
+
460
+ :: std:: mem:: replace ( & mut self . cmd , Command :: new ( "" ) )
462
461
}
463
462
464
463
fn group_start ( & mut self ) {
@@ -710,9 +709,7 @@ impl<'a> Linker for MsvcLinker<'a> {
710
709
}
711
710
712
711
fn finalize ( & mut self ) -> Command {
713
- let mut cmd = Command :: new ( "" ) ;
714
- :: std:: mem:: swap ( & mut cmd, & mut self . cmd ) ;
715
- cmd
712
+ :: std:: mem:: replace ( & mut self . cmd , Command :: new ( "" ) )
716
713
}
717
714
718
715
// MSVC doesn't need group indicators
@@ -880,9 +877,7 @@ impl<'a> Linker for EmLinker<'a> {
880
877
}
881
878
882
879
fn finalize ( & mut self ) -> Command {
883
- let mut cmd = Command :: new ( "" ) ;
884
- :: std:: mem:: swap ( & mut cmd, & mut self . cmd ) ;
885
- cmd
880
+ :: std:: mem:: replace ( & mut self . cmd , Command :: new ( "" ) )
886
881
}
887
882
888
883
// Appears not necessary on Emscripten
@@ -1080,9 +1075,7 @@ impl<'a> Linker for WasmLd<'a> {
1080
1075
// indicative of bugs, let's prevent them.
1081
1076
self . cmd . arg ( "--fatal-warnings" ) ;
1082
1077
1083
- let mut cmd = Command :: new ( "" ) ;
1084
- :: std:: mem:: swap ( & mut cmd, & mut self . cmd ) ;
1085
- cmd
1078
+ :: std:: mem:: replace ( & mut self . cmd , Command :: new ( "" ) )
1086
1079
}
1087
1080
1088
1081
// Not needed for now with LLD
0 commit comments