@@ -212,7 +212,7 @@ impl LintPass for AttrPass {
212212
213213impl < ' a , ' tcx > LateLintPass < ' a , ' tcx > for AttrPass {
214214 fn check_attribute ( & mut self , cx : & LateContext < ' a , ' tcx > , attr : & ' tcx Attribute ) {
215- if let Some ( ref items) = attr. meta_item_list ( ) {
215+ if let Some ( items) = & attr. meta_item_list ( ) {
216216 match & * attr. name ( ) . as_str ( ) {
217217 "allow" | "warn" | "deny" | "forbid" => {
218218 check_clippy_lint_names ( cx, items) ;
@@ -224,8 +224,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AttrPass {
224224 }
225225 for item in items {
226226 if_chain ! {
227- if let NestedMetaItemKind :: MetaItem ( ref mi) = item. node;
228- if let MetaItemKind :: NameValue ( ref lit) = mi. node;
227+ if let NestedMetaItemKind :: MetaItem ( mi) = & item. node;
228+ if let MetaItemKind :: NameValue ( lit) = & mi. node;
229229 if mi. name( ) == "since" ;
230230 then {
231231 check_semver( cx, item. span, lit) ;
@@ -244,7 +244,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AttrPass {
244244 let skip_unused_imports = item. attrs . iter ( ) . any ( |attr| attr. name ( ) == "macro_use" ) ;
245245
246246 for attr in & item. attrs {
247- if let Some ( ref lint_list) = attr. meta_item_list ( ) {
247+ if let Some ( lint_list) = & attr. meta_item_list ( ) {
248248 match & * attr. name ( ) . as_str ( ) {
249249 "allow" | "warn" | "deny" | "forbid" => {
250250 // whitelist `unused_imports` and `deprecated` for `use` items
@@ -381,22 +381,22 @@ fn is_relevant_trait(tcx: TyCtxt<'_, '_, '_>, item: &TraitItem) -> bool {
381381
382382fn is_relevant_block ( tcx : TyCtxt < ' _ , ' _ , ' _ > , tables : & ty:: TypeckTables < ' _ > , block : & Block ) -> bool {
383383 if let Some ( stmt) = block. stmts . first ( ) {
384- match stmt. node {
384+ match & stmt. node {
385385 StmtKind :: Decl ( _, _) => true ,
386- StmtKind :: Expr ( ref expr, _) | StmtKind :: Semi ( ref expr, _) => is_relevant_expr ( tcx, tables, expr) ,
386+ StmtKind :: Expr ( expr, _) | StmtKind :: Semi ( expr, _) => is_relevant_expr ( tcx, tables, expr) ,
387387 }
388388 } else {
389389 block. expr . as_ref ( ) . map_or ( false , |e| is_relevant_expr ( tcx, tables, e) )
390390 }
391391}
392392
393393fn is_relevant_expr ( tcx : TyCtxt < ' _ , ' _ , ' _ > , tables : & ty:: TypeckTables < ' _ > , expr : & Expr ) -> bool {
394- match expr. node {
395- ExprKind :: Block ( ref block, _) => is_relevant_block ( tcx, tables, block) ,
396- ExprKind :: Ret ( Some ( ref e) ) => is_relevant_expr ( tcx, tables, e) ,
394+ match & expr. node {
395+ ExprKind :: Block ( block, _) => is_relevant_block ( tcx, tables, block) ,
396+ ExprKind :: Ret ( Some ( e) ) => is_relevant_expr ( tcx, tables, e) ,
397397 ExprKind :: Ret ( None ) | ExprKind :: Break ( _, None ) => false ,
398- ExprKind :: Call ( ref path_expr, _) => {
399- if let ExprKind :: Path ( ref qpath) = path_expr. node {
398+ ExprKind :: Call ( path_expr, _) => {
399+ if let ExprKind :: Path ( qpath) = & path_expr. node {
400400 if let Some ( fun_id) = opt_def_id ( tables. qpath_def ( qpath, path_expr. hir_id ) ) {
401401 !match_def_path ( tcx, fun_id, & paths:: BEGIN_PANIC )
402402 } else {
@@ -443,7 +443,7 @@ fn check_attrs(cx: &LateContext<'_, '_>, span: Span, name: Name, attrs: &[Attrib
443443 }
444444 }
445445
446- if let Some ( ref values) = attr. meta_item_list ( ) {
446+ if let Some ( values) = attr. meta_item_list ( ) {
447447 if values. len ( ) != 1 || attr. name ( ) != "inline" {
448448 continue ;
449449 }
@@ -463,7 +463,7 @@ fn check_attrs(cx: &LateContext<'_, '_>, span: Span, name: Name, attrs: &[Attrib
463463}
464464
465465fn check_semver ( cx : & LateContext < ' _ , ' _ > , span : Span , lit : & Lit ) {
466- if let LitKind :: Str ( ref is, _) = lit. node {
466+ if let LitKind :: Str ( is, _) = lit. node {
467467 if Version :: parse ( & is. as_str ( ) ) . is_ok ( ) {
468468 return ;
469469 }
@@ -477,7 +477,7 @@ fn check_semver(cx: &LateContext<'_, '_>, span: Span, lit: &Lit) {
477477}
478478
479479fn is_word ( nmi : & NestedMetaItem , expected : & str ) -> bool {
480- if let NestedMetaItemKind :: MetaItem ( ref mi) = nmi. node {
480+ if let NestedMetaItemKind :: MetaItem ( mi) = & nmi. node {
481481 mi. is_word ( ) && mi. name ( ) == expected
482482 } else {
483483 false
@@ -512,7 +512,7 @@ impl EarlyLintPass for CfgAttrPass {
512512 if_chain ! {
513513 // check cfg_attr
514514 if attr. name( ) == "cfg_attr" ;
515- if let Some ( ref items) = attr. meta_item_list( ) ;
515+ if let Some ( items) = attr. meta_item_list( ) ;
516516 if items. len( ) == 2 ;
517517 // check for `rustfmt`
518518 if let Some ( feature_item) = items[ 0 ] . meta_item( ) ;
0 commit comments