@@ -44,7 +44,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for CheckedConversions {
44
44
fn check_expr ( & mut self , cx : & LateContext < ' _ , ' _ > , item : & Expr ) {
45
45
let result = if_chain ! {
46
46
if !in_external_macro( cx. sess( ) , item. span) ;
47
- if let ExprKind :: Binary ( op, ref left, ref right) = & item. node ;
47
+ if let ExprKind :: Binary ( op, ref left, ref right) = & item. kind ;
48
48
49
49
then {
50
50
match op. node {
@@ -180,7 +180,7 @@ impl ConversionType {
180
180
/// Check for `expr <= (to_type::max_value() as from_type)`
181
181
fn check_upper_bound ( expr : & Expr ) -> Option < Conversion < ' _ > > {
182
182
if_chain ! {
183
- if let ExprKind :: Binary ( ref op, ref left, ref right) = & expr. node ;
183
+ if let ExprKind :: Binary ( ref op, ref left, ref right) = & expr. kind ;
184
184
if let Some ( ( candidate, check) ) = normalize_le_ge( op, left, right) ;
185
185
if let Some ( ( from, to) ) = get_types_from_cast( check, MAX_VALUE , INTS ) ;
186
186
@@ -199,7 +199,7 @@ fn check_lower_bound(expr: &Expr) -> Option<Conversion<'_>> {
199
199
}
200
200
201
201
// First of we need a binary containing the expression & the cast
202
- if let ExprKind :: Binary ( ref op, ref left, ref right) = & expr. node {
202
+ if let ExprKind :: Binary ( ref op, ref left, ref right) = & expr. kind {
203
203
normalize_le_ge ( op, right, left) . and_then ( |( l, r) | check_function ( l, r) )
204
204
} else {
205
205
None
@@ -209,7 +209,7 @@ fn check_lower_bound(expr: &Expr) -> Option<Conversion<'_>> {
209
209
/// Check for `expr >= 0`
210
210
fn check_lower_bound_zero < ' a > ( candidate : & ' a Expr , check : & ' a Expr ) -> Option < Conversion < ' a > > {
211
211
if_chain ! {
212
- if let ExprKind :: Lit ( ref lit) = & check. node ;
212
+ if let ExprKind :: Lit ( ref lit) = & check. kind ;
213
213
if let LitKind :: Int ( 0 , _) = & lit. node;
214
214
215
215
then {
@@ -234,8 +234,8 @@ fn get_types_from_cast<'a>(expr: &'a Expr, func: &'a str, types: &'a [&str]) ->
234
234
// `to_type::maxmin_value() as from_type`
235
235
let call_from_cast: Option < ( & Expr , & str ) > = if_chain ! {
236
236
// to_type::maxmin_value(), from_type
237
- if let ExprKind :: Cast ( ref limit, ref from_type) = & expr. node ;
238
- if let TyKind :: Path ( ref from_type_path) = & from_type. node ;
237
+ if let ExprKind :: Cast ( ref limit, ref from_type) = & expr. kind ;
238
+ if let TyKind :: Path ( ref from_type_path) = & from_type. kind ;
239
239
if let Some ( from_sym) = int_ty_to_sym( from_type_path) ;
240
240
241
241
then {
@@ -249,12 +249,12 @@ fn get_types_from_cast<'a>(expr: &'a Expr, func: &'a str, types: &'a [&str]) ->
249
249
let limit_from: Option < ( & Expr , & str ) > = call_from_cast. or_else ( || {
250
250
if_chain ! {
251
251
// `from_type::from, to_type::maxmin_value()`
252
- if let ExprKind :: Call ( ref from_func, ref args) = & expr. node ;
252
+ if let ExprKind :: Call ( ref from_func, ref args) = & expr. kind ;
253
253
// `to_type::maxmin_value()`
254
254
if args. len( ) == 1 ;
255
255
if let limit = & args[ 0 ] ;
256
256
// `from_type::from`
257
- if let ExprKind :: Path ( ref path) = & from_func. node ;
257
+ if let ExprKind :: Path ( ref path) = & from_func. kind ;
258
258
if let Some ( from_sym) = get_implementing_type( path, INTS , FROM ) ;
259
259
260
260
then {
@@ -267,9 +267,9 @@ fn get_types_from_cast<'a>(expr: &'a Expr, func: &'a str, types: &'a [&str]) ->
267
267
268
268
if let Some ( ( limit, from_type) ) = limit_from {
269
269
if_chain ! {
270
- if let ExprKind :: Call ( ref fun_name, _) = & limit. node ;
270
+ if let ExprKind :: Call ( ref fun_name, _) = & limit. kind ;
271
271
// `to_type, maxmin_value`
272
- if let ExprKind :: Path ( ref path) = & fun_name. node ;
272
+ if let ExprKind :: Path ( ref path) = & fun_name. kind ;
273
273
// `to_type`
274
274
if let Some ( to_type) = get_implementing_type( path, types, func) ;
275
275
@@ -289,7 +289,7 @@ fn get_implementing_type<'a>(path: &QPath, candidates: &'a [&str], function: &st
289
289
if_chain ! {
290
290
if let QPath :: TypeRelative ( ref ty, ref path) = & path;
291
291
if path. ident. name. as_str( ) == function;
292
- if let TyKind :: Path ( QPath :: Resolved ( None , ref tp) ) = & ty. node ;
292
+ if let TyKind :: Path ( QPath :: Resolved ( None , ref tp) ) = & ty. kind ;
293
293
if let [ int] = & * tp. segments;
294
294
let name = & int. ident. name. as_str( ) ;
295
295
0 commit comments