]> git.lizzy.rs Git - rust.git/commitdiff
bootstrap: fix a couple of clippy lint warnings
authorMatthias Krüger <matthias.krueger@famsik.de>
Fri, 21 Aug 2020 23:08:04 +0000 (01:08 +0200)
committerMatthias Krüger <matthias.krueger@famsik.de>
Fri, 21 Aug 2020 23:08:04 +0000 (01:08 +0200)
clippy::print_literal
clippy::clone_on_copy
clippy::single_char_pattern
clippy::into_iter_on_ref
clippy::match_like_matches_macro

src/bootstrap/config.rs
src/bootstrap/doc.rs
src/bootstrap/flags.rs
src/bootstrap/format.rs
src/bootstrap/lib.rs
src/bootstrap/native.rs

index 70b1c471ac3f0e6f11efc24d4d0b17a17a081354..8b8b01b11532731342b1413a0adcf86fb219252a 100644 (file)
@@ -527,7 +527,7 @@ pub fn parse(args: &[String]) -> Config {
 
         let build = toml.build.clone().unwrap_or_default();
         // set by bootstrap.py
-        config.hosts.push(config.build.clone());
+        config.hosts.push(config.build);
         for host in build.host.iter().map(|h| TargetSelection::from_user(h)) {
             if !config.hosts.contains(&host) {
                 config.hosts.push(host);
index a1b5ca2ea2fa1f18c128645704f1dd329c0e6d79..2a8f43950db3c2faab179cf77c9aeee5f68aefcd 100644 (file)
@@ -96,7 +96,7 @@ fn is_explicit_request(builder: &Builder<'_>, path: &str) -> bool {
         .paths
         .iter()
         .map(components_simplified)
-        .any(|requested| requested.iter().copied().eq(path.split("/")))
+        .any(|requested| requested.iter().copied().eq(path.split('/')))
 }
 
 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
index 56e4f0467cc50967978d2752e7cf99374e460977..38b3a32e3b5fbecd2dc01d9077145e9c0db10f13 100644 (file)
@@ -505,14 +505,11 @@ pub fn parse(args: &[String]) -> Flags {
 
         if let Subcommand::Check { .. } = &cmd {
             if matches.opt_str("stage").is_some() {
-                println!("{}", "--stage not supported for x.py check, always treated as stage 0");
+                println!("--stage not supported for x.py check, always treated as stage 0");
                 process::exit(1);
             }
             if matches.opt_str("keep-stage").is_some() {
-                println!(
-                    "{}",
-                    "--keep-stage not supported for x.py check, only one stage available"
-                );
+                println!("--keep-stage not supported for x.py check, only one stage available");
                 process::exit(1);
             }
         }
index 390b7e96b9a543cecdd806fe2369b10469bd9f50..6f93082e6752f01c559b572dcf85ff95873e8270 100644 (file)
@@ -87,7 +87,7 @@ pub fn format(build: &Build, check: bool) {
                 .lines()
                 .filter(|entry| entry.starts_with("??"))
                 .map(|entry| {
-                    entry.split(" ").nth(1).expect("every git status entry should list a path")
+                    entry.split(' ').nth(1).expect("every git status entry should list a path")
                 });
             for untracked_path in untracked_paths {
                 eprintln!("skip untracked path {} during rustfmt invocations", untracked_path);
index 77820ef87e3b470399217ffcbcb9c33128bcfe76..a42ee11bd6fe50df3f8dd0f8797b7ad17c39a54a 100644 (file)
@@ -323,10 +323,7 @@ pub enum Mode {
 
 impl Mode {
     pub fn is_tool(&self) -> bool {
-        match self {
-            Mode::ToolBootstrap | Mode::ToolRustc | Mode::ToolStd => true,
-            _ => false,
-        }
+        matches!(self, Mode::ToolBootstrap | Mode::ToolRustc | Mode::ToolStd)
     }
 }
 
index eca9ddceae1b5a80c1b7424dfeca07b884e536bd..97d9dbdd63fb2f53809da3824b753c7f1fb74bd7 100644 (file)
@@ -767,7 +767,7 @@ fn supported_sanitizers(
 ) -> Vec<SanitizerRuntime> {
     let darwin_libs = |os: &str, components: &[&str]| -> Vec<SanitizerRuntime> {
         components
-            .into_iter()
+            .iter()
             .map(move |c| SanitizerRuntime {
                 cmake_target: format!("clang_rt.{}_{}_dynamic", c, os),
                 path: out_dir
@@ -779,7 +779,7 @@ fn supported_sanitizers(
 
     let common_libs = |os: &str, arch: &str, components: &[&str]| -> Vec<SanitizerRuntime> {
         components
-            .into_iter()
+            .iter()
             .map(move |c| SanitizerRuntime {
                 cmake_target: format!("clang_rt.{}-{}", c, arch),
                 path: out_dir.join(&format!("build/lib/{}/libclang_rt.{}-{}.a", os, c, arch)),