mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-08 01:28:18 +03:00
replace - instead of erroring out
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user