From: Matthias Krüger Date: Fri, 21 Aug 2020 23:08:04 +0000 (+0200) Subject: bootstrap: fix a couple of clippy lint warnings X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=108a3f8a5c395051bb955e3fc35e067953c6b520;p=rust.git bootstrap: fix a couple of clippy lint warnings clippy::print_literal clippy::clone_on_copy clippy::single_char_pattern clippy::into_iter_on_ref clippy::match_like_matches_macro --- diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index 70b1c471ac3..8b8b01b1153 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -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); diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs index a1b5ca2ea2f..2a8f43950db 100644 --- a/src/bootstrap/doc.rs +++ b/src/bootstrap/doc.rs @@ -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)] diff --git a/src/bootstrap/flags.rs b/src/bootstrap/flags.rs index 56e4f0467cc..38b3a32e3b5 100644 --- a/src/bootstrap/flags.rs +++ b/src/bootstrap/flags.rs @@ -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); } } diff --git a/src/bootstrap/format.rs b/src/bootstrap/format.rs index 390b7e96b9a..6f93082e675 100644 --- a/src/bootstrap/format.rs +++ b/src/bootstrap/format.rs @@ -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); diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 77820ef87e3..a42ee11bd6f 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -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) } } diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index eca9ddceae1..97d9dbdd63f 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -767,7 +767,7 @@ fn supported_sanitizers( ) -> Vec { let darwin_libs = |os: &str, components: &[&str]| -> Vec { 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 { 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)),