File tree 1 file changed +8
-9
lines changed
1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -462,16 +462,15 @@ fn print_version() {
462
462
463
463
fn determine_operation ( matches : & Matches ) -> Result < Operation , OperationError > {
464
464
if matches. opt_present ( "h" ) {
465
- let topic = matches. opt_str ( "h" ) ;
466
- if topic. is_none ( ) {
465
+ let Some ( topic) = matches. opt_str ( "h" ) else {
467
466
return Ok ( Operation :: Help ( HelpOp :: None ) ) ;
468
- } else if topic == Some ( "config" . to_owned ( ) ) {
469
- return Ok ( Operation :: Help ( HelpOp :: Config ) ) ;
470
- } else if topic == Some ( "file-lines" . to_owned ( ) ) && is_nightly ( ) {
471
- return Ok ( Operation :: Help ( HelpOp :: FileLines ) ) ;
472
- } else {
473
- return Err ( OperationError :: UnknownHelpTopic ( topic. unwrap ( ) ) ) ;
474
- }
467
+ } ;
468
+
469
+ return match topic. as_str ( ) {
470
+ "config" => Ok ( Operation :: Help ( HelpOp :: Config ) ) ,
471
+ "file-lines" if is_nightly ( ) => Ok ( Operation :: Help ( HelpOp :: FileLines ) ) ,
472
+ _ => Err ( OperationError :: UnknownHelpTopic ( topic) ) ,
473
+ } ;
475
474
}
476
475
let mut free_matches = matches. free . iter ( ) ;
477
476
You can’t perform that action at this time.
0 commit comments