about summary refs log tree commit diff
diff options
context:
space:
mode:
authorblyxyas <blyxyas@gmail.com>2023-03-11 13:11:27 +0100
committerblyxyas <blyxyas@gmail.com>2023-03-11 13:11:27 +0100
commit2d572d4a9c20a11a3aa75a7fdd9168cc95c60d4c (patch)
tree1749efa7c7c05159477ee8d8268db28e9702e2b0
parent1cf72183cfe0a29708130f59c79176128b06fcae (diff)
downloadrust-2d572d4a9c20a11a3aa75a7fdd9168cc95c60d4c.tar.gz
rust-2d572d4a9c20a11a3aa75a7fdd9168cc95c60d4c.zip
Replace list indexing for `.get` (fail-safe)
-rw-r--r--clippy_lints/src/allow_attribute.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/clippy_lints/src/allow_attribute.rs b/clippy_lints/src/allow_attribute.rs
index 2258b973307..defd14da9ef 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;
             }