@@ -703,8 +703,8 @@ impl Session {
703703 match self . opts . maybe_sysroot {
704704 Some ( ref sysroot) => sysroot,
705705 None => self . default_sysroot
706- . as_ref ( )
707- . expect ( "missing sysroot and default_sysroot in Session" ) ,
706+ . as_ref ( )
707+ . expect ( "missing sysroot and default_sysroot in Session" ) ,
708708 }
709709 }
710710 pub fn target_filesearch ( & self , kind : PathKind ) -> filesearch:: FileSearch < ' _ > {
@@ -727,14 +727,8 @@ impl Session {
727727 pub fn set_incr_session_load_dep_graph ( & self , load : bool ) {
728728 let mut incr_comp_session = self . incr_comp_session . borrow_mut ( ) ;
729729
730- match * incr_comp_session {
731- IncrCompSession :: Active {
732- ref mut load_dep_graph,
733- ..
734- } => {
735- * load_dep_graph = load;
736- }
737- _ => { }
730+ if let IncrCompSession :: Active { ref mut load_dep_graph, .. } = * incr_comp_session {
731+ * load_dep_graph = load;
738732 }
739733 }
740734
@@ -872,9 +866,9 @@ impl Session {
872866 /// This expends fuel if applicable, and records fuel if applicable.
873867 pub fn consider_optimizing < T : Fn ( ) -> String > ( & self , crate_name : & str , msg : T ) -> bool {
874868 let mut ret = true ;
875- match self . optimization_fuel_crate {
876- Some ( ref c ) if c == crate_name => {
877- assert ! ( self . query_threads( ) == 1 ) ;
869+ if let Some ( ref c ) = self . optimization_fuel_crate {
870+ if c == crate_name {
871+ assert_eq ! ( self . query_threads( ) , 1 ) ;
878872 let fuel = self . optimization_fuel_limit . get ( ) ;
879873 ret = fuel != 0 ;
880874 if fuel == 0 && !self . out_of_fuel . get ( ) {
@@ -884,14 +878,12 @@ impl Session {
884878 self . optimization_fuel_limit . set ( fuel - 1 ) ;
885879 }
886880 }
887- _ => { }
888881 }
889- match self . print_fuel_crate {
890- Some ( ref c ) if c == crate_name => {
891- assert ! ( self . query_threads( ) == 1 ) ;
882+ if let Some ( ref c ) = self . print_fuel_crate {
883+ if c == crate_name {
884+ assert_eq ! ( self . query_threads( ) , 1 ) ;
892885 self . print_fuel . set ( self . print_fuel . get ( ) + 1 ) ;
893886 }
894- _ => { }
895887 }
896888 ret
897889 }
@@ -1108,14 +1100,11 @@ pub fn build_session_(
11081100 source_map : Lrc < source_map:: SourceMap > ,
11091101) -> Session {
11101102 let host_triple = TargetTriple :: from_triple ( config:: host_triple ( ) ) ;
1111- let host = match Target :: search ( & host_triple) {
1112- Ok ( t) => t,
1113- Err ( e) => {
1114- span_diagnostic
1115- . fatal ( & format ! ( "Error loading host specification: {}" , e) )
1116- . raise ( ) ;
1117- }
1118- } ;
1103+ let host = Target :: search ( & host_triple) . unwrap_or_else ( |e|
1104+ span_diagnostic
1105+ . fatal ( & format ! ( "Error loading host specification: {}" , e) )
1106+ . raise ( )
1107+ ) ;
11191108 let target_cfg = config:: build_target_config ( & sopts, & span_diagnostic) ;
11201109
11211110 let p_s = parse:: ParseSess :: with_span_handler ( span_diagnostic, source_map) ;
@@ -1135,12 +1124,11 @@ pub fn build_session_(
11351124 let print_fuel_crate = sopts. debugging_opts . print_fuel . clone ( ) ;
11361125 let print_fuel = LockCell :: new ( 0 ) ;
11371126
1138- let working_dir = match env:: current_dir ( ) {
1139- Ok ( dir) => dir,
1140- Err ( e) => p_s. span_diagnostic
1127+ let working_dir = env:: current_dir ( ) . unwrap_or_else ( |e|
1128+ p_s. span_diagnostic
11411129 . fatal ( & format ! ( "Current directory is invalid: {}" , e) )
1142- . raise ( ) ,
1143- } ;
1130+ . raise ( )
1131+ ) ;
11441132 let working_dir = file_path_mapping. map_prefix ( working_dir) ;
11451133
11461134 let cgu_reuse_tracker = if sopts. debugging_opts . query_dep_graph {
0 commit comments