Skip to content

Commit 6766abb

Browse files
Clippy lints
1 parent 802b6db commit 6766abb

File tree

9 files changed

+37
-43
lines changed

9 files changed

+37
-43
lines changed

src/bootstrap/channel.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,6 @@ impl GitInfo {
9999
version.push_str(&inner.commit_date);
100100
version.push_str(")");
101101
}
102-
return version
102+
version
103103
}
104104
}

src/bootstrap/compile.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -559,23 +559,24 @@ fn run_cargo(build: &Build, cargo: &mut Command, stamp: &Path) {
559559
// If this was an output file in the "host dir" we don't actually
560560
// worry about it, it's not relevant for us.
561561
if filename.starts_with(&host_root_dir) {
562-
continue
562+
continue;
563+
}
563564

564565
// If this was output in the `deps` dir then this is a precise file
565566
// name (hash included) so we start tracking it.
566-
} else if filename.starts_with(&target_deps_dir) {
567+
if filename.starts_with(&target_deps_dir) {
567568
deps.push(filename.to_path_buf());
569+
continue;
570+
}
568571

569572
// Otherwise this was a "top level artifact" which right now doesn't
570573
// have a hash in the name, but there's a version of this file in
571574
// the `deps` folder which *does* have a hash in the name. That's
572575
// the one we'll want to we'll probe for it later.
573-
} else {
574-
toplevel.push((filename.file_stem().unwrap()
575-
.to_str().unwrap().to_string(),
576-
filename.extension().unwrap().to_owned()
577-
.to_str().unwrap().to_string()));
578-
}
576+
toplevel.push((filename.file_stem().unwrap()
577+
.to_str().unwrap().to_string(),
578+
filename.extension().unwrap().to_owned()
579+
.to_str().unwrap().to_string()));
579580
}
580581
}
581582

src/bootstrap/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ impl Config {
417417
config.update_with_config_mk();
418418
}
419419

420-
return config
420+
config
421421
}
422422

423423
/// "Temporary" routine to parse `config.mk` into this configuration.

src/bootstrap/dist.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -488,12 +488,11 @@ fn copy_src_dirs(build: &Build, src_dirs: &[&str], exclude_dirs: &[&str], dst_di
488488
if spath.ends_with("~") || spath.ends_with(".pyc") {
489489
return false
490490
}
491-
if spath.contains("llvm/test") || spath.contains("llvm\\test") {
492-
if spath.ends_with(".ll") ||
493-
spath.ends_with(".td") ||
494-
spath.ends_with(".s") {
495-
return false
496-
}
491+
if (spath.contains("llvm/test") || spath.contains("llvm\\test")) &&
492+
(spath.ends_with(".ll") ||
493+
spath.ends_with(".td") ||
494+
spath.ends_with(".s")) {
495+
return false
497496
}
498497

499498
let full_path = Path::new(dir).join(path);

src/bootstrap/flags.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -315,10 +315,8 @@ Arguments:
315315

316316
let mut stage = matches.opt_str("stage").map(|j| j.parse().unwrap());
317317

318-
if matches.opt_present("incremental") {
319-
if stage.is_none() {
320-
stage = Some(1);
321-
}
318+
if matches.opt_present("incremental") && stage.is_none() {
319+
stage = Some(1);
322320
}
323321

324322
Flags {

src/bootstrap/install.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,5 +146,5 @@ fn add_destdir(path: &Path, destdir: &Option<PathBuf>) -> PathBuf {
146146
_ => {}
147147
}
148148
}
149-
return ret
149+
ret
150150
}

src/bootstrap/lib.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ impl Build {
496496

497497
self.ci_env.force_coloring_in_ci(&mut cargo);
498498

499-
return cargo
499+
cargo
500500
}
501501

502502
/// Get a path to the compiler specified.
@@ -519,15 +519,15 @@ impl Build {
519519
let mut rustdoc = self.compiler_path(compiler);
520520
rustdoc.pop();
521521
rustdoc.push(exe("rustdoc", compiler.host));
522-
return rustdoc
522+
rustdoc
523523
}
524524

525525
/// Get a `Command` which is ready to run `tool` in `stage` built for
526526
/// `host`.
527527
fn tool_cmd(&self, compiler: &Compiler, tool: &str) -> Command {
528528
let mut cmd = Command::new(self.tool(&compiler, tool));
529529
self.prepare_tool_cmd(compiler, &mut cmd);
530-
return cmd
530+
cmd
531531
}
532532

533533
/// Prepares the `cmd` provided to be able to run the `compiler` provided.
@@ -578,7 +578,7 @@ impl Build {
578578
if self.config.profiler {
579579
features.push_str(" profiler");
580580
}
581-
return features
581+
features
582582
}
583583

584584
/// Get the space-separated set of activated features for the compiler.
@@ -587,7 +587,7 @@ impl Build {
587587
if self.config.use_jemalloc {
588588
features.push_str(" jemalloc");
589589
}
590-
return features
590+
features
591591
}
592592

593593
/// Component directory that Cargo will produce output into (e.g.
@@ -834,7 +834,7 @@ impl Build {
834834
if target == "i686-pc-windows-gnu" {
835835
base.push("-fno-omit-frame-pointer".into());
836836
}
837-
return base
837+
base
838838
}
839839

840840
/// Returns the path to the `ar` archive utility for the target specified.
@@ -866,7 +866,7 @@ impl Build {
866866
!target.contains("emscripten") {
867867
base.push(format!("-Clinker={}", self.cc(target).display()));
868868
}
869-
return base
869+
base
870870
}
871871

872872
/// Returns the "musl root" for this `target`, if defined

src/bootstrap/sanity.rs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ impl Finder {
5656
return Some(target);
5757
}
5858
}
59-
return None;
59+
None
6060
}).clone()
6161
}
6262

@@ -73,10 +73,8 @@ pub fn check(build: &mut Build) {
7373
// one is present as part of the PATH then that can lead to the system
7474
// being unable to identify the files properly. See
7575
// https://github.com/rust-lang/rust/issues/34959 for more details.
76-
if cfg!(windows) {
77-
if path.to_string_lossy().contains("\"") {
78-
panic!("PATH contains invalid character '\"'");
79-
}
76+
if cfg!(windows) && path.to_string_lossy().contains("\"") {
77+
panic!("PATH contains invalid character '\"'");
8078
}
8179

8280
let mut cmd_finder = Finder::new();
@@ -95,12 +93,10 @@ pub fn check(build: &mut Build) {
9593
}
9694

9795
// Ninja is currently only used for LLVM itself.
98-
if building_llvm && build.config.ninja {
99-
// Some Linux distros rename `ninja` to `ninja-build`.
100-
// CMake can work with either binary name.
101-
if cmd_finder.maybe_have("ninja-build").is_none() {
102-
cmd_finder.must_have("ninja");
103-
}
96+
// Some Linux distros rename `ninja` to `ninja-build`.
97+
// CMake can work with either binary name.
98+
if building_llvm && build.config.ninja && cmd_finder.maybe_have("ninja-build").is_none() {
99+
cmd_finder.must_have("ninja");
104100
}
105101

106102
build.config.python = build.config.python.take().map(|p| cmd_finder.must_have(p))

src/bootstrap/step.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
148148
}
149149
}
150150
}
151-
return ret
151+
ret
152152
};
153153

154154
// ========================================================================
@@ -237,7 +237,7 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
237237
s.target)
238238
}
239239
});
240-
return rule
240+
rule
241241
}
242242

243243
// 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?
13261326
for idx in 0..nodes.len() {
13271327
self.topo_sort(idx, &idx_to_node, &edges, &mut visited, &mut order);
13281328
}
1329-
return order
1329+
order
13301330
}
13311331

13321332
/// Builds the dependency graph rooted at `step`.
@@ -1365,7 +1365,7 @@ invalid rule dependency graph detected, was a rule added and maybe typo'd?
13651365
}
13661366

13671367
edges.entry(idx).or_insert(HashSet::new()).extend(deps);
1368-
return idx
1368+
idx
13691369
}
13701370

13711371
/// Given a dependency graph with a finished list of `nodes`, fill out more

0 commit comments

Comments
 (0)