Skip to content

Commit

Permalink
error out if lint name contains dash
Browse files Browse the repository at this point in the history
  • Loading branch information
y21 committed May 23, 2023
1 parent 435a8ad commit a3438da
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion clippy_dev/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,14 @@ fn get_clap_config() -> ArgMatches {
.short('n')
.long("name")
.help("Name of the new lint in snake case, ex: fn_too_long")
.required(true),
.required(true)
.value_parser(|name: &str| {
if name.contains('-') {
Err("Lint name cannot contain `-`, use `_` instead.")
} else {
Ok(name.to_owned())
}
}),
Arg::new("category")
.short('c')
.long("category")
Expand Down

0 comments on commit a3438da

Please sign in to comment.