Skip to content

Commit 0b4b993

Browse files
committed
save dev state
Signed-off-by: onur-ozkan <[email protected]>
1 parent b6e4299 commit 0b4b993

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
use crate::core::builder::Builder;
2+
use std::path::PathBuf;
3+
4+
pub fn lint(build: &Builder<'_>, paths: &[PathBuf]) {
5+
if build.config.dry_run() {
6+
return;
7+
}
8+
9+
let compiler = build.compiler(0, build.config.build);
10+
11+
for path in paths {
12+
let mut clippy = build.cargo_clippy_cmd(compiler);
13+
clippy.current_dir(path);
14+
15+
clippy.env("RUSTC_BOOTSTRAP", "1");
16+
clippy.args(["--all-targets", "--all-features", "--", "--D", "warnings"]);
17+
build.run(&mut clippy);
18+
}
19+
}

src/bootstrap/src/core/build_steps/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ pub(crate) mod dist;
55
pub(crate) mod doc;
66
pub(crate) mod format;
77
pub(crate) mod install;
8+
pub(crate) mod lint;
89
pub(crate) mod llvm;
910
pub(crate) mod run;
1011
pub(crate) mod setup;

src/bootstrap/src/core/build_steps/test.rs

+11
Original file line numberDiff line numberDiff line change
@@ -1117,6 +1117,17 @@ HELP: to skip test's attempt to check tidiness, pass `--skip src/tools/tidy` to
11171117
crate::exit!(1);
11181118
}
11191119
crate::core::build_steps::format::format(builder, !builder.config.cmd.bless(), &[]);
1120+
1121+
// TODO: don't run this by default (check if clippy is enabled in the build configuration)
1122+
builder.info("lint check");
1123+
crate::core::build_steps::lint::lint(
1124+
builder,
1125+
&[
1126+
builder.src.join("src/bootstrap"),
1127+
builder.src.join("src/tools/x"),
1128+
builder.src.join("src/tools/compiletest"),
1129+
],
1130+
);
11201131
}
11211132

11221133
builder.info("tidy check");

0 commit comments

Comments
 (0)