提交 6766abbf 编写于 作者: M Mark Simulacrum

Clippy lints

上级 802b6db0
......@@ -99,6 +99,6 @@ pub fn version(&self, build: &Build, num: &str) -> String {
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 @@ pub fn parse(build: &str, file: Option<PathBuf>) -> Config {
config.update_with_config_mk();
}
return config
config
}
/// "Temporary" routine to parse `config.mk` into this configuration.
......
......@@ -488,12 +488,11 @@ fn filter_fn(exclude_dirs: &[&str], dir: &str, path: &Path) -> bool {
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 @@ pub fn parse(args: &[String]) -> Flags {
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 @@ fn cargo(&self,
self.ci_env.force_coloring_in_ci(&mut cargo);
return cargo
cargo
}
/// Get a path to the compiler specified.
......@@ -519,7 +519,7 @@ fn rustdoc(&self, compiler: &Compiler) -> PathBuf {
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 @@ fn rustdoc(&self, compiler: &Compiler) -> PathBuf {
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 @@ fn std_features(&self) -> String {
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 @@ fn rustc_features(&self) -> String {
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 @@ fn cflags(&self, target: &str) -> Vec<String> {
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 @@ fn rustc_flags(&self, target: &str) -> Vec<String> {
!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 @@ fn maybe_have<S: AsRef<OsStr>>(&mut self, cmd: S) -> Option<PathBuf> {
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 @@ fn crate_rule<'a, 'b>(build: &'a Build,
s.target)
}
});
return rule
rule
}
// Similar to the `libstd`, `libtest`, and `librustc` rules above, except
......@@ -1326,7 +1326,7 @@ fn expand(&self, steps: &[Step<'a>]) -> Vec<Step<'a>> {
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 @@ fn build_graph(&self,
}
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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册