tree-sitter/crates/xtask/src/clippy.rs
Max Brunsfeld 0fdf569571
Reorganize rust crates into a flat crates directory, simplify some CI steps (#4496)
* Move all rust crates (except lib) into crates dir, w/o nesting

* Remove stale path from .gitattributes

* Rename lib.rs files for easier navigation

* Rename mod.rs file for easier navigation

* Fix emscripten-version path

* Fix fixtures dir paths

* Use the default rustfmt settings

* Don't use nightly on CI
2025-06-06 14:25:37 -07:00

33 lines
717 B
Rust

use std::process::Command;
use anyhow::Result;
use crate::{bail_on_err, Clippy};
pub fn run(args: &Clippy) -> Result<()> {
let mut clippy_command = Command::new("cargo");
clippy_command.arg("clippy");
if let Some(package) = args.package.as_ref() {
clippy_command.args(["--package", package]);
} else {
clippy_command.arg("--workspace");
}
clippy_command
.arg("--release")
.arg("--all-targets")
.arg("--all-features")
.arg("--")
.arg("-D")
.arg("warnings");
if args.fix {
clippy_command.arg("--fix");
}
bail_on_err(
&clippy_command.spawn()?.wait_with_output()?,
"Clippy failed",
)
}