@@ -362,22 +362,22 @@ fn detect_hypot(cx: &LateContext<'_>, args: &[Expr<'_>]) -> Option<String> {
362
362
if_chain ! {
363
363
if let ExprKind :: MethodCall (
364
364
PathSegment { ident: lmethod_name, .. } ,
365
- ref _lspan,
366
- largs ,
365
+ _lspan,
366
+ [ largs_0 , largs_1 , .. ] ,
367
367
_
368
- ) = add_lhs. kind;
368
+ ) = & add_lhs. kind;
369
369
if let ExprKind :: MethodCall (
370
370
PathSegment { ident: rmethod_name, .. } ,
371
- ref _rspan,
372
- rargs ,
371
+ _rspan,
372
+ [ rargs_0 , rargs_1 , .. ] ,
373
373
_
374
- ) = add_rhs. kind;
374
+ ) = & add_rhs. kind;
375
375
if lmethod_name. as_str( ) == "powi" && rmethod_name. as_str( ) == "powi" ;
376
- if let Some ( ( lvalue, _) ) = constant( cx, cx. typeck_results( ) , & largs [ 1 ] ) ;
377
- if let Some ( ( rvalue, _) ) = constant( cx, cx. typeck_results( ) , & rargs [ 1 ] ) ;
376
+ if let Some ( ( lvalue, _) ) = constant( cx, cx. typeck_results( ) , largs_1 ) ;
377
+ if let Some ( ( rvalue, _) ) = constant( cx, cx. typeck_results( ) , rargs_1 ) ;
378
378
if Int ( 2 ) == lvalue && Int ( 2 ) == rvalue;
379
379
then {
380
- return Some ( format!( "{}.hypot({})" , Sugg :: hir( cx, & largs [ 0 ] , ".." ) , Sugg :: hir( cx, & rargs [ 0 ] , ".." ) ) ) ;
380
+ return Some ( format!( "{}.hypot({})" , Sugg :: hir( cx, largs_0 , ".." ) , Sugg :: hir( cx, rargs_0 , ".." ) ) ) ;
381
381
}
382
382
}
383
383
}
@@ -407,8 +407,8 @@ fn check_expm1(cx: &LateContext<'_>, expr: &Expr<'_>) {
407
407
if cx. typeck_results( ) . expr_ty( lhs) . is_floating_point( ) ;
408
408
if let Some ( ( value, _) ) = constant( cx, cx. typeck_results( ) , rhs) ;
409
409
if F32 ( 1.0 ) == value || F64 ( 1.0 ) == value;
410
- if let ExprKind :: MethodCall ( path, _, method_args , _) = lhs. kind;
411
- if cx. typeck_results( ) . expr_ty( & method_args [ 0 ] ) . is_floating_point( ) ;
410
+ if let ExprKind :: MethodCall ( path, _, [ self_arg , .. ] , _) = & lhs. kind;
411
+ if cx. typeck_results( ) . expr_ty( self_arg ) . is_floating_point( ) ;
412
412
if path. ident. name. as_str( ) == "exp" ;
413
413
then {
414
414
span_lint_and_sugg(
@@ -419,7 +419,7 @@ fn check_expm1(cx: &LateContext<'_>, expr: &Expr<'_>) {
419
419
"consider using" ,
420
420
format!(
421
421
"{}.exp_m1()" ,
422
- Sugg :: hir( cx, & method_args [ 0 ] , ".." )
422
+ Sugg :: hir( cx, self_arg , ".." )
423
423
) ,
424
424
Applicability :: MachineApplicable ,
425
425
) ;
@@ -617,16 +617,16 @@ fn check_log_division(cx: &LateContext<'_>, expr: &Expr<'_>) {
617
617
rhs,
618
618
) = & expr. kind;
619
619
if are_same_base_logs( cx, lhs, rhs) ;
620
- if let ExprKind :: MethodCall ( _, _, largs , _) = lhs. kind;
621
- if let ExprKind :: MethodCall ( _, _, rargs , _) = rhs. kind;
620
+ if let ExprKind :: MethodCall ( _, _, [ largs_self , .. ] , _) = & lhs. kind;
621
+ if let ExprKind :: MethodCall ( _, _, [ rargs_self , .. ] , _) = & rhs. kind;
622
622
then {
623
623
span_lint_and_sugg(
624
624
cx,
625
625
SUBOPTIMAL_FLOPS ,
626
626
expr. span,
627
627
"log base can be expressed more clearly" ,
628
628
"consider using" ,
629
- format!( "{}.log({})" , Sugg :: hir( cx, & largs [ 0 ] , ".." ) , Sugg :: hir( cx, & rargs [ 0 ] , ".." ) , ) ,
629
+ format!( "{}.log({})" , Sugg :: hir( cx, largs_self , ".." ) , Sugg :: hir( cx, rargs_self , ".." ) , ) ,
630
630
Applicability :: MachineApplicable ,
631
631
) ;
632
632
}
0 commit comments