@@ -65,7 +65,7 @@ pub(crate) fn format_expr(
65
65
shape
66
66
} ;
67
67
68
- let expr_rw = match expr. node {
68
+ let expr_rw = match expr. kind {
69
69
ast:: ExprKind :: Array ( ref expr_vec) => rewrite_array (
70
70
"" ,
71
71
expr_vec. iter ( ) ,
@@ -250,8 +250,8 @@ pub(crate) fn format_expr(
250
250
} ;
251
251
252
252
fn needs_space_before_range ( context : & RewriteContext < ' _ > , lhs : & ast:: Expr ) -> bool {
253
- match lhs. node {
254
- ast:: ExprKind :: Lit ( ref lit) => match lit. node {
253
+ match lhs. kind {
254
+ ast:: ExprKind :: Lit ( ref lit) => match lit. kind {
255
255
ast:: LitKind :: FloatUnsuffixed ( ..) => {
256
256
context. snippet ( lit. span ) . ends_with ( '.' )
257
257
}
@@ -262,7 +262,7 @@ pub(crate) fn format_expr(
262
262
}
263
263
264
264
fn needs_space_after_range ( rhs : & ast:: Expr ) -> bool {
265
- match rhs. node {
265
+ match rhs. kind {
266
266
// Don't format `.. ..` into `....`, which is invalid.
267
267
//
268
268
// This check is unnecessary for `lhs`, because a range
@@ -575,7 +575,7 @@ pub(crate) fn rewrite_cond(
575
575
expr : & ast:: Expr ,
576
576
shape : Shape ,
577
577
) -> Option < String > {
578
- match expr. node {
578
+ match expr. kind {
579
579
ast:: ExprKind :: Match ( ref cond, _) => {
580
580
// `match `cond` {`
581
581
let cond_shape = match context. config . indent_style ( ) {
@@ -612,15 +612,15 @@ struct ControlFlow<'a> {
612
612
}
613
613
614
614
fn extract_pats_and_cond ( expr : & ast:: Expr ) -> ( Option < & ast:: Pat > , & ast:: Expr ) {
615
- match expr. node {
615
+ match expr. kind {
616
616
ast:: ExprKind :: Let ( ref pat, ref cond) => ( Some ( pat) , cond) ,
617
617
_ => ( None , expr) ,
618
618
}
619
619
}
620
620
621
621
// FIXME: Refactor this.
622
622
fn to_control_flow ( expr : & ast:: Expr , expr_type : ExprType ) -> Option < ControlFlow < ' _ > > {
623
- match expr. node {
623
+ match expr. kind {
624
624
ast:: ExprKind :: If ( ref cond, ref if_block, ref else_block) => {
625
625
let ( pat, cond) = extract_pats_and_cond ( cond) ;
626
626
Some ( ControlFlow :: new_if (
@@ -748,7 +748,7 @@ impl<'a> ControlFlow<'a> {
748
748
let else_block = self . else_block ?;
749
749
let fixed_cost = self . keyword . len ( ) + " { } else { }" . len ( ) ;
750
750
751
- if let ast:: ExprKind :: Block ( ref else_node, _) = else_block. node {
751
+ if let ast:: ExprKind :: Block ( ref else_node, _) = else_block. kind {
752
752
if !is_simple_block ( self . block , None , context. source_map )
753
753
|| !is_simple_block ( else_node, None , context. source_map )
754
754
|| pat_expr_str. contains ( '\n' )
@@ -1014,7 +1014,7 @@ impl<'a> Rewrite for ControlFlow<'a> {
1014
1014
if let Some ( else_block) = self . else_block {
1015
1015
let shape = Shape :: indented ( shape. indent , context. config ) ;
1016
1016
let mut last_in_chain = false ;
1017
- let rewrite = match else_block. node {
1017
+ let rewrite = match else_block. kind {
1018
1018
// If the else expression is another if-else expression, prevent it
1019
1019
// from being formatted on a single line.
1020
1020
// Note how we're passing the original shape, as the
@@ -1149,7 +1149,7 @@ pub(crate) fn is_empty_block(
1149
1149
}
1150
1150
1151
1151
pub ( crate ) fn stmt_is_expr ( stmt : & ast:: Stmt ) -> bool {
1152
- match stmt. node {
1152
+ match stmt. kind {
1153
1153
ast:: StmtKind :: Expr ( ..) => true ,
1154
1154
_ => false ,
1155
1155
}
@@ -1168,7 +1168,7 @@ pub(crate) fn rewrite_literal(
1168
1168
l : & ast:: Lit ,
1169
1169
shape : Shape ,
1170
1170
) -> Option < String > {
1171
- match l. node {
1171
+ match l. kind {
1172
1172
ast:: LitKind :: Str ( _, ast:: StrStyle :: Cooked ) => rewrite_string_lit ( context, l. span , shape) ,
1173
1173
_ => wrap_str (
1174
1174
context. snippet ( l. span ) . to_owned ( ) ,
@@ -1253,7 +1253,7 @@ pub(crate) fn rewrite_call(
1253
1253
}
1254
1254
1255
1255
pub ( crate ) fn is_simple_expr ( expr : & ast:: Expr ) -> bool {
1256
- match expr. node {
1256
+ match expr. kind {
1257
1257
ast:: ExprKind :: Lit ( ..) => true ,
1258
1258
ast:: ExprKind :: Path ( ref qself, ref path) => qself. is_none ( ) && path. segments . len ( ) <= 1 ,
1259
1259
ast:: ExprKind :: AddrOf ( _, ref expr)
@@ -1279,7 +1279,7 @@ pub(crate) fn can_be_overflowed_expr(
1279
1279
expr : & ast:: Expr ,
1280
1280
args_len : usize ,
1281
1281
) -> bool {
1282
- match expr. node {
1282
+ match expr. kind {
1283
1283
_ if !expr. attrs . is_empty ( ) => false ,
1284
1284
ast:: ExprKind :: Match ( ..) => {
1285
1285
( context. use_block_indent ( ) && args_len == 1 )
@@ -1324,7 +1324,7 @@ pub(crate) fn can_be_overflowed_expr(
1324
1324
}
1325
1325
1326
1326
pub ( crate ) fn is_nested_call ( expr : & ast:: Expr ) -> bool {
1327
- match expr. node {
1327
+ match expr. kind {
1328
1328
ast:: ExprKind :: Call ( ..) | ast:: ExprKind :: Mac ( ..) => true ,
1329
1329
ast:: ExprKind :: AddrOf ( _, ref expr)
1330
1330
| ast:: ExprKind :: Box ( ref expr)
@@ -1380,7 +1380,7 @@ fn rewrite_paren(
1380
1380
post_comment = rewrite_missing_comment ( post_span, shape, context) ?;
1381
1381
1382
1382
// Remove nested parens if there are no comments.
1383
- if let ast:: ExprKind :: Paren ( ref subsubexpr) = subexpr. node {
1383
+ if let ast:: ExprKind :: Paren ( ref subsubexpr) = subexpr. kind {
1384
1384
if remove_nested_parens && pre_comment. is_empty ( ) && post_comment. is_empty ( ) {
1385
1385
span = subexpr. span ;
1386
1386
subexpr = subsubexpr;
@@ -1985,7 +1985,7 @@ fn rewrite_expr_addrof(
1985
1985
}
1986
1986
1987
1987
pub ( crate ) fn is_method_call ( expr : & ast:: Expr ) -> bool {
1988
- match expr. node {
1988
+ match expr. kind {
1989
1989
ast:: ExprKind :: MethodCall ( ..) => true ,
1990
1990
ast:: ExprKind :: AddrOf ( _, ref expr)
1991
1991
| ast:: ExprKind :: Box ( ref expr)
0 commit comments