Skip to content

Commit 95b5a7b

Browse files
committed
replace - instead of erroring out
1 parent a3438da commit 95b5a7b

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

clippy_dev/src/main.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use clap::{Arg, ArgAction, ArgMatches, Command};
66
use clippy_dev::{bless, dogfood, fmt, lint, new_lint, serve, setup, update_lints};
77
use indoc::indoc;
8+
use std::convert::Infallible;
89

910
fn main() {
1011
let matches = get_clap_config();
@@ -181,13 +182,7 @@ fn get_clap_config() -> ArgMatches {
181182
.long("name")
182183
.help("Name of the new lint in snake case, ex: fn_too_long")
183184
.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-
}),
185+
.value_parser(|name: &str| Ok::<_, Infallible>(name.replace("-", "_"))),
191186
Arg::new("category")
192187
.short('c')
193188
.long("category")

0 commit comments

Comments
 (0)