From bfd09a549e1e7c809afea18202c720b2b76664f4 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Thu, 23 Nov 2023 07:20:33 +0100 Subject: [PATCH] Appease clippy --- crates/header-translator/src/stmt.rs | 9 +++++---- crates/header-translator/src/unexposed_attr.rs | 2 +- crates/objc2/src/runtime/mod.rs | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/crates/header-translator/src/stmt.rs b/crates/header-translator/src/stmt.rs index f7d431973..e427e6360 100644 --- a/crates/header-translator/src/stmt.rs +++ b/crates/header-translator/src/stmt.rs @@ -957,14 +957,14 @@ impl Stmt { _ => error!("unknown"), }); - return vec![Self::StructDecl { + vec![Self::StructDecl { id, encoding_name, availability, boxable, fields, sendable, - }]; + }] } EntityKind::EnumDecl => { // Enum declarations show up twice for some reason, but @@ -1373,8 +1373,9 @@ impl fmt::Display for Stmt { }; let (superclass, superclasses_rest) = superclasses.split_at(1); - let (superclass, superclass_generics) = - superclass.get(0).expect("must have a least one superclass"); + let (superclass, superclass_generics) = superclass + .first() + .expect("must have a least one superclass"); writeln!(f, "{macro_name}!(")?; writeln!(f, " {derives}")?; diff --git a/crates/header-translator/src/unexposed_attr.rs b/crates/header-translator/src/unexposed_attr.rs index 022691577..24f4f5327 100644 --- a/crates/header-translator/src/unexposed_attr.rs +++ b/crates/header-translator/src/unexposed_attr.rs @@ -240,7 +240,7 @@ fn get_argument_tokens<'a>(entity: &Entity<'a>) -> Vec> { // Remove the macro name from the full macro tokens let name_ranges = entity.get_name_ranges(); assert_eq!(name_ranges.len(), 1, "macro name ranges"); - let name_range = name_ranges.get(0).unwrap(); + let name_range = name_ranges.first().unwrap(); let range = entity.get_range().expect("macro range"); let mut tokens = SourceRange::new(name_range.get_end(), range.get_end()).tokenize(); diff --git a/crates/objc2/src/runtime/mod.rs b/crates/objc2/src/runtime/mod.rs index f30f3b496..b8cfd823b 100644 --- a/crates/objc2/src/runtime/mod.rs +++ b/crates/objc2/src/runtime/mod.rs @@ -12,6 +12,7 @@ //! ``` #![doc = include_str!("../../examples/introspection.rs")] //! ``` +#![allow(clippy::missing_panics_doc)] #[cfg(feature = "malloc")] use alloc::vec::Vec;