mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 02:57:37 +00:00
codegen_llvm_back: use mem::replace instead of swap where more concise
This commit is contained in:
parent
ed5802c4d1
commit
3968ada006
@ -456,9 +456,8 @@ impl<'a> Linker for GccLinker<'a> {
|
||||
|
||||
fn finalize(&mut self) -> Command {
|
||||
self.hint_dynamic(); // Reset to default before returning the composed command line.
|
||||
let mut cmd = Command::new("");
|
||||
::std::mem::swap(&mut cmd, &mut self.cmd);
|
||||
cmd
|
||||
|
||||
::std::mem::replace(&mut self.cmd, Command::new(""))
|
||||
}
|
||||
|
||||
fn group_start(&mut self) {
|
||||
@ -710,9 +709,7 @@ impl<'a> Linker for MsvcLinker<'a> {
|
||||
}
|
||||
|
||||
fn finalize(&mut self) -> Command {
|
||||
let mut cmd = Command::new("");
|
||||
::std::mem::swap(&mut cmd, &mut self.cmd);
|
||||
cmd
|
||||
::std::mem::replace(&mut self.cmd, Command::new(""))
|
||||
}
|
||||
|
||||
// MSVC doesn't need group indicators
|
||||
@ -880,9 +877,7 @@ impl<'a> Linker for EmLinker<'a> {
|
||||
}
|
||||
|
||||
fn finalize(&mut self) -> Command {
|
||||
let mut cmd = Command::new("");
|
||||
::std::mem::swap(&mut cmd, &mut self.cmd);
|
||||
cmd
|
||||
::std::mem::replace(&mut self.cmd, Command::new(""))
|
||||
}
|
||||
|
||||
// Appears not necessary on Emscripten
|
||||
@ -1080,9 +1075,7 @@ impl<'a> Linker for WasmLd<'a> {
|
||||
// indicative of bugs, let's prevent them.
|
||||
self.cmd.arg("--fatal-warnings");
|
||||
|
||||
let mut cmd = Command::new("");
|
||||
::std::mem::swap(&mut cmd, &mut self.cmd);
|
||||
cmd
|
||||
::std::mem::replace(&mut self.cmd, Command::new(""))
|
||||
}
|
||||
|
||||
// Not needed for now with LLD
|
||||
|
Loading…
Reference in New Issue
Block a user