File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ fn main() {
35
35
},
36
36
Some(("new_lint", matches)) => {
37
37
match new_lint::create(
38
- matches.get_one::<String>("pass"),
38
+ matches.get_one::<String>("pass").unwrap() ,
39
39
matches.get_one::<String>("name"),
40
40
matches.get_one::<String>("category").map(String::as_str),
41
41
matches.get_one::<String>("type").map(String::as_str),
@@ -176,7 +176,7 @@ fn get_clap_config() -> ArgMatches {
176
176
.help("Specify whether the lint runs during the early or late pass")
177
177
.value_parser(["early", "late"])
178
178
.conflicts_with("type")
179
- .required_unless_present("type "),
179
+ .default_value("late "),
180
180
Arg::new("name")
181
181
.short('n')
182
182
.long("name")
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ impl<T> Context for io::Result<T> {
37
37
///
38
38
/// This function errors out if the files couldn't be created or written to.
39
39
pub fn create(
40
- pass: Option< &String> ,
40
+ pass: &String,
41
41
lint_name: Option<&String>,
42
42
category: Option<&str>,
43
43
mut ty: Option<&str>,
@@ -49,7 +49,7 @@ pub fn create(
49
49
}
50
50
51
51
let lint = LintData {
52
- pass: pass.map_or("", String::as_str) ,
52
+ pass,
53
53
name: lint_name.expect("`name` argument is validated by clap"),
54
54
category: category.expect("`category` argument is validated by clap"),
55
55
ty,
@@ -63,6 +63,14 @@ pub fn create(
63
63
add_lint(&lint, msrv).context("Unable to add lint to clippy_lints/src/lib.rs")?;
64
64
}
65
65
66
+ if pass == "early" {
67
+ println!(
68
+ "\n\
69
+ NOTE: Use a late pass unless you need something specific from\
70
+ an early pass, as they lack many features and utilities"
71
+ );
72
+ }
73
+
66
74
Ok(())
67
75
}
68
76
You can’t perform that action at this time.
0 commit comments