@@ -22,15 +22,21 @@ pub fn cli() -> Command {
2222 . arg_silent_suggestion ( )
2323 . arg ( flag ( "no-dev-dependencies" , "Deprecated, use -e=no-dev instead" ) . hide ( true ) )
2424 . arg (
25- multi_opt (
26- "edges" ,
27- "KINDS" ,
28- "The kinds of dependencies to display \
29- (features, normal, build, dev, all, \
30- no-normal, no-build, no-dev, no-proc-macro)",
31- )
32- . short ( 'e' )
33- . value_delimiter ( ',' ) ,
25+ multi_opt ( "edges" , "KINDS" , "The kinds of dependencies to display" )
26+ . short ( 'e' )
27+ . value_delimiter ( ',' )
28+ . value_parser ( [
29+ "features" ,
30+ "normal" ,
31+ "build" ,
32+ "dev" ,
33+ "all" ,
34+ "public" ,
35+ "no-normal" ,
36+ "no-build" ,
37+ "no-dev" ,
38+ "no-proc-macro" ,
39+ ] ) ,
3440 )
3541 . arg (
3642 optional_multi_opt (
@@ -311,15 +317,6 @@ fn parse_edge_kinds(
311317 result. insert ( EdgeKind :: Dep ( DepKind :: Build ) ) ;
312318 result. insert ( EdgeKind :: Dep ( DepKind :: Development ) ) ;
313319 } ;
314- let unknown = |k| {
315- bail ! (
316- "unknown edge kind `{}`, valid values are \
317- \" normal\" , \" build\" , \" dev\" , \
318- \" no-normal\" , \" no-build\" , \" no-dev\" , \" no-proc-macro\" , \
319- \" features\" , or \" all\" ",
320- k
321- )
322- } ;
323320 if kinds. iter ( ) . any ( |k| k. starts_with ( "no-" ) ) {
324321 insert_defaults ( & mut result) ;
325322 for kind in & kinds {
@@ -336,7 +333,7 @@ fn parse_edge_kinds(
336333 kind
337334 )
338335 }
339- k => return unknown ( k ) ,
336+ _ => unreachable ! ( "`{kind}` was validated by clap" ) ,
340337 } ;
341338 }
342339 return Ok ( ( result, no_proc_macro, public) ) ;
@@ -359,7 +356,7 @@ fn parse_edge_kinds(
359356 "dev" => {
360357 result. insert ( EdgeKind :: Dep ( DepKind :: Development ) ) ;
361358 }
362- k => return unknown ( k ) ,
359+ _ => unreachable ! ( "`{kind}` was validated by clap" ) ,
363360 }
364361 }
365362 if kinds. len ( ) == 1 && kinds[ 0 ] == "features" {
0 commit comments