@@ -38,17 +38,17 @@ declare_lint_pass!(ByteCount => [NAIVE_BYTECOUNT]);
38
38
impl < ' tcx > LateLintPass < ' tcx > for ByteCount {
39
39
fn check_expr ( & mut self , cx : & LateContext < ' _ > , expr : & Expr < ' _ > ) {
40
40
if_chain ! {
41
- if let ExprKind :: MethodCall ( ref count, _, ref count_args, _) = expr. kind;
41
+ if let ExprKind :: MethodCall ( count, _, count_args, _) = expr. kind;
42
42
if count. ident. name == sym!( count) ;
43
43
if count_args. len( ) == 1 ;
44
- if let ExprKind :: MethodCall ( ref filter, _, ref filter_args, _) = count_args[ 0 ] . kind;
44
+ if let ExprKind :: MethodCall ( filter, _, filter_args, _) = count_args[ 0 ] . kind;
45
45
if filter. ident. name == sym!( filter) ;
46
46
if filter_args. len( ) == 2 ;
47
47
if let ExprKind :: Closure ( _, _, body_id, _, _) = filter_args[ 1 ] . kind;
48
48
let body = cx. tcx. hir( ) . body( body_id) ;
49
49
if body. params. len( ) == 1 ;
50
- if let Some ( argname) = get_pat_name( & body. params[ 0 ] . pat) ;
51
- if let ExprKind :: Binary ( ref op, ref l , ref r) = body. value. kind;
50
+ if let Some ( argname) = get_pat_name( body. params[ 0 ] . pat) ;
51
+ if let ExprKind :: Binary ( ref op, l , r) = body. value. kind;
52
52
if op. node == BinOpKind :: Eq ;
53
53
if match_type( cx,
54
54
cx. typeck_results( ) . expr_ty( & filter_args[ 0 ] ) . peel_refs( ) ,
@@ -64,7 +64,7 @@ impl<'tcx> LateLintPass<'tcx> for ByteCount {
64
64
if ty:: Uint ( UintTy :: U8 ) != * cx. typeck_results( ) . expr_ty( needle) . peel_refs( ) . kind( ) {
65
65
return ;
66
66
}
67
- let haystack = if let ExprKind :: MethodCall ( ref path, _, ref args, _) =
67
+ let haystack = if let ExprKind :: MethodCall ( path, _, args, _) =
68
68
filter_args[ 0 ] . kind {
69
69
let p = path. ident. name;
70
70
if ( p == sym:: iter || p == sym!( iter_mut) ) && args. len( ) == 1 {
@@ -98,10 +98,10 @@ fn check_arg(name: Symbol, arg: Symbol, needle: &Expr<'_>) -> bool {
98
98
99
99
fn get_path_name ( expr : & Expr < ' _ > ) -> Option < Symbol > {
100
100
match expr. kind {
101
- ExprKind :: Box ( ref e) | ExprKind :: AddrOf ( BorrowKind :: Ref , _, ref e) | ExprKind :: Unary ( UnOp :: Deref , ref e) => {
101
+ ExprKind :: Box ( e) | ExprKind :: AddrOf ( BorrowKind :: Ref , _, e) | ExprKind :: Unary ( UnOp :: Deref , e) => {
102
102
get_path_name ( e)
103
103
} ,
104
- ExprKind :: Block ( ref b, _) => {
104
+ ExprKind :: Block ( b, _) => {
105
105
if b. stmts . is_empty ( ) {
106
106
b. expr . as_ref ( ) . and_then ( |p| get_path_name ( p) )
107
107
} else {
0 commit comments