@@ -10,7 +10,7 @@ use rustc_ast::{LitKind, RangeLimits};
1010use rustc_data_structures:: packed:: Pu128 ;
1111use rustc_data_structures:: unhash:: UnindexMap ;
1212use rustc_errors:: { Applicability , Diag } ;
13- use rustc_hir:: { BinOp , Block , Body , Expr , ExprKind , UnOp } ;
13+ use rustc_hir:: { BinOpKind , Block , Body , Expr , ExprKind , UnOp } ;
1414use rustc_lint:: { LateContext , LateLintPass } ;
1515use rustc_session:: declare_lint_pass;
1616use rustc_span:: source_map:: Spanned ;
@@ -97,7 +97,7 @@ enum LengthComparison {
9797///
9898/// E.g. for `v.len() > 5` this returns `Some((LengthComparison::IntLessThanLength, 5, v.len()))`
9999fn len_comparison < ' hir > (
100- bin_op : BinOp ,
100+ bin_op : BinOpKind ,
101101 left : & ' hir Expr < ' hir > ,
102102 right : & ' hir Expr < ' hir > ,
103103) -> Option < ( LengthComparison , usize , & ' hir Expr < ' hir > ) > {
@@ -112,7 +112,7 @@ fn len_comparison<'hir>(
112112
113113 // normalize comparison, `v.len() > 4` becomes `4 < v.len()`
114114 // this simplifies the logic a bit
115- let ( op, left, right) = normalize_comparison ( bin_op. node , left, right) ?;
115+ let ( op, left, right) = normalize_comparison ( bin_op, left, right) ?;
116116 match ( op, left. kind , right. kind ) {
117117 ( Rel :: Lt , int_lit_pat ! ( left) , _) => Some ( ( LengthComparison :: IntLessThanLength , left as usize , right) ) ,
118118 ( Rel :: Lt , _, int_lit_pat ! ( right) ) => Some ( ( LengthComparison :: LengthLessThanInt , right as usize , left) ) ,
@@ -138,7 +138,7 @@ fn assert_len_expr<'hir>(
138138 && let ExprKind :: Unary ( UnOp :: Not , condition) = & cond. kind
139139 && let ExprKind :: Binary ( bin_op, left, right) = & condition. kind
140140
141- && let Some ( ( cmp, asserted_len, slice_len) ) = len_comparison ( * bin_op, left, right)
141+ && let Some ( ( cmp, asserted_len, slice_len) ) = len_comparison ( bin_op. node , left, right)
142142 && let ExprKind :: MethodCall ( method, recv, [ ] , _) = & slice_len. kind
143143 && cx. typeck_results ( ) . expr_ty_adjusted ( recv) . peel_refs ( ) . is_slice ( )
144144 && method. ident . name == sym:: len
0 commit comments