@@ -518,42 +518,34 @@ impl<'a> Cfg<'a> {
518518 & self ,
519519 ) -> Result < Option < ( LocalToolchainName , ActiveReason ) > > {
520520 Ok (
521- if let Some ( ( override_config, reason) ) = self . find_override_config ( ) ? {
521+ match self . find_override_config ( ) ? { Some ( ( override_config, reason) ) => {
522522 Some ( ( override_config. into_local_toolchain_name ( ) , reason) )
523- } else {
523+ } _ => {
524524 self . get_default ( ) ?
525525 . map ( |x| ( x. into ( ) , ActiveReason :: Default ) )
526- } ,
526+ } } ,
527527 )
528528 }
529529
530530 fn find_override_config ( & self ) -> Result < Option < ( OverrideCfg , ActiveReason ) > > {
531531 let override_config: Option < ( OverrideCfg , ActiveReason ) > =
532532 // First check +toolchain override from the command line
533- if let Some ( ref name) = self . toolchain_override {
533+ match self . toolchain_override { Some ( ref name) => {
534534 let override_config = name. resolve ( & self . get_default_host_triple ( ) ?) ?. into ( ) ;
535535 Some ( ( override_config, ActiveReason :: CommandLine ) )
536- }
537- // Then check the RUSTUP_TOOLCHAIN environment variable
538- else if let Some ( ref name) = self . env_override {
536+ } _ => { match self . env_override { Some ( ref name) => {
539537 // Because path based toolchain files exist, this has to support
540538 // custom, distributable, and absolute path toolchains otherwise
541539 // rustup's export of a RUSTUP_TOOLCHAIN when running a process will
542540 // error when a nested rustup invocation occurs
543541 Some ( ( name. clone ( ) . into ( ) , ActiveReason :: Environment ) )
544- }
545- // Then walk up the directory tree from 'path' looking for either the
546- // directory in the override database, or a `rust-toolchain{.toml}` file,
547- // in that order.
548- else if let Some ( ( override_cfg, active_reason) ) = self . settings_file . with ( |s| {
542+ } _ => { match self . settings_file . with ( |s| {
549543 self . find_override_from_dir_walk ( & self . current_dir , s)
550- } ) ? {
544+ } ) ? { Some ( ( override_cfg , active_reason ) ) => {
551545 Some ( ( override_cfg, active_reason) )
552- }
553- // Otherwise, there is no override.
554- else {
546+ } _ => {
555547 None
556- } ;
548+ } } } } } } ;
557549
558550 Ok ( override_config)
559551 }
@@ -753,15 +745,15 @@ impl<'a> Cfg<'a> {
753745 force_non_host : bool ,
754746 verbose : bool ,
755747 ) -> Result < ( LocalToolchainName , ActiveReason ) > {
756- if let Some ( ( override_config, reason) ) = self . find_override_config ( ) ? {
748+ match self . find_override_config ( ) ? { Some ( ( override_config, reason) ) => {
757749 let toolchain = override_config. clone ( ) . into_local_toolchain_name ( ) ;
758- if let OverrideCfg :: Official {
750+ match override_config
751+ { OverrideCfg :: Official {
759752 toolchain,
760753 components,
761754 targets,
762755 profile,
763- } = override_config
764- {
756+ } => {
765757 self . ensure_installed (
766758 & toolchain,
767759 components,
@@ -771,22 +763,22 @@ impl<'a> Cfg<'a> {
771763 verbose,
772764 )
773765 . await ?;
774- } else {
766+ } _ => {
775767 Toolchain :: with_reason ( self , toolchain. clone ( ) , & reason) ?;
776- }
768+ } }
777769 Ok ( ( toolchain, reason) )
778- } else if let Some ( toolchain ) = self . get_default ( ) ? {
770+ } _ => { match self . get_default ( ) ? { Some ( toolchain ) => {
779771 let reason = ActiveReason :: Default ;
780- if let ToolchainName :: Official ( desc) = & toolchain {
772+ match & toolchain { ToolchainName :: Official ( desc) => {
781773 self . ensure_installed ( desc, vec ! [ ] , vec ! [ ] , None , force_non_host, verbose)
782774 . await ?;
783- } else {
775+ } _ => {
784776 Toolchain :: with_reason ( self , toolchain. clone ( ) . into ( ) , & reason) ?;
785- }
777+ } }
786778 Ok ( ( toolchain. into ( ) , reason) )
787- } else {
779+ } _ => {
788780 Err ( no_toolchain_error ( self . process ) )
789- }
781+ } } } }
790782 }
791783
792784 // Returns a Toolchain matching the given ToolchainDesc, installing it and
@@ -894,11 +886,11 @@ impl<'a> Cfg<'a> {
894886 self . list_toolchains ( ) ?
895887 . into_iter ( )
896888 . filter_map ( |t| {
897- if let ToolchainName :: Official ( desc) = t {
889+ match t { ToolchainName :: Official ( desc) => {
898890 Some ( desc)
899- } else {
891+ } _ => {
900892 None
901- }
893+ } }
902894 } )
903895 . filter ( ToolchainDesc :: is_tracking)
904896 . map ( |n| {
0 commit comments