Clippy lints
This commit is contained in:
parent
802b6db004
commit
6766abbfa9
9 changed files with 37 additions and 43 deletions
|
|
@ -99,6 +99,6 @@ impl GitInfo {
|
|||
version.push_str(&inner.commit_date);
|
||||
version.push_str(")");
|
||||
}
|
||||
return version
|
||||
version
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -559,23 +559,24 @@ fn run_cargo(build: &Build, cargo: &mut Command, stamp: &Path) {
|
|||
// If this was an output file in the "host dir" we don't actually
|
||||
// worry about it, it's not relevant for us.
|
||||
if filename.starts_with(&host_root_dir) {
|
||||
continue
|
||||
continue;
|
||||
}
|
||||
|
||||
// If this was output in the `deps` dir then this is a precise file
|
||||
// name (hash included) so we start tracking it.
|
||||
} else if filename.starts_with(&target_deps_dir) {
|
||||
if filename.starts_with(&target_deps_dir) {
|
||||
deps.push(filename.to_path_buf());
|
||||
continue;
|
||||
}
|
||||
|
||||
// Otherwise this was a "top level artifact" which right now doesn't
|
||||
// have a hash in the name, but there's a version of this file in
|
||||
// the `deps` folder which *does* have a hash in the name. That's
|
||||
// the one we'll want to we'll probe for it later.
|
||||
} else {
|
||||
toplevel.push((filename.file_stem().unwrap()
|
||||
.to_str().unwrap().to_string(),
|
||||
filename.extension().unwrap().to_owned()
|
||||
.to_str().unwrap().to_string()));
|
||||
}
|
||||
toplevel.push((filename.file_stem().unwrap()
|
||||
.to_str().unwrap().to_string(),
|
||||
filename.extension().unwrap().to_owned()
|
||||
.to_str().unwrap().to_string()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -417,7 +417,7 @@ impl Config {
|
|||
config.update_with_config_mk();
|
||||
}
|
||||
|
||||
return config
|
||||
config
|
||||
}
|
||||
|
||||
/// "Temporary" routine to parse `config.mk` into this configuration.
|
||||
|
|
|
|||
|
|
@ -488,12 +488,11 @@ fn copy_src_dirs(build: &Build, src_dirs: &[&str], exclude_dirs: &[&str], dst_di
|
|||
if spath.ends_with("~") || spath.ends_with(".pyc") {
|
||||
return false
|
||||
}
|
||||
if spath.contains("llvm/test") || spath.contains("llvm\\test") {
|
||||
if spath.ends_with(".ll") ||
|
||||
spath.ends_with(".td") ||
|
||||
spath.ends_with(".s") {
|
||||
return false
|
||||
}
|
||||
if (spath.contains("llvm/test") || spath.contains("llvm\\test")) &&
|
||||
(spath.ends_with(".ll") ||
|
||||
spath.ends_with(".td") ||
|
||||
spath.ends_with(".s")) {
|
||||
return false
|
||||
}
|
||||
|
||||
let full_path = Path::new(dir).join(path);
|
||||
|
|
|
|||
|
|
@ -315,10 +315,8 @@ Arguments:
|
|||
|
||||
let mut stage = matches.opt_str("stage").map(|j| j.parse().unwrap());
|
||||
|
||||
if matches.opt_present("incremental") {
|
||||
if stage.is_none() {
|
||||
stage = Some(1);
|
||||
}
|
||||
if matches.opt_present("incremental") && stage.is_none() {
|
||||
stage = Some(1);
|
||||
}
|
||||
|
||||
Flags {
|
||||
|
|
|
|||
|
|
@ -146,5 +146,5 @@ fn add_destdir(path: &Path, destdir: &Option<PathBuf>) -> PathBuf {
|
|||
_ => {}
|
||||
}
|
||||
}
|
||||
return ret
|
||||
ret
|
||||
}
|
||||
|
|
|
|||
|
|
@ -496,7 +496,7 @@ impl Build {
|
|||
|
||||
self.ci_env.force_coloring_in_ci(&mut cargo);
|
||||
|
||||
return cargo
|
||||
cargo
|
||||
}
|
||||
|
||||
/// Get a path to the compiler specified.
|
||||
|
|
@ -519,7 +519,7 @@ impl Build {
|
|||
let mut rustdoc = self.compiler_path(compiler);
|
||||
rustdoc.pop();
|
||||
rustdoc.push(exe("rustdoc", compiler.host));
|
||||
return rustdoc
|
||||
rustdoc
|
||||
}
|
||||
|
||||
/// Get a `Command` which is ready to run `tool` in `stage` built for
|
||||
|
|
@ -527,7 +527,7 @@ impl Build {
|
|||
fn tool_cmd(&self, compiler: &Compiler, tool: &str) -> Command {
|
||||
let mut cmd = Command::new(self.tool(&compiler, tool));
|
||||
self.prepare_tool_cmd(compiler, &mut cmd);
|
||||
return cmd
|
||||
cmd
|
||||
}
|
||||
|
||||
/// Prepares the `cmd` provided to be able to run the `compiler` provided.
|
||||
|
|
@ -578,7 +578,7 @@ impl Build {
|
|||
if self.config.profiler {
|
||||
features.push_str(" profiler");
|
||||
}
|
||||
return features
|
||||
features
|
||||
}
|
||||
|
||||
/// Get the space-separated set of activated features for the compiler.
|
||||
|
|
@ -587,7 +587,7 @@ impl Build {
|
|||
if self.config.use_jemalloc {
|
||||
features.push_str(" jemalloc");
|
||||
}
|
||||
return features
|
||||
features
|
||||
}
|
||||
|
||||
/// Component directory that Cargo will produce output into (e.g.
|
||||
|
|
@ -834,7 +834,7 @@ impl Build {
|
|||
if target == "i686-pc-windows-gnu" {
|
||||
base.push("-fno-omit-frame-pointer".into());
|
||||
}
|
||||
return base
|
||||
base
|
||||
}
|
||||
|
||||
/// Returns the path to the `ar` archive utility for the target specified.
|
||||
|
|
@ -866,7 +866,7 @@ impl Build {
|
|||
!target.contains("emscripten") {
|
||||
base.push(format!("-Clinker={}", self.cc(target).display()));
|
||||
}
|
||||
return base
|
||||
base
|
||||
}
|
||||
|
||||
/// Returns the "musl root" for this `target`, if defined
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ impl Finder {
|
|||
return Some(target);
|
||||
}
|
||||
}
|
||||
return None;
|
||||
None
|
||||
}).clone()
|
||||
}
|
||||
|
||||
|
|
@ -73,10 +73,8 @@ pub fn check(build: &mut Build) {
|
|||
// one is present as part of the PATH then that can lead to the system
|
||||
// being unable to identify the files properly. See
|
||||
// https://github.com/rust-lang/rust/issues/34959 for more details.
|
||||
if cfg!(windows) {
|
||||
if path.to_string_lossy().contains("\"") {
|
||||
panic!("PATH contains invalid character '\"'");
|
||||
}
|
||||
if cfg!(windows) && path.to_string_lossy().contains("\"") {
|
||||
panic!("PATH contains invalid character '\"'");
|
||||
}
|
||||
|
||||
let mut cmd_finder = Finder::new();
|
||||
|
|
@ -95,12 +93,10 @@ pub fn check(build: &mut Build) {
|
|||
}
|
||||
|
||||
// Ninja is currently only used for LLVM itself.
|
||||
if building_llvm && build.config.ninja {
|
||||
// Some Linux distros rename `ninja` to `ninja-build`.
|
||||
// CMake can work with either binary name.
|
||||
if cmd_finder.maybe_have("ninja-build").is_none() {
|
||||
cmd_finder.must_have("ninja");
|
||||
}
|
||||
// Some Linux distros rename `ninja` to `ninja-build`.
|
||||
// CMake can work with either binary name.
|
||||
if building_llvm && build.config.ninja && cmd_finder.maybe_have("ninja-build").is_none() {
|
||||
cmd_finder.must_have("ninja");
|
||||
}
|
||||
|
||||
build.config.python = build.config.python.take().map(|p| cmd_finder.must_have(p))
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
|
|||
}
|
||||
}
|
||||
}
|
||||
return ret
|
||||
ret
|
||||
};
|
||||
|
||||
// ========================================================================
|
||||
|
|
@ -237,7 +237,7 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
|
|||
s.target)
|
||||
}
|
||||
});
|
||||
return rule
|
||||
rule
|
||||
}
|
||||
|
||||
// Similar to the `libstd`, `libtest`, and `librustc` rules above, except
|
||||
|
|
@ -1326,7 +1326,7 @@ invalid rule dependency graph detected, was a rule added and maybe typo'd?
|
|||
for idx in 0..nodes.len() {
|
||||
self.topo_sort(idx, &idx_to_node, &edges, &mut visited, &mut order);
|
||||
}
|
||||
return order
|
||||
order
|
||||
}
|
||||
|
||||
/// Builds the dependency graph rooted at `step`.
|
||||
|
|
@ -1365,7 +1365,7 @@ invalid rule dependency graph detected, was a rule added and maybe typo'd?
|
|||
}
|
||||
|
||||
edges.entry(idx).or_insert(HashSet::new()).extend(deps);
|
||||
return idx
|
||||
idx
|
||||
}
|
||||
|
||||
/// Given a dependency graph with a finished list of `nodes`, fill out more
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue