diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-03-14 13:10:06 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-03-14 13:10:06 +0000 |
commit | 0c2f570151749d14e351f30fa234693b36bc4e72 (patch) | |
tree | 717c195e1ea7894c25d62cdab0b6c4526585eba1 | |
parent | a8a7fa834726eb763fe872b02db821f99098a498 (diff) | |
parent | 5008e5682159965c6f3b174aed3523c0b5e2fc08 (diff) |
Merge #8012
8012: xtask: replace "lint" command by a simply cargo alias r=matklad a=matthiaskrgr
This strips the run_clippy implementation out of xtask and replaces it by
a simple "cargo lint" alias which runs clippy with the corresponding flags.
Unfortunately I could not name the alias "clippy" because that would lead to infinite recursion. :sweat_smile:
Co-authored-by: Matthias Krüger <[email protected]>
-rw-r--r-- | .cargo/config | 1 | ||||
-rw-r--r-- | xtask/src/flags.rs | 2 | ||||
-rw-r--r-- | xtask/src/main.rs | 20 |
3 files changed, 1 insertions, 22 deletions
diff --git a/.cargo/config b/.cargo/config index f6b0b66bf..1447614b7 100644 --- a/.cargo/config +++ b/.cargo/config | |||
@@ -3,6 +3,7 @@ xtask = "run --package xtask --bin xtask --" | |||
3 | install-ra = "run --package xtask --bin xtask -- install" # for backwards compat | 3 | install-ra = "run --package xtask --bin xtask -- install" # for backwards compat |
4 | tq = "test -- -q" | 4 | tq = "test -- -q" |
5 | qt = "tq" | 5 | qt = "tq" |
6 | lint = "clippy --all-targets -- -Aclippy::collapsible_if -Aclippy::needless_pass_by_value -Aclippy::nonminimal_bool -Aclippy::redundant_pattern_matching --cap-lints warn" | ||
6 | 7 | ||
7 | [target.x86_64-pc-windows-msvc] | 8 | [target.x86_64-pc-windows-msvc] |
8 | linker = "rust-lld" | 9 | linker = "rust-lld" |
diff --git a/xtask/src/flags.rs b/xtask/src/flags.rs index 48d1ad45e..4cd2b1ddb 100644 --- a/xtask/src/flags.rs +++ b/xtask/src/flags.rs | |||
@@ -27,7 +27,6 @@ xflags::xflags! { | |||
27 | optional --jemalloc | 27 | optional --jemalloc |
28 | } | 28 | } |
29 | 29 | ||
30 | cmd lint {} | ||
31 | cmd fuzz-tests {} | 30 | cmd fuzz-tests {} |
32 | cmd pre-cache {} | 31 | cmd pre-cache {} |
33 | 32 | ||
@@ -63,7 +62,6 @@ pub struct Xtask { | |||
63 | pub enum XtaskCmd { | 62 | pub enum XtaskCmd { |
64 | Help(Help), | 63 | Help(Help), |
65 | Install(Install), | 64 | Install(Install), |
66 | Lint(Lint), | ||
67 | FuzzTests(FuzzTests), | 65 | FuzzTests(FuzzTests), |
68 | PreCache(PreCache), | 66 | PreCache(PreCache), |
69 | Release(Release), | 67 | Release(Release), |
diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 057cd57ae..915aae71a 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs | |||
@@ -40,7 +40,6 @@ fn main() -> Result<()> { | |||
40 | return Ok(()); | 40 | return Ok(()); |
41 | } | 41 | } |
42 | flags::XtaskCmd::Install(cmd) => cmd.run(), | 42 | flags::XtaskCmd::Install(cmd) => cmd.run(), |
43 | flags::XtaskCmd::Lint(_) => run_clippy(), | ||
44 | flags::XtaskCmd::FuzzTests(_) => run_fuzzer(), | 43 | flags::XtaskCmd::FuzzTests(_) => run_fuzzer(), |
45 | flags::XtaskCmd::PreCache(cmd) => cmd.run(), | 44 | flags::XtaskCmd::PreCache(cmd) => cmd.run(), |
46 | flags::XtaskCmd::Release(cmd) => cmd.run(), | 45 | flags::XtaskCmd::Release(cmd) => cmd.run(), |
@@ -95,25 +94,6 @@ fn ensure_rustfmt() -> Result<()> { | |||
95 | Ok(()) | 94 | Ok(()) |
96 | } | 95 | } |
97 | 96 | ||
98 | fn run_clippy() -> Result<()> { | ||
99 | if cmd!("cargo clippy --version").read().is_err() { | ||
100 | bail!( | ||
101 | "Failed run cargo clippy. \ | ||
102 | Please run `rustup component add clippy` to install it.", | ||
103 | ) | ||
104 | } | ||
105 | |||
106 | let allowed_lints = " | ||
107 | -A clippy::collapsible_if | ||
108 | -A clippy::needless_pass_by_value | ||
109 | -A clippy::nonminimal_bool | ||
110 | -A clippy::redundant_pattern_matching | ||
111 | " | ||
112 | .split_ascii_whitespace(); | ||
113 | cmd!("cargo clippy --all-features --all-targets -- {allowed_lints...}").run()?; | ||
114 | Ok(()) | ||
115 | } | ||
116 | |||
117 | fn run_fuzzer() -> Result<()> { | 97 | fn run_fuzzer() -> Result<()> { |
118 | let _d = pushd("./crates/syntax")?; | 98 | let _d = pushd("./crates/syntax")?; |
119 | let _e = pushenv("RUSTUP_TOOLCHAIN", "nightly"); | 99 | let _e = pushenv("RUSTUP_TOOLCHAIN", "nightly"); |