@@ -64,7 +64,7 @@ impl<'tcx> LateLintPass<'tcx> for CheckedConversions {
64
64
65
65
let result = if_chain ! {
66
66
if !in_external_macro( cx. sess( ) , item. span) ;
67
- if let ExprKind :: Binary ( op, ref left, ref right) = & item. kind;
67
+ if let ExprKind :: Binary ( op, left, right) = & item. kind;
68
68
69
69
then {
70
70
match op. node {
@@ -200,7 +200,7 @@ impl ConversionType {
200
200
/// Check for `expr <= (to_type::MAX as from_type)`
201
201
fn check_upper_bound < ' tcx > ( expr : & ' tcx Expr < ' tcx > ) -> Option < Conversion < ' tcx > > {
202
202
if_chain ! {
203
- if let ExprKind :: Binary ( ref op, ref left, ref right) = & expr. kind;
203
+ if let ExprKind :: Binary ( ref op, left, right) = & expr. kind;
204
204
if let Some ( ( candidate, check) ) = normalize_le_ge( op, left, right) ;
205
205
if let Some ( ( from, to) ) = get_types_from_cast( check, INTS , "max_value" , "MAX" ) ;
206
206
@@ -219,7 +219,7 @@ fn check_lower_bound<'tcx>(expr: &'tcx Expr<'tcx>) -> Option<Conversion<'tcx>> {
219
219
}
220
220
221
221
// First of we need a binary containing the expression & the cast
222
- if let ExprKind :: Binary ( ref op, ref left, ref right) = & expr. kind {
222
+ if let ExprKind :: Binary ( ref op, left, right) = & expr. kind {
223
223
normalize_le_ge ( op, right, left) . and_then ( |( l, r) | check_function ( l, r) )
224
224
} else {
225
225
None
@@ -260,7 +260,7 @@ fn get_types_from_cast<'a>(
260
260
// or `to_type::MAX as from_type`
261
261
let call_from_cast: Option < ( & Expr < ' _ > , & str ) > = if_chain ! {
262
262
// to_type::max_value(), from_type
263
- if let ExprKind :: Cast ( ref limit, ref from_type) = & expr. kind;
263
+ if let ExprKind :: Cast ( limit, from_type) = & expr. kind;
264
264
if let TyKind :: Path ( ref from_type_path) = & from_type. kind;
265
265
if let Some ( from_sym) = int_ty_to_sym( from_type_path) ;
266
266
@@ -275,7 +275,7 @@ fn get_types_from_cast<'a>(
275
275
let limit_from: Option < ( & Expr < ' _ > , & str ) > = call_from_cast. or_else ( || {
276
276
if_chain ! {
277
277
// `from_type::from, to_type::max_value()`
278
- if let ExprKind :: Call ( ref from_func, ref args) = & expr. kind;
278
+ if let ExprKind :: Call ( from_func, args) = & expr. kind;
279
279
// `to_type::max_value()`
280
280
if args. len( ) == 1 ;
281
281
if let limit = & args[ 0 ] ;
@@ -317,9 +317,9 @@ fn get_types_from_cast<'a>(
317
317
/// Gets the type which implements the called function
318
318
fn get_implementing_type < ' a > ( path : & QPath < ' _ > , candidates : & ' a [ & str ] , function : & str ) -> Option < & ' a str > {
319
319
if_chain ! {
320
- if let QPath :: TypeRelative ( ref ty, ref path) = & path;
320
+ if let QPath :: TypeRelative ( ty, path) = & path;
321
321
if path. ident. name. as_str( ) == function;
322
- if let TyKind :: Path ( QPath :: Resolved ( None , ref tp) ) = & ty. kind;
322
+ if let TyKind :: Path ( QPath :: Resolved ( None , tp) ) = & ty. kind;
323
323
if let [ int] = & * tp. segments;
324
324
then {
325
325
let name = & int. ident. name. as_str( ) ;
@@ -333,7 +333,7 @@ fn get_implementing_type<'a>(path: &QPath<'_>, candidates: &'a [&str], function:
333
333
/// Gets the type as a string, if it is a supported integer
334
334
fn int_ty_to_sym < ' tcx > ( path : & QPath < ' _ > ) -> Option < & ' tcx str > {
335
335
if_chain ! {
336
- if let QPath :: Resolved ( _, ref path) = * path;
336
+ if let QPath :: Resolved ( _, path) = * path;
337
337
if let [ ty] = & * path. segments;
338
338
then {
339
339
let name = & ty. ident. name. as_str( ) ;
0 commit comments