@@ -263,15 +263,12 @@ pub(crate) fn format_expr(
263263 }
264264
265265 fn needs_space_after_range ( rhs : & ast:: Expr ) -> bool {
266- match rhs. kind {
267- // Don't format `.. ..` into `....`, which is invalid.
268- //
269- // This check is unnecessary for `lhs`, because a range
270- // starting from another range needs parentheses as `(x ..) ..`
271- // (`x .. ..` is a range from `x` to `..`).
272- ast:: ExprKind :: Range ( None , _, _) => true ,
273- _ => false ,
274- }
266+ // Don't format `.. ..` into `....`, which is invalid.
267+ //
268+ // This check is unnecessary for `lhs`, because a range
269+ // starting from another range needs parentheses as `(x ..) ..`
270+ // (`x .. ..` is a range from `x` to `..`).
271+ matches ! ( rhs. kind, ast:: ExprKind :: Range ( None , _, _) )
275272 }
276273
277274 let default_sp_delim = |lhs : Option < & ast:: Expr > , rhs : Option < & ast:: Expr > | {
@@ -531,7 +528,7 @@ pub(crate) fn rewrite_block_with_visitor(
531528
532529 let inner_attrs = attrs. map ( inner_attributes) ;
533530 let label_str = rewrite_label ( label) ;
534- visitor. visit_block ( block, inner_attrs. as_ref ( ) . map ( |a| & * * a ) , has_braces) ;
531+ visitor. visit_block ( block, inner_attrs. as_deref ( ) , has_braces) ;
535532 let visitor_context = visitor. get_context ( ) ;
536533 context
537534 . skipped_range
@@ -595,7 +592,7 @@ pub(crate) fn rewrite_cond(
595592 String :: from ( "\n " ) + & shape. indent . block_only ( ) . to_string ( context. config ) ;
596593 control_flow
597594 . rewrite_cond ( context, shape, & alt_block_sep)
598- . and_then ( |rw| Some ( rw. 0 ) )
595+ . map ( |rw| rw. 0 )
599596 } ) ,
600597 }
601598}
@@ -1157,18 +1154,11 @@ pub(crate) fn is_empty_block(
11571154}
11581155
11591156pub ( crate ) fn stmt_is_expr ( stmt : & ast:: Stmt ) -> bool {
1160- match stmt. kind {
1161- ast:: StmtKind :: Expr ( ..) => true ,
1162- _ => false ,
1163- }
1157+ matches ! ( stmt. kind, ast:: StmtKind :: Expr ( ..) )
11641158}
11651159
11661160pub ( crate ) fn is_unsafe_block ( block : & ast:: Block ) -> bool {
1167- if let ast:: BlockCheckMode :: Unsafe ( ..) = block. rules {
1168- true
1169- } else {
1170- false
1171- }
1161+ matches ! ( block. rules, ast:: BlockCheckMode :: Unsafe ( ..) )
11721162}
11731163
11741164pub ( crate ) fn rewrite_literal (
0 commit comments