@@ -58,7 +58,7 @@ pub fn range<'a>(expr: &'a hir::Expr<'_>) -> Option<Range<'a>> {
5858 }
5959
6060 match expr. kind {
61- hir:: ExprKind :: Call ( ref path, ref args)
61+ hir:: ExprKind :: Call ( path, args)
6262 if matches ! (
6363 path. kind,
6464 hir:: ExprKind :: Path ( hir:: QPath :: LangItem ( hir:: LangItem :: RangeInclusiveNew , _) )
@@ -70,7 +70,7 @@ pub fn range<'a>(expr: &'a hir::Expr<'_>) -> Option<Range<'a>> {
7070 limits : ast:: RangeLimits :: Closed ,
7171 } )
7272 } ,
73- hir:: ExprKind :: Struct ( path, ref fields, None ) => match path {
73+ hir:: ExprKind :: Struct ( path, fields, None ) => match path {
7474 hir:: QPath :: LangItem ( hir:: LangItem :: RangeFull , _) => Some ( Range {
7575 start : None ,
7676 end : None ,
@@ -112,7 +112,7 @@ pub fn is_from_for_desugar(local: &hir::Local<'_>) -> bool {
112112 // }
113113 // ```
114114 if_chain ! {
115- if let Some ( ref expr) = local. init;
115+ if let Some ( expr) = local. init;
116116 if let hir:: ExprKind :: Match ( _, _, hir:: MatchSource :: ForLoopDesugar ) = expr. kind;
117117 then {
118118 return true ;
@@ -140,14 +140,14 @@ pub fn for_loop<'tcx>(
140140 expr : & ' tcx hir:: Expr < ' tcx > ,
141141) -> Option < ( & hir:: Pat < ' _ > , & ' tcx hir:: Expr < ' tcx > , & ' tcx hir:: Expr < ' tcx > , Span ) > {
142142 if_chain ! {
143- if let hir:: ExprKind :: Match ( ref iterexpr, ref arms, hir:: MatchSource :: ForLoopDesugar ) = expr. kind;
144- if let hir:: ExprKind :: Call ( _, ref iterargs) = iterexpr. kind;
143+ if let hir:: ExprKind :: Match ( iterexpr, arms, hir:: MatchSource :: ForLoopDesugar ) = expr. kind;
144+ if let hir:: ExprKind :: Call ( _, iterargs) = iterexpr. kind;
145145 if iterargs. len( ) == 1 && arms. len( ) == 1 && arms[ 0 ] . guard. is_none( ) ;
146- if let hir:: ExprKind :: Loop ( ref block, ..) = arms[ 0 ] . body. kind;
146+ if let hir:: ExprKind :: Loop ( block, ..) = arms[ 0 ] . body. kind;
147147 if block. expr. is_none( ) ;
148148 if let [ _, _, ref let_stmt, ref body ] = * block. stmts;
149- if let hir:: StmtKind :: Local ( ref local) = let_stmt. kind;
150- if let hir:: StmtKind :: Expr ( ref expr) = body. kind;
149+ if let hir:: StmtKind :: Local ( local) = let_stmt. kind;
150+ if let hir:: StmtKind :: Expr ( expr) = body. kind;
151151 then {
152152 return Some ( ( & * local. pat, & iterargs[ 0 ] , expr, arms[ 0 ] . span) ) ;
153153 }
@@ -182,7 +182,7 @@ pub enum VecArgs<'a> {
182182/// from `vec!`.
183183pub fn vec_macro < ' e > ( cx : & LateContext < ' _ > , expr : & ' e hir:: Expr < ' _ > ) -> Option < VecArgs < ' e > > {
184184 if_chain ! {
185- if let hir:: ExprKind :: Call ( ref fun, ref args) = expr. kind;
185+ if let hir:: ExprKind :: Call ( fun, args) = expr. kind;
186186 if let hir:: ExprKind :: Path ( ref qpath) = fun. kind;
187187 if is_expn_of( fun. span, "vec" ) . is_some( ) ;
188188 if let Some ( fun_def_id) = cx. qpath_res( qpath, fun. hir_id) . opt_def_id( ) ;
@@ -194,8 +194,8 @@ pub fn vec_macro<'e>(cx: &LateContext<'_>, expr: &'e hir::Expr<'_>) -> Option<Ve
194194 else if match_def_path( cx, fun_def_id, & paths:: SLICE_INTO_VEC ) && args. len( ) == 1 {
195195 // `vec![a, b, c]` case
196196 if_chain! {
197- if let hir:: ExprKind :: Box ( ref boxed) = args[ 0 ] . kind;
198- if let hir:: ExprKind :: Array ( ref args) = boxed. kind;
197+ if let hir:: ExprKind :: Box ( boxed) = args[ 0 ] . kind;
198+ if let hir:: ExprKind :: Array ( args) = boxed. kind;
199199 then {
200200 return Some ( VecArgs :: Vec ( & * args) ) ;
201201 }
@@ -227,7 +227,7 @@ pub fn extract_assert_macro_args<'tcx>(e: &'tcx Expr<'tcx>) -> Option<Vec<&'tcx
227227 /// compared
228228 fn ast_matchblock ( matchblock_expr : & ' tcx Expr < ' tcx > ) -> Option < Vec < & Expr < ' _ > > > {
229229 if_chain ! {
230- if let ExprKind :: Match ( ref headerexpr, _, _) = & matchblock_expr. kind;
230+ if let ExprKind :: Match ( headerexpr, _, _) = & matchblock_expr. kind;
231231 if let ExprKind :: Tup ( [ lhs, rhs] ) = & headerexpr. kind;
232232 if let ExprKind :: AddrOf ( BorrowKind :: Ref , _, lhs) = lhs. kind;
233233 if let ExprKind :: AddrOf ( BorrowKind :: Ref , _, rhs) = rhs. kind;
@@ -238,12 +238,12 @@ pub fn extract_assert_macro_args<'tcx>(e: &'tcx Expr<'tcx>) -> Option<Vec<&'tcx
238238 None
239239 }
240240
241- if let ExprKind :: Block ( ref block, _) = e. kind {
241+ if let ExprKind :: Block ( block, _) = e. kind {
242242 if block. stmts . len ( ) == 1 {
243- if let StmtKind :: Semi ( ref matchexpr) = block. stmts . get ( 0 ) ?. kind {
243+ if let StmtKind :: Semi ( matchexpr) = block. stmts . get ( 0 ) ?. kind {
244244 // macros with unique arg: `{debug_}assert!` (e.g., `debug_assert!(some_condition)`)
245245 if_chain ! {
246- if let ExprKind :: If ( ref clause, _, _) = matchexpr. kind;
246+ if let ExprKind :: If ( clause, _, _) = matchexpr. kind;
247247 if let ExprKind :: Unary ( UnOp :: Not , condition) = clause. kind;
248248 then {
249249 return Some ( vec![ condition] ) ;
@@ -252,16 +252,16 @@ pub fn extract_assert_macro_args<'tcx>(e: &'tcx Expr<'tcx>) -> Option<Vec<&'tcx
252252
253253 // debug macros with two args: `debug_assert_{ne, eq}` (e.g., `assert_ne!(a, b)`)
254254 if_chain ! {
255- if let ExprKind :: Block ( ref matchblock, _) = matchexpr. kind;
256- if let Some ( ref matchblock_expr) = matchblock. expr;
255+ if let ExprKind :: Block ( matchblock, _) = matchexpr. kind;
256+ if let Some ( matchblock_expr) = matchblock. expr;
257257 then {
258258 return ast_matchblock( matchblock_expr) ;
259259 }
260260 }
261261 }
262262 } else if let Some ( matchblock_expr) = block. expr {
263263 // macros with two args: `assert_{ne, eq}` (e.g., `assert_ne!(a, b)`)
264- return ast_matchblock ( & matchblock_expr) ;
264+ return ast_matchblock ( matchblock_expr) ;
265265 }
266266 }
267267 None
0 commit comments