@@ -38,19 +38,19 @@ 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
then {
49
49
let body = cx. tcx. hir( ) . body( body_id) ;
50
50
if_chain! {
51
51
if body. params. len( ) == 1 ;
52
- if let Some ( argname) = get_pat_name( & body. params[ 0 ] . pat) ;
53
- if let ExprKind :: Binary ( ref op, ref l , ref r) = body. value. kind;
52
+ if let Some ( argname) = get_pat_name( body. params[ 0 ] . pat) ;
53
+ if let ExprKind :: Binary ( op, l , r) = body. value. kind;
54
54
if op. node == BinOpKind :: Eq ;
55
55
if match_type( cx,
56
56
cx. typeck_results( ) . expr_ty( & filter_args[ 0 ] ) . peel_refs( ) ,
@@ -66,7 +66,7 @@ impl<'tcx> LateLintPass<'tcx> for ByteCount {
66
66
if ty:: Uint ( UintTy :: U8 ) != * cx. typeck_results( ) . expr_ty( needle) . peel_refs( ) . kind( ) {
67
67
return ;
68
68
}
69
- let haystack = if let ExprKind :: MethodCall ( ref path, _, ref args, _) =
69
+ let haystack = if let ExprKind :: MethodCall ( path, _, args, _) =
70
70
filter_args[ 0 ] . kind {
71
71
let p = path. ident. name;
72
72
if ( p == sym:: iter || p == sym!( iter_mut) ) && args. len( ) == 1 {
@@ -102,10 +102,10 @@ fn check_arg(name: Symbol, arg: Symbol, needle: &Expr<'_>) -> bool {
102
102
103
103
fn get_path_name ( expr : & Expr < ' _ > ) -> Option < Symbol > {
104
104
match expr. kind {
105
- ExprKind :: Box ( ref e) | ExprKind :: AddrOf ( BorrowKind :: Ref , _, ref e) | ExprKind :: Unary ( UnOp :: Deref , ref e) => {
105
+ ExprKind :: Box ( e) | ExprKind :: AddrOf ( BorrowKind :: Ref , _, e) | ExprKind :: Unary ( UnOp :: Deref , e) => {
106
106
get_path_name ( e)
107
107
} ,
108
- ExprKind :: Block ( ref b, _) => {
108
+ ExprKind :: Block ( b, _) => {
109
109
if b. stmts . is_empty ( ) {
110
110
b. expr . as_ref ( ) . and_then ( |p| get_path_name ( p) )
111
111
} else {
0 commit comments