From 29da8b1259f38263ef098d1ff8113dec54349f97 Mon Sep 17 00:00:00 2001 From: Marijn Suijten Date: Fri, 1 Nov 2024 12:37:53 +0100 Subject: [PATCH] Fix clippy lints Specifically `rust-version = "1.58"` in the `autogen` module that I added in #223 is weird, since any developers working on and/or contributing to the repository should easily be able to run the latest stable and take advantage of newer Rust features in `autogen` code. --- autogen/Cargo.toml | 1 - autogen/src/dr.rs | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/autogen/Cargo.toml b/autogen/Cargo.toml index 43c85fd7..10a0174d 100644 --- a/autogen/Cargo.toml +++ b/autogen/Cargo.toml @@ -6,7 +6,6 @@ authors = [ "Lei Zhang ", ] edition = "2018" -rust-version = "1.58" publish = false diff --git a/autogen/src/dr.rs b/autogen/src/dr.rs index bc5b4125..90ecbd22 100644 --- a/autogen/src/dr.rs +++ b/autogen/src/dr.rs @@ -391,7 +391,7 @@ pub fn gen_dr_operand_kinds(grammar: &[structs::OperandKind]) -> TokenStream { let mut seen_discriminator = BTreeMap::new(); for e in enumerators { - if seen_discriminator.get(&e.value).is_none() { + if let std::collections::btree_map::Entry::Vacant(seen_entry) = seen_discriminator.entry(e.value) { let name = match category { structs::Category::BitEnum => { use heck::ShoutySnakeCase; @@ -412,7 +412,7 @@ pub fn gen_dr_operand_kinds(grammar: &[structs::OperandKind]) -> TokenStream { _ => panic!("Unexpected operand type"), }; - seen_discriminator.insert(e.value, name.clone()); + seen_entry.insert(name.clone()); capability_clauses .entry(&e.capabilities)