@@ -212,7 +212,7 @@ impl LintPass for AttrPass {
212
212
213
213
impl < ' a , ' tcx > LateLintPass < ' a , ' tcx > for AttrPass {
214
214
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 ( ) {
216
216
match & * attr. name ( ) . as_str ( ) {
217
217
"allow" | "warn" | "deny" | "forbid" => {
218
218
check_clippy_lint_names ( cx, items) ;
@@ -224,8 +224,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AttrPass {
224
224
}
225
225
for item in items {
226
226
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;
229
229
if mi. name( ) == "since" ;
230
230
then {
231
231
check_semver( cx, item. span, lit) ;
@@ -244,7 +244,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AttrPass {
244
244
let skip_unused_imports = item. attrs . iter ( ) . any ( |attr| attr. name ( ) == "macro_use" ) ;
245
245
246
246
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 ( ) {
248
248
match & * attr. name ( ) . as_str ( ) {
249
249
"allow" | "warn" | "deny" | "forbid" => {
250
250
// whitelist `unused_imports` and `deprecated` for `use` items
@@ -381,22 +381,22 @@ fn is_relevant_trait(tcx: TyCtxt<'_, '_, '_>, item: &TraitItem) -> bool {
381
381
382
382
fn is_relevant_block ( tcx : TyCtxt < ' _ , ' _ , ' _ > , tables : & ty:: TypeckTables < ' _ > , block : & Block ) -> bool {
383
383
if let Some ( stmt) = block. stmts . first ( ) {
384
- match stmt. node {
384
+ match & stmt. node {
385
385
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) ,
387
387
}
388
388
} else {
389
389
block. expr . as_ref ( ) . map_or ( false , |e| is_relevant_expr ( tcx, tables, e) )
390
390
}
391
391
}
392
392
393
393
fn 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) ,
397
397
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 {
400
400
if let Some ( fun_id) = opt_def_id ( tables. qpath_def ( qpath, path_expr. hir_id ) ) {
401
401
!match_def_path ( tcx, fun_id, & paths:: BEGIN_PANIC )
402
402
} else {
@@ -443,7 +443,7 @@ fn check_attrs(cx: &LateContext<'_, '_>, span: Span, name: Name, attrs: &[Attrib
443
443
}
444
444
}
445
445
446
- if let Some ( ref values) = attr. meta_item_list ( ) {
446
+ if let Some ( values) = attr. meta_item_list ( ) {
447
447
if values. len ( ) != 1 || attr. name ( ) != "inline" {
448
448
continue ;
449
449
}
@@ -463,7 +463,7 @@ fn check_attrs(cx: &LateContext<'_, '_>, span: Span, name: Name, attrs: &[Attrib
463
463
}
464
464
465
465
fn 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 {
467
467
if Version :: parse ( & is. as_str ( ) ) . is_ok ( ) {
468
468
return ;
469
469
}
@@ -477,7 +477,7 @@ fn check_semver(cx: &LateContext<'_, '_>, span: Span, lit: &Lit) {
477
477
}
478
478
479
479
fn is_word ( nmi : & NestedMetaItem , expected : & str ) -> bool {
480
- if let NestedMetaItemKind :: MetaItem ( ref mi) = nmi. node {
480
+ if let NestedMetaItemKind :: MetaItem ( mi) = & nmi. node {
481
481
mi. is_word ( ) && mi. name ( ) == expected
482
482
} else {
483
483
false
@@ -512,7 +512,7 @@ impl EarlyLintPass for CfgAttrPass {
512
512
if_chain ! {
513
513
// check cfg_attr
514
514
if attr. name( ) == "cfg_attr" ;
515
- if let Some ( ref items) = attr. meta_item_list( ) ;
515
+ if let Some ( items) = attr. meta_item_list( ) ;
516
516
if items. len( ) == 2 ;
517
517
// check for `rustfmt`
518
518
if let Some ( feature_item) = items[ 0 ] . meta_item( ) ;
0 commit comments