Skip to content

Commit

Permalink
fix: Allow arguments after "--"
Browse files Browse the repository at this point in the history
  • Loading branch information
Flix authored and appetrosyan committed Jun 7, 2022
1 parent f0d7d24 commit 2f8cad2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,18 @@ impl Lints {
}

pub fn clippy(&self, args: &[String]) -> Result<()> {
let mut split_args = args.splitn(2, |arg| arg == "--");
let pre_args = split_args.next().unwrap(); // Always exists
let post_args = split_args.next().unwrap_or(&[]);

let code = Command::new("cargo")
.arg("clippy")
.args(args)
.args(pre_args)
.arg("--")
.args(self.deny_flags())
.args(self.warn_flags())
.args(self.allow_flags())
.args(post_args)
.spawn()
.wrap_err("Failed to start clippy")?
.wait()
Expand Down

0 comments on commit 2f8cad2

Please sign in to comment.