mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-06 20:28:33 +00:00
error out if lint name contains dash
This commit is contained in:
parent
435a8ad86c
commit
a3438da42f
@ -180,7 +180,14 @@ fn get_clap_config() -> ArgMatches {
|
|||||||
.short('n')
|
.short('n')
|
||||||
.long("name")
|
.long("name")
|
||||||
.help("Name of the new lint in snake case, ex: fn_too_long")
|
.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")
|
Arg::new("category")
|
||||||
.short('c')
|
.short('c')
|
||||||
.long("category")
|
.long("category")
|
||||||
|
Loading…
Reference in New Issue
Block a user