@@ -261,15 +261,12 @@ pub(crate) fn format_expr(
261261 }
262262
263263 fn needs_space_after_range ( rhs : & ast:: Expr ) -> bool {
264- match rhs. kind {
265- // Don't format `.. ..` into `....`, which is invalid.
266- //
267- // This check is unnecessary for `lhs`, because a range
268- // starting from another range needs parentheses as `(x ..) ..`
269- // (`x .. ..` is a range from `x` to `..`).
270- ast:: ExprKind :: Range ( None , _, _) => true ,
271- _ => false ,
272- }
264+ // Don't format `.. ..` into `....`, which is invalid.
265+ //
266+ // This check is unnecessary for `lhs`, because a range
267+ // starting from another range needs parentheses as `(x ..) ..`
268+ // (`x .. ..` is a range from `x` to `..`).
269+ matches ! ( rhs. kind, ast:: ExprKind :: Range ( None , _, _) )
273270 }
274271
275272 let default_sp_delim = |lhs : Option < & ast:: Expr > , rhs : Option < & ast:: Expr > | {
@@ -529,7 +526,7 @@ pub(crate) fn rewrite_block_with_visitor(
529526
530527 let inner_attrs = attrs. map ( inner_attributes) ;
531528 let label_str = rewrite_label ( label) ;
532- visitor. visit_block ( block, inner_attrs. as_ref ( ) . map ( |a| & * * a ) , has_braces) ;
529+ visitor. visit_block ( block, inner_attrs. as_deref ( ) , has_braces) ;
533530 let visitor_context = visitor. get_context ( ) ;
534531 context
535532 . skipped_range
@@ -593,7 +590,7 @@ pub(crate) fn rewrite_cond(
593590 String :: from ( "\n " ) + & shape. indent . block_only ( ) . to_string ( context. config ) ;
594591 control_flow
595592 . rewrite_cond ( context, shape, & alt_block_sep)
596- . and_then ( |rw| Some ( rw. 0 ) )
593+ . map ( |rw| rw. 0 )
597594 } ) ,
598595 }
599596}
@@ -1155,18 +1152,11 @@ pub(crate) fn is_empty_block(
11551152}
11561153
11571154pub ( crate ) fn stmt_is_expr ( stmt : & ast:: Stmt ) -> bool {
1158- match stmt. kind {
1159- ast:: StmtKind :: Expr ( ..) => true ,
1160- _ => false ,
1161- }
1155+ matches ! ( stmt. kind, ast:: StmtKind :: Expr ( ..) )
11621156}
11631157
11641158pub ( crate ) fn is_unsafe_block ( block : & ast:: Block ) -> bool {
1165- if let ast:: BlockCheckMode :: Unsafe ( ..) = block. rules {
1166- true
1167- } else {
1168- false
1169- }
1159+ matches ! ( block. rules, ast:: BlockCheckMode :: Unsafe ( ..) )
11701160}
11711161
11721162pub ( crate ) fn rewrite_literal (
0 commit comments