about summary refs log tree commit diff
path: root/clippy_dev/src/lint.rs
blob: dfd16f7105438c3b8df74cf26b875e8491509675 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use std::process::{self, Command};

pub fn run(filename: &str) {
    let code = Command::new("cargo")
        .args(["run", "--bin", "clippy-driver", "--"])
        .args(["-L", "./target/debug"])
        .args(["-Z", "no-codegen"])
        .args(["--edition", "2021"])
        .arg(filename)
        .env("__CLIPPY_INTERNAL_TESTS", "true")
        .status()
        .expect("failed to run cargo")
        .code();

    if code.is_none() {
        eprintln!("Killed by signal");
    }

    process::exit(code.unwrap_or(1));
}