Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
kennykerr committed Nov 6, 2023
1 parent c33e15f commit 9cd09c3
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion crates/libs/bindgen/src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ pub fn type_def_invalid_values(row: TypeDef) -> Vec<i64> {
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);
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/libs/bindgen/src/rust/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ fn cfg_add_attributes<R: AsRow + Into<HasAttribute>>(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");
Expand Down
2 changes: 1 addition & 1 deletion crates/libs/bindgen/src/rust/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ fn field_guid(row: Field) -> Option<Guid> {
}

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 {
Expand Down
2 changes: 1 addition & 1 deletion crates/libs/bindgen/src/rust/handles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ pub fn gen_win_handle(writer: &Writer, def: TypeDef) -> TokenStream {

fn type_def_usable_for(row: TypeDef) -> Option<TypeDef> {
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();
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/libs/bindgen/src/rust/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion crates/libs/bindgen/src/winmd/writer/type.rs
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down

0 comments on commit 9cd09c3

Please sign in to comment.