Skip to content

Commit 6dd477a

Browse files
committed
Add --allow-no-vcs to cargo dev dogfood --fix
Some developers might prefer to use alternate VCS, such as Jujutsu, which are not detected by `cargo fix`. This forwards the `--allow-no-vcs` command line argument to `cargo fix`.
1 parent 8cef0b6 commit 6dd477a

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

clippy_dev/src/dogfood.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ use std::process::Command;
44
/// # Panics
55
///
66
/// Panics if unable to run the dogfood test
7-
pub fn dogfood(fix: bool, allow_dirty: bool, allow_staged: bool) {
7+
#[allow(clippy::fn_params_excessive_bools)]
8+
pub fn dogfood(fix: bool, allow_dirty: bool, allow_staged: bool, allow_no_vcs: bool) {
89
let mut cmd = Command::new("cargo");
910

1011
cmd.current_dir(clippy_project_root())
@@ -25,6 +26,10 @@ pub fn dogfood(fix: bool, allow_dirty: bool, allow_staged: bool) {
2526
dogfood_args.push("--allow-staged");
2627
}
2728

29+
if allow_no_vcs {
30+
dogfood_args.push("--allow-no-vcs");
31+
}
32+
2833
cmd.env("__CLIPPY_DOGFOOD_ARGS", dogfood_args.join(" "));
2934

3035
exit_if_err(cmd.status());

clippy_dev/src/main.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ fn main() {
1717
fix,
1818
allow_dirty,
1919
allow_staged,
20-
} => dogfood::dogfood(fix, allow_dirty, allow_staged),
20+
allow_no_vcs,
21+
} => dogfood::dogfood(fix, allow_dirty, allow_staged, allow_no_vcs),
2122
DevCommand::Fmt { check, verbose } => fmt::run(check, verbose),
2223
DevCommand::UpdateLints { print_only, check } => {
2324
if print_only {
@@ -106,6 +107,9 @@ enum DevCommand {
106107
#[arg(long, requires = "fix")]
107108
/// Fix code even if the working directory has staged changes
108109
allow_staged: bool,
110+
#[arg(long, requires = "fix")]
111+
/// Fix code even if a VCS was not detected
112+
allow_no_vcs: bool,
109113
},
110114
/// Run rustfmt on all projects and tests
111115
Fmt {

0 commit comments

Comments
 (0)