File tree 4 files changed +10
-16
lines changed 4 files changed +10
-16
lines changed Original file line number Diff line number Diff line change @@ -1734,10 +1734,10 @@ impl ExprCollector<'_> {
1734
1734
if ident. is_simple_ident ( ) {
1735
1735
return ident
1736
1736
. name ( )
1737
- . and_then ( |name| Some ( name. as_name ( ) ) )
1738
- . and_then ( |hir_name| Some ( Path :: from ( hir_name ) ) )
1739
- . and_then ( |path| {
1740
- Some ( self . alloc_expr_from_pat ( Expr :: Path ( path) , ptr) )
1737
+ . map ( |name| name. as_name ( ) )
1738
+ . map ( Path :: from)
1739
+ . map ( |path| {
1740
+ self . alloc_expr_from_pat ( Expr :: Path ( path) , ptr)
1741
1741
} ) ;
1742
1742
}
1743
1743
Original file line number Diff line number Diff line change @@ -59,10 +59,7 @@ impl ExprOrPatId {
59
59
}
60
60
61
61
pub fn is_expr ( & self ) -> bool {
62
- match self {
63
- Self :: ExprId ( _) => true ,
64
- _ => false ,
65
- }
62
+ matches ! ( self , Self :: ExprId ( _) )
66
63
}
67
64
68
65
pub fn as_pat ( self ) -> Option < PatId > {
@@ -73,10 +70,7 @@ impl ExprOrPatId {
73
70
}
74
71
75
72
pub fn is_pat ( & self ) -> bool {
76
- match self {
77
- Self :: PatId ( _) => true ,
78
- _ => false ,
79
- }
73
+ matches ! ( self , Self :: PatId ( _) )
80
74
}
81
75
}
82
76
stdx:: impl_from!( ExprId , PatId for ExprOrPatId ) ;
Original file line number Diff line number Diff line change @@ -1359,7 +1359,7 @@ impl<'ctx> MirLowerCtx<'ctx> {
1359
1359
}
1360
1360
1361
1361
fn lower_literal_or_const_to_operand ( & mut self , ty : Ty , loc : & ExprId ) -> Result < Operand > {
1362
- match dbg ! ( & self . body. exprs[ * loc] ) {
1362
+ match & self . body . exprs [ * loc] {
1363
1363
Expr :: Literal ( l) => self . lower_literal_to_operand ( ty, l) ,
1364
1364
Expr :: Path ( c) => {
1365
1365
let edition = self . edition ( ) ;
@@ -1369,7 +1369,7 @@ impl<'ctx> MirLowerCtx<'ctx> {
1369
1369
. resolver
1370
1370
. resolve_path_in_value_ns ( self . db . upcast ( ) , c, HygieneId :: ROOT )
1371
1371
. ok_or_else ( unresolved_name) ?;
1372
- dbg ! ( match dbg! ( pr ) {
1372
+ match pr {
1373
1373
ResolveValueResult :: ValueNs ( v, _) => {
1374
1374
if let ValueNs :: ConstId ( c) = v {
1375
1375
self . lower_const_to_operand ( Substitution :: empty ( Interner ) , c. into ( ) , ty)
@@ -1380,7 +1380,7 @@ impl<'ctx> MirLowerCtx<'ctx> {
1380
1380
ResolveValueResult :: Partial ( _, _, _) => {
1381
1381
not_supported ! ( "associated constants in range pattern" )
1382
1382
}
1383
- } )
1383
+ }
1384
1384
}
1385
1385
_ => {
1386
1386
not_supported ! ( "only `char` and numeric types are allowed in range patterns" ) ;
Original file line number Diff line number Diff line change @@ -347,7 +347,7 @@ impl SourceToDefCtx<'_, '_> {
347
347
& mut self ,
348
348
src : InFile < & ast:: IdentPat > ,
349
349
) -> Option < ( DefWithBodyId , BindingId ) > {
350
- let container = dbg ! ( self . find_pat_or_label_container( src. syntax_ref( ) ) ) ?;
350
+ let container = self . find_pat_or_label_container ( src. syntax_ref ( ) ) ?;
351
351
let ( body, source_map) = self . db . body_with_source_map ( container) ;
352
352
let src = src. cloned ( ) . map ( ast:: Pat :: from) ;
353
353
let pat_id = source_map. node_pat ( src. as_ref ( ) ) ?;
You can’t perform that action at this time.
0 commit comments