@@ -772,8 +772,8 @@ fn check_for_loop<'a, 'tcx>(
772
772
773
773
fn same_var < ' a , ' tcx > ( cx : & LateContext < ' a , ' tcx > , expr : & Expr < ' _ > , var : HirId ) -> bool {
774
774
if_chain ! {
775
- if let ExprKind :: Path ( ref qpath) = expr. kind;
776
- if let QPath :: Resolved ( None , ref path) = * qpath;
775
+ if let ExprKind :: Path ( qpath) = & expr. kind;
776
+ if let QPath :: Resolved ( None , path) = qpath;
777
777
if path. segments. len( ) == 1 ;
778
778
if let Res :: Local ( local_id) = qpath_res( cx, qpath, expr. hir_id) ;
779
779
// our variable!
@@ -821,8 +821,8 @@ fn is_slice_like<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ty: Ty<'_>) -> bool {
821
821
822
822
fn get_fixed_offset_var < ' a , ' tcx > ( cx : & LateContext < ' a , ' tcx > , expr : & Expr < ' _ > , var : HirId ) -> Option < FixedOffsetVar > {
823
823
fn extract_offset < ' a , ' tcx > ( cx : & LateContext < ' a , ' tcx > , e : & Expr < ' _ > , var : HirId ) -> Option < String > {
824
- match e. kind {
825
- ExprKind :: Lit ( ref l) => match l. node {
824
+ match & e. kind {
825
+ ExprKind :: Lit ( l) => match l. node {
826
826
ast:: LitKind :: Int ( x, _ty) => Some ( x. to_string ( ) ) ,
827
827
_ => None ,
828
828
} ,
@@ -831,14 +831,14 @@ fn get_fixed_offset_var<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &Expr<'_>, v
831
831
}
832
832
}
833
833
834
- if let ExprKind :: Index ( ref seqexpr, ref idx) = expr. kind {
834
+ if let ExprKind :: Index ( seqexpr, idx) = expr. kind {
835
835
let ty = cx. tables . expr_ty ( seqexpr) ;
836
836
if !is_slice_like ( cx, ty) {
837
837
return None ;
838
838
}
839
839
840
840
let offset = match idx. kind {
841
- ExprKind :: Binary ( op, ref lhs, ref rhs) => match op. node {
841
+ ExprKind :: Binary ( op, lhs, rhs) => match op. node {
842
842
BinOpKind :: Add => {
843
843
let offset_opt = if same_var ( cx, lhs, var) {
844
844
extract_offset ( cx, rhs, var)
@@ -878,7 +878,7 @@ fn fetch_cloned_fixed_offset_var<'a, 'tcx>(
878
878
var : HirId ,
879
879
) -> Option < FixedOffsetVar > {
880
880
if_chain ! {
881
- if let ExprKind :: MethodCall ( ref method, _, ref args) = expr. kind;
881
+ if let ExprKind :: MethodCall ( method, _, args) = expr. kind;
882
882
if method. ident. name == sym!( clone) ;
883
883
if args. len( ) == 1 ;
884
884
if let Some ( arg) = args. get( 0 ) ;
@@ -900,7 +900,7 @@ fn get_indexed_assignments<'a, 'tcx>(
900
900
e : & Expr < ' _ > ,
901
901
var : HirId ,
902
902
) -> Option < ( FixedOffsetVar , FixedOffsetVar ) > {
903
- if let ExprKind :: Assign ( ref lhs, ref rhs, _) = e. kind {
903
+ if let ExprKind :: Assign ( lhs, rhs, _) = e. kind {
904
904
match (
905
905
get_fixed_offset_var ( cx, lhs, var) ,
906
906
fetch_cloned_fixed_offset_var ( cx, rhs, var) ,
@@ -920,16 +920,14 @@ fn get_indexed_assignments<'a, 'tcx>(
920
920
}
921
921
}
922
922
923
- if let ExprKind :: Block ( ref b, _) = body. kind {
924
- let Block {
925
- ref stmts, ref expr, ..
926
- } = * * b;
923
+ if let ExprKind :: Block ( b, _) = body. kind {
924
+ let Block { stmts, expr, .. } = * b;
927
925
928
926
stmts
929
927
. iter ( )
930
928
. map ( |stmt| match stmt. kind {
931
929
StmtKind :: Local ( ..) | StmtKind :: Item ( ..) => None ,
932
- StmtKind :: Expr ( ref e) | StmtKind :: Semi ( ref e) => Some ( get_assignment ( cx, e, var) ) ,
930
+ StmtKind :: Expr ( e) | StmtKind :: Semi ( e) => Some ( get_assignment ( cx, e, var) ) ,
933
931
} )
934
932
. chain ( expr. as_ref ( ) . into_iter ( ) . map ( |e| Some ( get_assignment ( cx, & * e, var) ) ) )
935
933
. filter_map ( |op| op)
@@ -992,7 +990,7 @@ fn detect_manual_memcpy<'a, 'tcx>(
992
990
993
991
let print_limit = |end : & Expr < ' _ > , offset : Offset , var_name : & str | {
994
992
if_chain ! {
995
- if let ExprKind :: MethodCall ( ref method, _, ref len_args) = end. kind;
993
+ if let ExprKind :: MethodCall ( method, _, len_args) = end. kind;
996
994
if method. ident. name == sym!( len) ;
997
995
if len_args. len( ) == 1 ;
998
996
if let Some ( arg) = len_args. get( 0 ) ;
0 commit comments