diff options
| author | y21 <30553356+y21@users.noreply.github.com> | 2023-05-24 16:10:09 +0200 |
|---|---|---|
| committer | y21 <30553356+y21@users.noreply.github.com> | 2023-05-24 16:10:09 +0200 |
| commit | 95b5a7bbe244eb598fe3eb0bfad9eba6dadd7172 (patch) | |
| tree | f4a711d8898f2e9b124c0a37c93d1047105faae4 | |
| parent | a3438da42f0806225f7533f282ea32b9416c38f8 (diff) | |
| download | rust-95b5a7bbe244eb598fe3eb0bfad9eba6dadd7172.tar.gz rust-95b5a7bbe244eb598fe3eb0bfad9eba6dadd7172.zip | |
replace `-` instead of erroring out
| -rw-r--r-- | clippy_dev/src/main.rs | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/clippy_dev/src/main.rs b/clippy_dev/src/main.rs index 41fdbe099ae..99aa854bc43 100644 --- a/clippy_dev/src/main.rs +++ b/clippy_dev/src/main.rs @@ -5,6 +5,7 @@ use clap::{Arg, ArgAction, ArgMatches, Command}; use clippy_dev::{bless, dogfood, fmt, lint, new_lint, serve, setup, update_lints}; use indoc::indoc; +use std::convert::Infallible; fn main() { let matches = get_clap_config(); @@ -181,13 +182,7 @@ fn get_clap_config() -> ArgMatches { .long("name") .help("Name of the new lint in snake case, ex: fn_too_long") .required(true) - .value_parser(|name: &str| { - if name.contains('-') { - Err("Lint name cannot contain `-`, use `_` instead.") - } else { - Ok(name.to_owned()) - } - }), + .value_parser(|name: &str| Ok::<_, Infallible>(name.replace("-", "_"))), Arg::new("category") .short('c') .long("category") |
