diff options
| -rw-r--r-- | clippy_dev/src/lint.rs | 4 | ||||
| -rw-r--r-- | clippy_dev/src/main.rs | 5 |
2 files changed, 6 insertions, 3 deletions
diff --git a/clippy_dev/src/lint.rs b/clippy_dev/src/lint.rs index 125195397e6..e0e036757d5 100644 --- a/clippy_dev/src/lint.rs +++ b/clippy_dev/src/lint.rs @@ -2,7 +2,7 @@ use crate::utils::{cargo_clippy_path, exit_if_err}; use std::process::{self, Command}; use std::{env, fs}; -pub fn run<'a>(path: &str, args: impl Iterator<Item = &'a String>) { +pub fn run<'a>(path: &str, edition: &str, args: impl Iterator<Item = &'a String>) { let is_file = match fs::metadata(path) { Ok(metadata) => metadata.is_file(), Err(e) => { @@ -17,7 +17,7 @@ pub fn run<'a>(path: &str, args: impl Iterator<Item = &'a String>) { .args(["run", "--bin", "clippy-driver", "--"]) .args(["-L", "./target/debug"]) .args(["-Z", "no-codegen"]) - .args(["--edition", "2021"]) + .args(["--edition", edition]) .arg(path) .args(args) // Prevent rustc from creating `rustc-ice-*` files the console output is enough. diff --git a/clippy_dev/src/main.rs b/clippy_dev/src/main.rs index 56ed60256f1..93a74ba8387 100644 --- a/clippy_dev/src/main.rs +++ b/clippy_dev/src/main.rs @@ -68,7 +68,7 @@ fn main() { RemoveSubcommand::VscodeTasks => setup::vscode::remove_tasks(), }, DevCommand::Serve { port, lint } => serve::run(port, lint), - DevCommand::Lint { path, args } => lint::run(&path, args.iter()), + DevCommand::Lint { path, edition, args } => lint::run(&path, &edition, args.iter()), DevCommand::RenameLint { old_name, new_name, @@ -206,6 +206,9 @@ enum DevCommand { /// cargo dev lint file.rs -- -W clippy::pedantic {n} /// cargo dev lint ~/my-project -- -- -W clippy::pedantic Lint { + /// The Rust edition to use + #[arg(long, default_value = "2024")] + edition: String, /// The path to a file or package directory to lint path: String, /// Pass extra arguments to cargo/clippy-driver |
