aboutsummaryrefslogtreecommitdiff
path: root/crates/tools/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/tools/src/lib.rs')
-rw-r--r--crates/tools/src/lib.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/crates/tools/src/lib.rs b/crates/tools/src/lib.rs
index 11b52ccb7..92634655d 100644
--- a/crates/tools/src/lib.rs
+++ b/crates/tools/src/lib.rs
@@ -133,6 +133,34 @@ pub fn install_format_hook() -> Result<()> {
133 Ok(()) 133 Ok(())
134} 134}
135 135
136pub fn run_clippy() -> Result<()> {
137 match Command::new("rustup")
138 .args(&["run", TOOLCHAIN, "--", "cargo", "clippy", "--version"])
139 .stderr(Stdio::null())
140 .stdout(Stdio::null())
141 .status()
142 {
143 Ok(status) if status.success() => (),
144 _ => install_clippy()?,
145 };
146
147 let allowed_lints = ["clippy::collapsible_if", "clippy::nonminimal_bool"];
148 run(
149 &format!(
150 "rustup run {} -- cargo clippy --all-features --all-targets -- -A {}",
151 TOOLCHAIN,
152 allowed_lints.join(" -A ")
153 ),
154 ".",
155 )?;
156 Ok(())
157}
158
159pub fn install_clippy() -> Result<()> {
160 run(&format!("rustup install {}", TOOLCHAIN), ".")?;
161 run(&format!("rustup component add clippy --toolchain {}", TOOLCHAIN), ".")
162}
163
136pub fn run_fuzzer() -> Result<()> { 164pub fn run_fuzzer() -> Result<()> {
137 match Command::new("cargo") 165 match Command::new("cargo")
138 .args(&["fuzz", "--help"]) 166 .args(&["fuzz", "--help"])