From 9cd09c3c135de0003014b5ede6e9999493eb88c0 Mon Sep 17 00:00:00 2001 From: Kenny Kerr Date: Mon, 6 Nov 2023 08:34:55 -0600 Subject: [PATCH] clippy --- crates/libs/bindgen/src/metadata.rs | 2 +- crates/libs/bindgen/src/rust/cfg.rs | 2 +- crates/libs/bindgen/src/rust/constants.rs | 2 +- crates/libs/bindgen/src/rust/handles.rs | 2 +- crates/libs/bindgen/src/rust/writer.rs | 2 +- crates/libs/bindgen/src/winmd/writer/type.rs | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/libs/bindgen/src/metadata.rs b/crates/libs/bindgen/src/metadata.rs index a02e67b95e..b678c4b32b 100644 --- a/crates/libs/bindgen/src/metadata.rs +++ b/crates/libs/bindgen/src/metadata.rs @@ -766,7 +766,7 @@ pub fn type_def_invalid_values(row: TypeDef) -> Vec { let mut values = Vec::new(); for attribute in row.attributes() { if attribute.name() == "InvalidHandleValueAttribute" { - if let Some((_, Value::I64(value))) = attribute.args().get(0) { + if let Some((_, Value::I64(value))) = attribute.args().first() { values.push(*value); } } diff --git a/crates/libs/bindgen/src/rust/cfg.rs b/crates/libs/bindgen/src/rust/cfg.rs index c1ed18553f..a6d9b47837 100644 --- a/crates/libs/bindgen/src/rust/cfg.rs +++ b/crates/libs/bindgen/src/rust/cfg.rs @@ -121,7 +121,7 @@ fn cfg_add_attributes>(cfg: &mut Cfg, row: R) { for attribute in row.attributes() { match attribute.name() { "SupportedArchitectureAttribute" => { - if let Some((_, Value::EnumDef(_, value))) = attribute.args().get(0) { + if let Some((_, Value::EnumDef(_, value))) = attribute.args().first() { if let Value::I32(value) = **value { if value & 1 == 1 { cfg.arches.insert("x86"); diff --git a/crates/libs/bindgen/src/rust/constants.rs b/crates/libs/bindgen/src/rust/constants.rs index 1f15c4c291..5acca64b9e 100644 --- a/crates/libs/bindgen/src/rust/constants.rs +++ b/crates/libs/bindgen/src/rust/constants.rs @@ -189,7 +189,7 @@ fn field_guid(row: Field) -> Option { } fn field_is_ansi(row: Field) -> bool { - row.find_attribute("NativeEncodingAttribute").is_some_and(|attribute| matches!(attribute.args().get(0), Some((_, Value::String(encoding))) if encoding == "ansi")) + row.find_attribute("NativeEncodingAttribute").is_some_and(|attribute| matches!(attribute.args().first(), Some((_, Value::String(encoding))) if encoding == "ansi")) } fn type_has_replacement(ty: &Type) -> bool { diff --git a/crates/libs/bindgen/src/rust/handles.rs b/crates/libs/bindgen/src/rust/handles.rs index a9015ebfe6..ef06b8bbcb 100644 --- a/crates/libs/bindgen/src/rust/handles.rs +++ b/crates/libs/bindgen/src/rust/handles.rs @@ -109,7 +109,7 @@ pub fn gen_win_handle(writer: &Writer, def: TypeDef) -> TokenStream { fn type_def_usable_for(row: TypeDef) -> Option { if let Some(attribute) = row.find_attribute("AlsoUsableForAttribute") { - if let Some((_, Value::String(name))) = attribute.args().get(0) { + if let Some((_, Value::String(name))) = attribute.args().first() { return row.reader().get_type_def(row.namespace(), name.as_str()).next(); } } diff --git a/crates/libs/bindgen/src/rust/writer.rs b/crates/libs/bindgen/src/rust/writer.rs index ab149387a7..3d18b48823 100644 --- a/crates/libs/bindgen/src/rust/writer.rs +++ b/crates/libs/bindgen/src/rust/writer.rs @@ -1207,7 +1207,7 @@ fn type_def_is_agile(row: TypeDef) -> bool { match attribute.name() { "AgileAttribute" => return true, "MarshalingBehaviorAttribute" => { - if let Some((_, Value::EnumDef(_, value))) = attribute.args().get(0) { + if let Some((_, Value::EnumDef(_, value))) = attribute.args().first() { if let Value::I32(2) = **value { return true; } diff --git a/crates/libs/bindgen/src/winmd/writer/type.rs b/crates/libs/bindgen/src/winmd/writer/type.rs index c0668c8ab9..f04f866367 100644 --- a/crates/libs/bindgen/src/winmd/writer/type.rs +++ b/crates/libs/bindgen/src/winmd/writer/type.rs @@ -1,4 +1,4 @@ -#![allow(dead_code, clippy::upper_case_acronyms)] +#![allow(dead_code, clippy::upper_case_acronyms, clippy::enum_variant_names)] #[derive(Clone, Debug, Hash, PartialEq, Eq)] pub struct TypeName {