@@ -47,7 +47,7 @@ You can read more about trait objects in the Trait Objects section of the Refere
4747 https://doc.rust-lang.org/reference/types.html#trait-objects"; 
4848
4949fn  is_number ( text :  & str )  -> bool  { 
50-     text. chars ( ) . all ( |c :  char | c. is_digit ( 10 ) ) 
50+     text. chars ( ) . all ( |c :  char | c. is_ascii_digit ( ) ) 
5151} 
5252
5353/// Information about the expected type at the top level of type checking a pattern. 
@@ -262,8 +262,9 @@ enum InheritedRefMatchRule {
262262         /// pattern matches a given type: 
263263         /// - If the underlying type is not a reference, a reference pattern may eat the inherited reference; 
264264         /// - If the underlying type is a reference, a reference pattern matches if it can eat either one 
265-          ///    of the underlying and inherited references. E.g. a `&mut` pattern is allowed if either the 
266-          ///    underlying type is `&mut` or the inherited reference is `&mut`. 
265+          ///   of the underlying and inherited references. E.g. a `&mut` pattern is allowed if either the 
266+          ///   underlying type is `&mut` or the inherited reference is `&mut`. 
267+          /// 
267268         /// If `false`, a reference pattern is only matched against the underlying type. 
268269         /// This is `false` for stable Rust and `true` for both the `ref_pat_eat_one_layer_2024` and 
269270         /// `ref_pat_eat_one_layer_2024_structural` feature gates. 
@@ -1069,7 +1070,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
10691070                { 
10701071                    if  !self . tcx . features ( ) . mut_ref ( )  { 
10711072                        feature_err ( 
1072-                             & self . tcx . sess , 
1073+                             self . tcx . sess , 
10731074                            sym:: mut_ref, 
10741075                            pat. span . until ( ident. span ) , 
10751076                            "binding cannot be both mutable and by-reference" , 
@@ -1487,31 +1488,24 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
14871488        opt_def_id :  Option < hir:: def_id:: DefId > , 
14881489        ident :  Ident , 
14891490    )  -> bool  { 
1490-         match  opt_def_id { 
1491-             Some ( def_id)  => match  self . tcx . hir_get_if_local ( def_id)  { 
1492-                 Some ( hir:: Node :: Item ( hir:: Item  { 
1493-                     kind :  hir:: ItemKind :: Const ( _,  _,  _,  body_id) , 
1494-                     ..
1495-                 } ) )  => match  self . tcx . hir_node ( body_id. hir_id )  { 
1496-                     hir:: Node :: Expr ( expr)  => { 
1497-                         if  hir:: is_range_literal ( expr)  { 
1498-                             let  span = self . tcx . hir_span ( body_id. hir_id ) ; 
1499-                             if  let  Ok ( snip)  = self . tcx . sess . source_map ( ) . span_to_snippet ( span)  { 
1500-                                 e. span_suggestion_verbose ( 
1501-                                     ident. span , 
1502-                                     "you may want to move the range into the match block" , 
1503-                                     snip, 
1504-                                     Applicability :: MachineApplicable , 
1505-                                 ) ; 
1506-                                 return  true ; 
1507-                             } 
1508-                         } 
1509-                     } 
1510-                     _ => ( ) , 
1511-                 } , 
1512-                 _ => ( ) , 
1513-             } , 
1514-             _ => ( ) , 
1491+         if  let  Some ( def_id)  = opt_def_id
1492+             && let  Some ( hir:: Node :: Item ( hir:: Item  { 
1493+                 kind :  hir:: ItemKind :: Const ( _,  _,  _,  body_id) , 
1494+                 ..
1495+             } ) )  = self . tcx . hir_get_if_local ( def_id) 
1496+             && let  hir:: Node :: Expr ( expr)  = self . tcx . hir_node ( body_id. hir_id ) 
1497+             && hir:: is_range_literal ( expr) 
1498+         { 
1499+             let  span = self . tcx . hir_span ( body_id. hir_id ) ; 
1500+             if  let  Ok ( snip)  = self . tcx . sess . source_map ( ) . span_to_snippet ( span)  { 
1501+                 e. span_suggestion_verbose ( 
1502+                     ident. span , 
1503+                     "you may want to move the range into the match block" , 
1504+                     snip, 
1505+                     Applicability :: MachineApplicable , 
1506+                 ) ; 
1507+                 return  true ; 
1508+             } 
15151509        } 
15161510        false 
15171511    } 
@@ -1529,7 +1523,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
15291523
15301524        if  let  Some ( span)  = self . tcx . hir_res_span ( pat_res)  { 
15311525            e. span_label ( span,  format ! ( "{} defined here" ,  res. descr( ) ) ) ; 
1532-             if  let  [ hir:: PathSegment  {  ident,  .. } ]  = & * segments { 
1526+             if  let  [ hir:: PathSegment  {  ident,  .. } ]  = segments { 
15331527                e. span_label ( 
15341528                    pat_span, 
15351529                    format ! ( 
@@ -1557,17 +1551,17 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
15571551                            _ => ( None ,  None ) , 
15581552                        } ; 
15591553
1560-                         let  is_range = match  type_def_id. and_then ( |id| self . tcx . as_lang_item ( id) )  { 
1554+                         let  is_range = matches ! ( 
1555+                             type_def_id. and_then( |id| self . tcx. as_lang_item( id) ) , 
15611556                            Some ( 
15621557                                LangItem :: Range 
1563-                                 | LangItem :: RangeFrom 
1564-                                 | LangItem :: RangeTo 
1565-                                 | LangItem :: RangeFull 
1566-                                 | LangItem :: RangeInclusiveStruct 
1567-                                 | LangItem :: RangeToInclusive , 
1568-                             )  => true , 
1569-                             _ => false , 
1570-                         } ; 
1558+                                     | LangItem :: RangeFrom 
1559+                                     | LangItem :: RangeTo 
1560+                                     | LangItem :: RangeFull 
1561+                                     | LangItem :: RangeInclusiveStruct 
1562+                                     | LangItem :: RangeToInclusive , 
1563+                             ) 
1564+                         ) ; 
15711565                        if  is_range { 
15721566                            if  !self . maybe_suggest_range_literal ( & mut  e,  item_def_id,  * ident)  { 
15731567                                let  msg = "constants only support matching by type, \  
0 commit comments