File tree Expand file tree Collapse file tree 4 files changed +10
-16
lines changed
src/tools/rust-analyzer/crates Expand file tree Collapse file tree 4 files changed +10
-16
lines changed Original file line number Diff line number Diff line change @@ -1802,10 +1802,10 @@ impl ExprCollector<'_> {
18021802 if ident. is_simple_ident ( ) {
18031803 return ident
18041804 . name ( )
1805- . and_then ( |name| Some ( name. as_name ( ) ) )
1806- . and_then ( |hir_name| Some ( Path :: from ( hir_name ) ) )
1807- . and_then ( |path| {
1808- Some ( self . alloc_expr_from_pat ( Expr :: Path ( path) , ptr) )
1805+ . map ( |name| name. as_name ( ) )
1806+ . map ( Path :: from)
1807+ . map ( |path| {
1808+ self . alloc_expr_from_pat ( Expr :: Path ( path) , ptr)
18091809 } ) ;
18101810 }
18111811
Original file line number Diff line number Diff line change @@ -56,10 +56,7 @@ impl ExprOrPatId {
5656 }
5757
5858 pub fn is_expr ( & self ) -> bool {
59- match self {
60- Self :: ExprId ( _) => true ,
61- _ => false ,
62- }
59+ matches ! ( self , Self :: ExprId ( _) )
6360 }
6461
6562 pub fn as_pat ( self ) -> Option < PatId > {
@@ -70,10 +67,7 @@ impl ExprOrPatId {
7067 }
7168
7269 pub fn is_pat ( & self ) -> bool {
73- match self {
74- Self :: PatId ( _) => true ,
75- _ => false ,
76- }
70+ matches ! ( self , Self :: PatId ( _) )
7771 }
7872}
7973stdx:: impl_from!( ExprId , PatId for ExprOrPatId ) ;
Original file line number Diff line number Diff line change @@ -1359,7 +1359,7 @@ impl<'ctx> MirLowerCtx<'ctx> {
13591359 }
13601360
13611361 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] {
13631363 Expr :: Literal ( l) => self . lower_literal_to_operand ( ty, l) ,
13641364 Expr :: Path ( c) => {
13651365 let edition = self . edition ( ) ;
@@ -1369,7 +1369,7 @@ impl<'ctx> MirLowerCtx<'ctx> {
13691369 . resolver
13701370 . resolve_path_in_value_ns ( self . db . upcast ( ) , c, HygieneId :: ROOT )
13711371 . ok_or_else ( unresolved_name) ?;
1372- dbg ! ( match dbg! ( pr ) {
1372+ match pr {
13731373 ResolveValueResult :: ValueNs ( v, _) => {
13741374 if let ValueNs :: ConstId ( c) = v {
13751375 self . lower_const_to_operand ( Substitution :: empty ( Interner ) , c. into ( ) , ty)
@@ -1380,7 +1380,7 @@ impl<'ctx> MirLowerCtx<'ctx> {
13801380 ResolveValueResult :: Partial ( _, _, _) => {
13811381 not_supported ! ( "associated constants in range pattern" )
13821382 }
1383- } )
1383+ }
13841384 }
13851385 _ => {
13861386 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<'_, '_> {
347347 & mut self ,
348348 src : InFile < & ast:: IdentPat > ,
349349 ) -> 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 ( ) ) ?;
351351 let ( body, source_map) = self . db . body_with_source_map ( container) ;
352352 let src = src. cloned ( ) . map ( ast:: Pat :: from) ;
353353 let pat_id = source_map. node_pat ( src. as_ref ( ) ) ?;
You can’t perform that action at this time.
0 commit comments