From 2d572d4a9c20a11a3aa75a7fdd9168cc95c60d4c Mon Sep 17 00:00:00 2001 From: blyxyas Date: Sat, 11 Mar 2023 13:11:27 +0100 Subject: [PATCH] Replace list indexing for `.get` (fail-safe) --- clippy_lints/src/allow_attribute.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clippy_lints/src/allow_attribute.rs b/clippy_lints/src/allow_attribute.rs index 2258b973307d..defd14da9ef6 100644 --- a/clippy_lints/src/allow_attribute.rs +++ b/clippy_lints/src/allow_attribute.rs @@ -55,7 +55,8 @@ impl LateLintPass<'_> for AllowAttribute { .name == sym!(feature); if let ast::AttrKind::Normal(normal) = &attr.kind; if let Some(MetaItemKind::List(list)) = normal.item.meta_kind(); - if list[0].ident().unwrap().name == sym!(lint_reasons); + if let Some(symbol) = list.get(0); + if symbol.ident().unwrap().name == sym!(lint_reasons); then { self.lint_reasons_active = true; }