Skip to content

Commit fb9508d

Browse files
authored
Fix new_lint clippy command (#14642)
I'm working on #14542 and I decided to name the lint `unnecessary_map` originally. However when I ran the command, I got: ``` thread 'main' panicked at clippy_dev/src/new_lint.rs:450:5: Lint `unnecessary_map` already defined in `/home/imperio/rust/clippy/clippy_lints/src/methods/mod.rs` note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ``` It's because there is already a `unnecessary_map_or`, which matches the `.contains()` call. This PR strengthens this check. changelog: Fix `new_lint` clippy command r? @flip1995
2 parents a53acef + 7bfb15c commit fb9508d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

clippy_dev/src/new_lint.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ fn setup_mod_file(path: &Path, lint: &LintData<'_>) -> io::Result<&'static str>
448448

449449
let mut file_contents = fs::read_to_string(path)?;
450450
assert!(
451-
!file_contents.contains(&lint_name_upper),
451+
!file_contents.contains(&format!("pub {lint_name_upper},")),
452452
"Lint `{}` already defined in `{}`",
453453
lint.name,
454454
path.display()

0 commit comments

Comments
 (0)