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
This commit is contained in:
Matthias Krüger 2020-08-22 01:08:04 +02:00
parent de521cbb30
commit 108a3f8a5c
6 changed files with 8 additions and 14 deletions

View file

@ -527,7 +527,7 @@ impl 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);

View 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)]

View file

@ -505,14 +505,11 @@ Arguments:
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);
}
}

View 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);

View 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)
}
}

View 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)),