about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbjorn3 <bjorn3@users.noreply.github.com>2021-07-29 11:54:39 +0200
committerbjorn3 <bjorn3@users.noreply.github.com>2021-07-29 11:54:39 +0200
commit2f6662da85d47ebf89432c910a496812e9e2db12 (patch)
tree036753c4b8764efefd8cb9e2e8431149fe7f5244
parentcd6c0e4e3b71cffd6e577146cbf989ad6ba29c63 (diff)
downloadrust-2f6662da85d47ebf89432c910a496812e9e2db12.tar.gz
rust-2f6662da85d47ebf89432c910a496812e9e2db12.zip
Use strip_prefix
-rw-r--r--compiler/rustc_driver/src/lib.rs8
1 files changed, 1 insertions, 7 deletions
diff --git a/compiler/rustc_driver/src/lib.rs b/compiler/rustc_driver/src/lib.rs
index 50932d498b3..84dd69ebd96 100644
--- a/compiler/rustc_driver/src/lib.rs
+++ b/compiler/rustc_driver/src/lib.rs
@@ -764,13 +764,7 @@ pub fn version(binary: &str, matches: &getopts::Matches) {
         println!("release: {}", unw(util::release_str()));
 
         let debug_flags = matches.opt_strs("Z");
-        let backend_name = debug_flags.iter().find_map(|x| {
-            if x.starts_with("codegen-backend=") {
-                Some(&x["codegen-backend=".len()..])
-            } else {
-                None
-            }
-        });
+        let backend_name = debug_flags.iter().find_map(|x| x.strip_prefix("codegen-backend="));
         get_codegen_backend(&None, backend_name).print_version();
     }
 }