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() {
3535 } ,
3636 Some ( ( "new_lint" , matches) ) => {
3737 match new_lint:: create (
38- matches. get_one :: < String > ( "pass" ) ,
38+ matches. get_one :: < String > ( "pass" ) . unwrap ( ) ,
3939 matches. get_one :: < String > ( "name" ) ,
4040 matches. get_one :: < String > ( "category" ) . map ( String :: as_str) ,
4141 matches. get_one :: < String > ( "type" ) . map ( String :: as_str) ,
@@ -176,7 +176,7 @@ fn get_clap_config() -> ArgMatches {
176176 . help ( "Specify whether the lint runs during the early or late pass" )
177177 . value_parser ( [ "early" , "late" ] )
178178 . conflicts_with ( "type" )
179- . required_unless_present ( "type ") ,
179+ . default_value ( "late ") ,
180180 Arg :: new ( "name" )
181181 . short ( 'n' )
182182 . long ( "name" )
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ impl<T> Context for io::Result<T> {
3737///
3838/// This function errors out if the files couldn't be created or written to.
3939pub fn create (
40- pass : Option < & String > ,
40+ pass : & String ,
4141 lint_name : Option < & String > ,
4242 category : Option < & str > ,
4343 mut ty : Option < & str > ,
@@ -49,7 +49,7 @@ pub fn create(
4949 }
5050
5151 let lint = LintData {
52- pass : pass . map_or ( "" , String :: as_str ) ,
52+ pass,
5353 name : lint_name. expect ( "`name` argument is validated by clap" ) ,
5454 category : category. expect ( "`category` argument is validated by clap" ) ,
5555 ty,
@@ -63,6 +63,14 @@ pub fn create(
6363 add_lint ( & lint, msrv) . context ( "Unable to add lint to clippy_lints/src/lib.rs" ) ?;
6464 }
6565
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+
6674 Ok ( ( ) )
6775}
6876
You can’t perform that action at this time.
0 commit comments