]> git.lizzy.rs Git - rust.git/blob - clippy_dev/src/dogfood.rs
rustc: Parameterize `ty::Visibility` over used ID
[rust.git] / clippy_dev / src / dogfood.rs
1 use crate::clippy_project_root;
2 use std::process::Command;
3
4 /// # Panics
5 ///
6 /// Panics if unable to run the dogfood test
7 pub fn dogfood(fix: bool, allow_dirty: bool, allow_staged: bool) {
8     let mut cmd = Command::new("cargo");
9
10     cmd.current_dir(clippy_project_root())
11         .args(["test", "--test", "dogfood"])
12         .args(["--features", "internal"])
13         .args(["--", "dogfood_clippy"]);
14
15     let mut dogfood_args = Vec::new();
16     if fix {
17         dogfood_args.push("--fix");
18     }
19
20     if allow_dirty {
21         dogfood_args.push("--allow-dirty");
22     }
23
24     if allow_staged {
25         dogfood_args.push("--allow-staged");
26     }
27
28     cmd.env("__CLIPPY_DOGFOOD_ARGS", dogfood_args.join(" "));
29
30     let output = cmd.output().expect("failed to run command");
31
32     println!("{}", String::from_utf8_lossy(&output.stdout));
33 }