]> git.lizzy.rs Git - rust.git/commitdiff
avoid unnecessary allocation
authorRalf Jung <post@ralfj.de>
Sat, 13 Jul 2019 13:18:15 +0000 (15:18 +0200)
committerRalf Jung <post@ralfj.de>
Sat, 13 Jul 2019 13:18:15 +0000 (15:18 +0200)
src/bin/miri.rs

index 0f28a0c5d8dca915cf88acae40e81aae1d82d1e3..6e67246d2ca1d4fec3a72655ebad568faf2e7ff2 100644 (file)
@@ -184,10 +184,10 @@ fn main() {
     // FIXME: Ideally we'd turn a bad build env into a compile-time error, but
     // CTFE does not seem powerful enough for that yet.
     if let Some(sysroot) = compile_time_sysroot() {
-        let sysroot_flag = "--sysroot".to_string();
-        if !rustc_args.contains(&sysroot_flag) {
+        let sysroot_flag = "--sysroot";
+        if !rustc_args.iter().any(|e| e == sysroot_flag) {
             // We need to overwrite the default that librustc would compute.
-            rustc_args.push(sysroot_flag);
+            rustc_args.push(sysroot_flag.to_owned());
             rustc_args.push(sysroot);
         }
     }