@@ -81,7 +81,7 @@ struct Hir2Qmm<'a, 'tcx, 'v> {
8181impl < ' a , ' tcx , ' v > Hir2Qmm < ' a , ' tcx , ' v > {
8282 fn extract ( & mut self , op : BinOpKind , a : & [ & ' v Expr ] , mut v : Vec < Bool > ) -> Result < Vec < Bool > , String > {
8383 for a in a {
84- if let ExprKind :: Binary ( binop, lhs, rhs) = & a. node {
84+ if let ExprKind :: Binary ( binop, lhs, rhs) = & a. kind {
8585 if binop. node == op {
8686 v = self . extract ( op, & [ lhs, rhs] , v) ?;
8787 continue ;
@@ -107,7 +107,7 @@ impl<'a, 'tcx, 'v> Hir2Qmm<'a, 'tcx, 'v> {
107107
108108 // prevent folding of `cfg!` macros and the like
109109 if !e. span . from_expansion ( ) {
110- match & e. node {
110+ match & e. kind {
111111 ExprKind :: Unary ( UnNot , inner) => return Ok ( Bool :: Not ( box self . run ( inner) ?) ) ,
112112 ExprKind :: Binary ( binop, lhs, rhs) => match & binop. node {
113113 BinOpKind :: Or => return Ok ( Bool :: Or ( self . extract ( BinOpKind :: Or , & [ lhs, rhs] , Vec :: new ( ) ) ?) ) ,
@@ -129,9 +129,9 @@ impl<'a, 'tcx, 'v> Hir2Qmm<'a, 'tcx, 'v> {
129129 }
130130
131131 if_chain ! {
132- if let ExprKind :: Binary ( e_binop, e_lhs, e_rhs) = & e. node ;
132+ if let ExprKind :: Binary ( e_binop, e_lhs, e_rhs) = & e. kind ;
133133 if implements_ord( self . cx, e_lhs) ;
134- if let ExprKind :: Binary ( expr_binop, expr_lhs, expr_rhs) = & expr. node ;
134+ if let ExprKind :: Binary ( expr_binop, expr_lhs, expr_rhs) = & expr. kind ;
135135 if negate( e_binop. node) == Some ( expr_binop. node) ;
136136 if SpanlessEq :: new( self . cx) . ignore_fn( ) . eq_expr( e_lhs, expr_lhs) ;
137137 if SpanlessEq :: new( self . cx) . ignore_fn( ) . eq_expr( e_rhs, expr_rhs) ;
@@ -156,7 +156,6 @@ struct SuggestContext<'a, 'tcx, 'v> {
156156 terminals : & ' v [ & ' v Expr ] ,
157157 cx : & ' a LateContext < ' a , ' tcx > ,
158158 output : String ,
159- simplified : bool ,
160159}
161160
162161impl < ' a , ' tcx , ' v > SuggestContext < ' a , ' tcx , ' v > {
@@ -179,7 +178,6 @@ impl<'a, 'tcx, 'v> SuggestContext<'a, 'tcx, 'v> {
179178 Term ( n) => {
180179 let terminal = self . terminals [ n as usize ] ;
181180 if let Some ( str) = simplify_not ( self . cx , terminal) {
182- self . simplified = true ;
183181 self . output . push_str ( & str)
184182 } else {
185183 self . output . push ( '!' ) ;
@@ -224,7 +222,7 @@ impl<'a, 'tcx, 'v> SuggestContext<'a, 'tcx, 'v> {
224222}
225223
226224fn simplify_not ( cx : & LateContext < ' _ , ' _ > , expr : & Expr ) -> Option < String > {
227- match & expr. node {
225+ match & expr. kind {
228226 ExprKind :: Binary ( binop, lhs, rhs) => {
229227 if !implements_ord ( cx, lhs) {
230228 return None ;
@@ -264,16 +262,14 @@ fn simplify_not(cx: &LateContext<'_, '_>, expr: &Expr) -> Option<String> {
264262 }
265263}
266264
267- // The boolean part of the return indicates whether some simplifications have been applied.
268- fn suggest ( cx : & LateContext < ' _ , ' _ > , suggestion : & Bool , terminals : & [ & Expr ] ) -> ( String , bool ) {
265+ fn suggest ( cx : & LateContext < ' _ , ' _ > , suggestion : & Bool , terminals : & [ & Expr ] ) -> String {
269266 let mut suggest_context = SuggestContext {
270267 terminals,
271268 cx,
272269 output : String :: new ( ) ,
273- simplified : false ,
274270 } ;
275271 suggest_context. recurse ( suggestion) ;
276- ( suggest_context. output , suggest_context . simplified )
272+ suggest_context. output
277273}
278274
279275fn simple_negate ( b : Bool ) -> Bool {
@@ -383,7 +379,7 @@ impl<'a, 'tcx> NonminimalBoolVisitor<'a, 'tcx> {
383379 db. span_suggestion (
384380 e. span ,
385381 "it would look like the following" ,
386- suggest ( self . cx , suggestion, & h2q. terminals ) . 0 ,
382+ suggest ( self . cx , suggestion, & h2q. terminals ) ,
387383 // nonminimal_bool can produce minimal but
388384 // not human readable expressions (#3141)
389385 Applicability :: Unspecified ,
@@ -428,7 +424,7 @@ impl<'a, 'tcx> NonminimalBoolVisitor<'a, 'tcx> {
428424 nonminimal_bool_lint (
429425 improvements
430426 . into_iter ( )
431- . map ( |suggestion| suggest ( self . cx , suggestion, & h2q. terminals ) . 0 )
427+ . map ( |suggestion| suggest ( self . cx , suggestion, & h2q. terminals ) )
432428 . collect ( ) ,
433429 ) ;
434430 }
@@ -441,7 +437,7 @@ impl<'a, 'tcx> Visitor<'tcx> for NonminimalBoolVisitor<'a, 'tcx> {
441437 if in_macro ( e. span ) {
442438 return ;
443439 }
444- match & e. node {
440+ match & e. kind {
445441 ExprKind :: Binary ( binop, _, _) if binop. node == BinOpKind :: Or || binop. node == BinOpKind :: And => {
446442 self . bool_expr ( e)
447443 } ,
@@ -471,7 +467,7 @@ struct NotSimplificationVisitor<'a, 'tcx> {
471467
472468impl < ' a , ' tcx > Visitor < ' tcx > for NotSimplificationVisitor < ' a , ' tcx > {
473469 fn visit_expr ( & mut self , expr : & ' tcx Expr ) {
474- if let ExprKind :: Unary ( UnNot , inner) = & expr. node {
470+ if let ExprKind :: Unary ( UnNot , inner) = & expr. kind {
475471 if let Some ( suggestion) = simplify_not ( self . cx , inner) {
476472 span_lint_and_sugg (
477473 self . cx ,
0 commit comments