Skip to content

Commit a3438da

Browse files
committed
error out if lint name contains dash
1 parent 435a8ad commit a3438da

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

clippy_dev/src/main.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,14 @@ fn get_clap_config() -> ArgMatches {
180180
.short('n')
181181
.long("name")
182182
.help("Name of the new lint in snake case, ex: fn_too_long")
183-
.required(true),
183+
.required(true)
184+
.value_parser(|name: &str| {
185+
if name.contains('-') {
186+
Err("Lint name cannot contain `-`, use `_` instead.")
187+
} else {
188+
Ok(name.to_owned())
189+
}
190+
}),
184191
Arg::new("category")
185192
.short('c')
186193
.long("category")

0 commit comments

Comments
 (0)