File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -462,16 +462,15 @@ fn print_version() {
462462
463463fn determine_operation ( matches : & Matches ) -> Result < Operation , OperationError > {
464464 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 {
467466 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+ } ;
475474 }
476475 let mut free_matches = matches. free . iter ( ) ;
477476
You can’t perform that action at this time.
0 commit comments