about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--library/stdarch/crates/stdarch-gen-arm/src/big_endian.rs29
-rw-r--r--library/stdarch/crates/stdarch-gen-arm/src/context.rs5
-rw-r--r--library/stdarch/crates/stdarch-gen-arm/src/expression.rs15
-rw-r--r--library/stdarch/crates/stdarch-gen-arm/src/fn_suffix.rs133
-rw-r--r--library/stdarch/crates/stdarch-gen-arm/src/intrinsic.rs37
-rw-r--r--library/stdarch/crates/stdarch-gen-arm/src/load_store_tests.rs5
-rw-r--r--library/stdarch/crates/stdarch-gen-arm/src/main.rs12
-rw-r--r--library/stdarch/crates/stdarch-gen-arm/src/typekinds.rs8
-rw-r--r--library/stdarch/crates/stdarch-gen-arm/src/wildstring.rs2
9 files changed, 76 insertions, 170 deletions
diff --git a/library/stdarch/crates/stdarch-gen-arm/src/big_endian.rs b/library/stdarch/crates/stdarch-gen-arm/src/big_endian.rs
index 171904bbdb7..b982ff53ec3 100644
--- a/library/stdarch/crates/stdarch-gen-arm/src/big_endian.rs
+++ b/library/stdarch/crates/stdarch-gen-arm/src/big_endian.rs
@@ -38,7 +38,7 @@ fn create_array(lanes: u32) -> Option<String> {
         4 => Some("[3, 2, 1, 0]".to_string()),
         8 => Some("[7, 6, 5, 4, 3, 2, 1, 0]".to_string()),
         16 => Some("[15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]".to_string()),
-        _ => panic!("Incorrect vector number of vector lanes: {}", lanes),
+        _ => panic!("Incorrect vector number of vector lanes: {lanes}"),
     }
 }
 
@@ -78,12 +78,7 @@ pub fn type_has_tuple(type_kind: &TypeKind) -> bool {
 }
 
 pub fn make_variable_mutable(variable_name: &str, type_kind: &TypeKind) -> Expression {
-    let mut_variable = format!(
-        "let mut {}: {} = {}",
-        variable_name,
-        type_kind.to_string(),
-        variable_name
-    );
+    let mut_variable = format!("let mut {variable_name}: {type_kind} = {variable_name}");
     let identifier_name = create_single_wild_string(&mut_variable);
     Expression::Identifier(identifier_name, IdentifierType::Symbol)
 }
@@ -114,9 +109,7 @@ fn create_shuffle_internal(
     };
 
     let lane_count = vector_type.lanes();
-    let Some(array_lanes) = create_array(lane_count) else {
-        return None;
-    };
+    let array_lanes = create_array(lane_count)?;
 
     let tuple_count = vector_type.tuple_size().map_or_else(|| 0, |t| t.to_int());
 
@@ -144,10 +137,7 @@ fn create_assigned_tuple_shuffle_call_fmt(
     array_lanes: &String,
 ) -> String {
     format!(
-        "{variable_name}.{idx} = unsafe {{ simd_shuffle!({variable_name}.{idx}, {variable_name}.{idx}, {array_lanes}) }};\n",
-        variable_name = variable_name,
-        idx = idx,
-        array_lanes = array_lanes
+        "{variable_name}.{idx} = unsafe {{ simd_shuffle!({variable_name}.{idx}, {variable_name}.{idx}, {array_lanes}) }};\n"
     )
 }
 
@@ -157,10 +147,7 @@ fn create_assigned_shuffle_call_fmt(
     array_lanes: &String,
 ) -> String {
     format!(
-        "let {variable_name}: {type_kind} = unsafe {{ simd_shuffle!({variable_name}, {variable_name}, {array_lanes}) }}",
-        type_kind = type_kind.to_string(),
-        variable_name = variable_name,
-        array_lanes = array_lanes
+        "let {variable_name}: {type_kind} = unsafe {{ simd_shuffle!({variable_name}, {variable_name}, {array_lanes}) }}"
     )
 }
 
@@ -169,11 +156,7 @@ fn create_shuffle_call_fmt(
     _type_kind: &TypeKind,
     array_lanes: &String,
 ) -> String {
-    format!(
-        "simd_shuffle!({variable_name}, {variable_name}, {array_lanes})",
-        variable_name = variable_name,
-        array_lanes = array_lanes
-    )
+    format!("simd_shuffle!({variable_name}, {variable_name}, {array_lanes})")
 }
 
 /// Create a `simd_shuffle!(<...>, [...])` call, where the output is stored
diff --git a/library/stdarch/crates/stdarch-gen-arm/src/context.rs b/library/stdarch/crates/stdarch-gen-arm/src/context.rs
index 751fd9f2a34..9b8eb8e8b9b 100644
--- a/library/stdarch/crates/stdarch-gen-arm/src/context.rs
+++ b/library/stdarch/crates/stdarch-gen-arm/src/context.rs
@@ -1,6 +1,6 @@
 use itertools::Itertools;
 use serde::{Deserialize, Serialize};
-use std::{collections::HashMap, usize};
+use std::collections::HashMap;
 
 use crate::{
     expression::Expression,
@@ -165,11 +165,12 @@ impl LocalContext {
                 .map_or_else(err, |ty| Ok((ty.size().parse::<i32>().unwrap()-1).to_string())),
             Wildcard::SizeInBytesLog2(idx) => self.input.typekind(*idx)
                 .map_or_else(err, |ty| Ok(ty.size_in_bytes_log2())),
-            Wildcard::NVariant if self.substitutions.get(wildcard).is_none() => Ok(String::new()),
+            Wildcard::NVariant if !self.substitutions.contains_key(wildcard) => Ok(String::new()),
             Wildcard::TypeKind(idx, opts) => {
                 self.input.typekind(*idx)
                     .map_or_else(err, |ty| {
                         let literal = if let Some(opts) = opts {
+                            #[allow(clippy::obfuscated_if_else)]
                             opts.contains(ty.base_type().map(|bt| *bt.kind()).ok_or_else(|| {
                                 format!("cannot retrieve a type literal out of {ty}")
                             })?)
diff --git a/library/stdarch/crates/stdarch-gen-arm/src/expression.rs b/library/stdarch/crates/stdarch-gen-arm/src/expression.rs
index b1db251a147..56c94602fff 100644
--- a/library/stdarch/crates/stdarch-gen-arm/src/expression.rs
+++ b/library/stdarch/crates/stdarch-gen-arm/src/expression.rs
@@ -56,7 +56,7 @@ impl FnCall {
         FnCall(Box::new(fn_ptr), arguments, Vec::new(), true).into()
     }
 
-    pub fn is_llvm_link_call(&self, llvm_link_name: &String) -> bool {
+    pub fn is_llvm_link_call(&self, llvm_link_name: &str) -> bool {
         self.is_expected_call(llvm_link_name)
     }
 
@@ -66,7 +66,7 @@ impl FnCall {
 
     pub fn is_expected_call(&self, fn_call_name: &str) -> bool {
         if let Expression::Identifier(fn_name, IdentifierType::Symbol) = self.0.as_ref() {
-            &fn_name.to_string() == fn_call_name
+            fn_name.to_string() == fn_call_name
         } else {
             false
         }
@@ -205,6 +205,7 @@ impl Expression {
             Self::FnCall(fn_call) => {
                 fn_call.build(intrinsic, ctx)?;
 
+                #[allow(clippy::collapsible_if)]
                 if let Some(llvm_link_name) = ctx.local.substitutions.get(&Wildcard::LLVMLink) {
                     if fn_call.is_llvm_link_call(llvm_link_name) {
                         *self = intrinsic
@@ -357,7 +358,7 @@ impl Expression {
                         false
                     }
                 }
-                _ => panic!("Badly defined function call: {:?}", fn_call),
+                _ => panic!("Badly defined function call: {fn_call:?}"),
             },
             _ => false,
         }
@@ -365,11 +366,7 @@ impl Expression {
 
     /// Determine if an espression is a LLVM binding
     pub fn is_llvm_link(&self) -> bool {
-        if let Expression::LLVMLink(_) = self {
-            true
-        } else {
-            false
-        }
+        matches!(self, Expression::LLVMLink(_))
     }
 }
 
@@ -508,7 +505,7 @@ impl ToTokens for Expression {
                 identifier
                     .to_string()
                     .parse::<TokenStream>()
-                    .expect(format!("invalid syntax: {:?}", self).as_str())
+                    .unwrap_or_else(|_| panic!("invalid syntax: {self:?}"))
                     .to_tokens(tokens);
             }
             Self::IntConstant(n) => tokens.append(Literal::i32_unsuffixed(*n)),
diff --git a/library/stdarch/crates/stdarch-gen-arm/src/fn_suffix.rs b/library/stdarch/crates/stdarch-gen-arm/src/fn_suffix.rs
index 9f7827776e0..26c156ae178 100644
--- a/library/stdarch/crates/stdarch-gen-arm/src/fn_suffix.rs
+++ b/library/stdarch/crates/stdarch-gen-arm/src/fn_suffix.rs
@@ -61,7 +61,7 @@ fn neon_get_base_and_char(ty: &VectorType) -> (u32, char, bool) {
         BaseType::Sized(BaseTypeKind::Int, size) => (*size, 's', *size * lanes == 128),
         BaseType::Sized(BaseTypeKind::UInt, size) => (*size, 'u', *size * lanes == 128),
         BaseType::Sized(BaseTypeKind::Poly, size) => (*size, 'p', *size * lanes == 128),
-        _ => panic!("Unhandled {:?}", ty),
+        _ => panic!("Unhandled {ty:?}"),
     }
 }
 
@@ -73,169 +73,92 @@ pub fn make_neon_suffix(type_kind: TypeKind, suffix_kind: SuffixKind) -> String
         TypeKind::Vector(ty) => {
             let tuple_size = ty.tuple_size().map_or(0, |t| t.to_int());
             let (base_size, prefix_char, requires_q) = neon_get_base_and_char(&ty);
+            let prefix_q = if requires_q { "q" } else { "" };
             let lanes = ty.lanes();
             match suffix_kind {
                 SuffixKind::Normal => {
-                    let mut str_suffix: String = String::new();
-                    if requires_q {
-                        str_suffix.push('q');
-                    }
-                    str_suffix.push('_');
-                    str_suffix.push(prefix_char);
-                    str_suffix.push_str(base_size.to_string().as_str());
+                    let mut str_suffix: String = format!("{prefix_q}_{prefix_char}{base_size}");
                     if tuple_size > 0 {
                         str_suffix.push_str("_x");
                         str_suffix.push_str(tuple_size.to_string().as_str());
                     }
-                    return str_suffix;
+                    str_suffix
                 }
                 SuffixKind::NSuffix => {
-                    let mut str_suffix: String = String::new();
-                    if requires_q {
-                        str_suffix.push('q');
-                    }
-                    str_suffix.push_str("_n_");
-                    str_suffix.push(prefix_char);
-                    str_suffix.push_str(base_size.to_string().as_str());
-                    return str_suffix;
+                    format!("{prefix_q}_n_{prefix_char}{base_size}")
                 }
 
-                SuffixKind::NoQ => format!("_{}{}", prefix_char, base_size),
-                SuffixKind::NoQNSuffix => format!("_n{}{}", prefix_char, base_size),
+                SuffixKind::NoQ => format!("_{prefix_char}{base_size}"),
+                SuffixKind::NoQNSuffix => format!("_n{prefix_char}{base_size}"),
 
                 SuffixKind::Unsigned => {
                     let t = type_kind.to_string();
                     if t.starts_with("u") {
                         return t;
                     }
-                    return format!("u{}", t);
+                    format!("u{t}")
                 }
                 SuffixKind::Lane => {
                     if lanes == 0 {
-                        panic!("type {} has no lanes!", type_kind.to_string())
+                        panic!("type {type_kind} has no lanes!")
                     } else {
-                        format!("{}", lanes)
+                        format!("{lanes}")
                     }
                 }
                 SuffixKind::Tuple => {
                     if tuple_size == 0 {
-                        panic!("type {} has no lanes!", type_kind.to_string())
+                        panic!("type {type_kind} has no lanes!")
                     } else {
-                        format!("{}", tuple_size)
+                        format!("{tuple_size}")
                     }
                 }
                 SuffixKind::Base => base_size.to_string(),
                 SuffixKind::NoX => {
-                    let mut str_suffix: String = String::new();
-                    if requires_q {
-                        str_suffix.push('q');
-                    }
-                    str_suffix.push('_');
-                    str_suffix.push(prefix_char);
-                    str_suffix.push_str(base_size.to_string().as_str());
-                    return str_suffix;
+                    format!("{prefix_q}_{prefix_char}{base_size}")
                 }
                 SuffixKind::Dup => {
-                    let mut str_suffix: String = String::new();
-                    if requires_q {
-                        str_suffix.push('q');
-                    }
-                    str_suffix.push('_');
-                    str_suffix.push_str("dup_");
-                    str_suffix.push(prefix_char);
-                    str_suffix.push_str(base_size.to_string().as_str());
+                    let mut str_suffix: String = format!("{prefix_q}_dup_{prefix_char}{base_size}");
                     if tuple_size > 0 {
                         str_suffix.push_str("_x");
                         str_suffix.push_str(tuple_size.to_string().as_str());
                     }
-                    return str_suffix;
+                    str_suffix
                 }
                 SuffixKind::DupNox => {
-                    let mut str_suffix: String = String::new();
-                    if requires_q {
-                        str_suffix.push('q');
-                    }
-                    str_suffix.push('_');
-                    str_suffix.push_str("dup_");
-                    str_suffix.push(prefix_char);
-                    str_suffix.push_str(base_size.to_string().as_str());
-                    return str_suffix;
+                    format!("{prefix_q}_dup_{prefix_char}{base_size}")
                 }
                 SuffixKind::LaneNoX => {
-                    let mut str_suffix: String = String::new();
-                    if requires_q {
-                        str_suffix.push('q');
-                    }
-                    str_suffix.push('_');
-                    str_suffix.push_str("lane_");
-                    str_suffix.push(prefix_char);
-                    str_suffix.push_str(base_size.to_string().as_str());
-                    return str_suffix;
+                    format!("{prefix_q}_lane_{prefix_char}{base_size}")
                 }
                 SuffixKind::LaneQNoX => {
-                    let mut str_suffix: String = String::new();
-                    if requires_q {
-                        str_suffix.push('q');
-                    }
-                    str_suffix.push('_');
-                    str_suffix.push_str("laneq_");
-                    str_suffix.push(prefix_char);
-                    str_suffix.push_str(base_size.to_string().as_str());
-                    return str_suffix;
+                    format!("{prefix_q}_laneq_{prefix_char}{base_size}")
                 }
                 SuffixKind::Rot270 => {
-                    if requires_q {
-                        return format!("q_rot270_{}{}", prefix_char, base_size.to_string());
-                    }
-                    return format!("_rot270_{}{}", prefix_char, base_size.to_string());
+                    format!("{prefix_q}_rot270_{prefix_char}{base_size}")
                 }
                 SuffixKind::Rot270Lane => {
-                    if requires_q {
-                        return format!("q_rot270_lane_{}{}", prefix_char, base_size.to_string());
-                    }
-                    return format!("_rot270_lane_{}{}", prefix_char, base_size.to_string());
+                    format!("{prefix_q}_rot270_lane_{prefix_char}{base_size}")
                 }
                 SuffixKind::Rot270LaneQ => {
-                    if requires_q {
-                        return format!("q_rot270_laneq_{}{}", prefix_char, base_size.to_string());
-                    }
-                    return format!("_rot270_laneq_{}{}", prefix_char, base_size.to_string());
+                    format!("{prefix_q}_rot270_laneq_{prefix_char}{base_size}")
                 }
                 SuffixKind::Rot180 => {
-                    if requires_q {
-                        return format!("q_rot180_{}{}", prefix_char, base_size.to_string());
-                    }
-                    return format!("_rot180_{}{}", prefix_char, base_size.to_string());
+                    format!("{prefix_q}_rot180_{prefix_char}{base_size}")
                 }
                 SuffixKind::Rot180Lane => {
-                    if requires_q {
-                        return format!("q_rot180_lane_{}{}", prefix_char, base_size.to_string());
-                    }
-                    return format!("_rot180_lane_{}{}", prefix_char, base_size.to_string());
+                    format!("{prefix_q}_rot180_lane_{prefix_char}{base_size}")
                 }
                 SuffixKind::Rot180LaneQ => {
-                    if requires_q {
-                        return format!("q_rot180_laneq_{}{}", prefix_char, base_size.to_string());
-                    }
-                    return format!("_rot180_laneq_{}{}", prefix_char, base_size.to_string());
+                    format!("{prefix_q}_rot180_laneq_{prefix_char}{base_size}")
                 }
                 SuffixKind::Rot90 => {
-                    if requires_q {
-                        return format!("q_rot90_{}{}", prefix_char, base_size.to_string());
-                    }
-                    return format!("_rot90_{}{}", prefix_char, base_size.to_string());
+                    format!("{prefix_q}_rot90_{prefix_char}{base_size}")
                 }
                 SuffixKind::Rot90Lane => {
-                    if requires_q {
-                        return format!("q_rot90_lane_{}{}", prefix_char, base_size.to_string());
-                    }
-                    return format!("_rot90_lane_{}{}", prefix_char, base_size.to_string());
+                    format!("{prefix_q}_rot90_lane_{prefix_char}{base_size}")
                 }
                 SuffixKind::Rot90LaneQ => {
-                    if requires_q {
-                        return format!("q_rot90_laneq_{}{}", prefix_char, base_size.to_string());
-                    }
-                    return format!("_rot90_laneq_{}{}", prefix_char, base_size.to_string());
+                    format!("{prefix_q}_rot90_laneq_{prefix_char}{base_size}")
                 }
                 SuffixKind::BaseByteSize => format!("{}", base_size / 8),
             }
@@ -272,7 +195,7 @@ impl FromStr for SuffixKind {
             "base_byte_size" => Ok(SuffixKind::BaseByteSize),
             "lane_nox" => Ok(SuffixKind::LaneNoX),
             "laneq_nox" => Ok(SuffixKind::LaneQNoX),
-            _ => Err(format!("unknown suffix type: {}", s)),
+            _ => Err(format!("unknown suffix type: {s}")),
         }
     }
 }
diff --git a/library/stdarch/crates/stdarch-gen-arm/src/intrinsic.rs b/library/stdarch/crates/stdarch-gen-arm/src/intrinsic.rs
index 822bf74ef07..efaa9e14188 100644
--- a/library/stdarch/crates/stdarch-gen-arm/src/intrinsic.rs
+++ b/library/stdarch/crates/stdarch-gen-arm/src/intrinsic.rs
@@ -254,6 +254,7 @@ impl Constraint {
             }
         }
 
+        #[allow(clippy::collapsible_if)]
         if let Self::SVEMaxElems {
             sve_max_elems_type: ty,
             ..
@@ -331,6 +332,7 @@ impl Signature {
             self.name.build_acle(ctx)?;
         }
 
+        #[allow(clippy::collapsible_if)]
         if let Some(ref mut return_type) = self.return_type {
             if let Some(w) = return_type.clone().wildcard() {
                 return_type.populate_wildcard(ctx.provide_type_wildcard(w)?)?;
@@ -383,10 +385,7 @@ impl ToTokens for Signature {
             .clone()
             .into_iter()
             .map(|mut arg| {
-                if arg
-                    .kind
-                    .vector()
-                    .map_or(false, |ty| ty.base_type().is_bool())
+                if arg.kind.vector().is_some_and(|ty| ty.base_type().is_bool())
                     && self.predicate_needs_conversion
                 {
                     arg.kind = TypeKind::Vector(VectorType::make_predicate_from_bitsize(8))
@@ -400,7 +399,7 @@ impl ToTokens for Signature {
         if let Some(ref return_type) = self.return_type {
             if return_type
                 .vector()
-                .map_or(false, |ty| ty.base_type().is_bool())
+                .is_some_and(|ty| ty.base_type().is_bool())
                 && self.predicate_needs_conversion
             {
                 tokens.append_all(quote! { -> svbool_t })
@@ -475,10 +474,11 @@ pub struct LLVMLink {
 
 impl LLVMLink {
     pub fn resolve(&self, cfg: &ArchitectureSettings) -> String {
-        self.name
-            .starts_with("llvm")
-            .then(|| self.name.to_string())
-            .unwrap_or_else(|| format!("{}.{}", cfg.llvm_link_prefix, self.name))
+        if self.name.starts_with("llvm") {
+            self.name.to_string()
+        } else {
+            format!("{}.{}", cfg.llvm_link_prefix, self.name)
+        }
     }
 
     pub fn build_and_save(&mut self, ctx: &mut Context) -> context::Result {
@@ -529,7 +529,7 @@ impl LLVMLink {
         if let Some(ref mut links) = self.links {
             links.iter_mut().for_each(|ele| {
                 ele.link
-                    .build(&ctx.local, TypeRepr::LLVMMachine)
+                    .build(ctx.local, TypeRepr::LLVMMachine)
                     .expect("Failed to transform to LLVMMachine representation");
             });
         } else {
@@ -1024,15 +1024,14 @@ impl Intrinsic {
         if variant.attr.is_none() && variant.assert_instr.is_none() {
             panic!(
                 "Error: {} is missing both 'attr' and 'assert_instr' fields. You must either manually declare the attributes using the 'attr' field or use 'assert_instr'!",
-                variant.signature.name.to_string()
+                variant.signature.name
             );
         }
 
         if variant.attr.is_some() {
             let attr: &Vec<Expression> = &variant.attr.clone().unwrap();
             let mut expanded_attr: Vec<Expression> = Vec::new();
-            for idx in 0..attr.len() {
-                let mut ex = attr[idx].clone();
+            for mut ex in attr.iter().cloned() {
                 ex.build(&variant, &mut ctx)?;
                 expanded_attr.push(ex);
             }
@@ -1085,6 +1084,7 @@ impl Intrinsic {
                 /* We do not want to be creating a `mut` variant if the type
                  * has one lane. If it has one lane that means it does not need
                  * shuffling */
+                #[allow(clippy::collapsible_if)]
                 if let TypeKind::Vector(vector_type) = &function_parameter.kind {
                     if vector_type.lanes() == 1 {
                         continue;
@@ -1172,7 +1172,7 @@ impl Intrinsic {
 
                 /* Now we shuffle the return value - we are creating a new
                  * return value for the intrinsic. */
-                let return_value_variable = if type_has_tuple(&return_type) {
+                let return_value_variable = if type_has_tuple(return_type) {
                     create_mut_let_variable(&ret_val_name, return_type, return_value.clone())
                 } else {
                     create_let_variable(&ret_val_name, return_type, return_value.clone())
@@ -1542,7 +1542,7 @@ impl Intrinsic {
             .get(0)
             .and_then(|arg| arg.typekind())
             .and_then(|ty| ty.base_type())
-            .map(BaseType::clone);
+            .cloned();
 
         // Add global target features
         self.target_features = ctx
@@ -1766,7 +1766,7 @@ fn create_tokens(intrinsic: &Intrinsic, endianness: Endianness, tokens: &mut Tok
 
         /* Target feature will get added here */
         let attr_expressions = &mut attr.iter().peekable();
-        while let Some(ex) = attr_expressions.next() {
+        for ex in attr_expressions {
             let mut inner = TokenStream::new();
             ex.to_tokens(&mut inner);
             tokens.append(Punct::new('#', Spacing::Alone));
@@ -1778,9 +1778,10 @@ fn create_tokens(intrinsic: &Intrinsic, endianness: Endianness, tokens: &mut Tok
         });
     }
 
+    #[allow(clippy::collapsible_if)]
     if let Some(assert_instr) = &intrinsic.assert_instr {
         if !assert_instr.is_empty() {
-            InstructionAssertionsForBaseType(&assert_instr, &intrinsic.base_type.as_ref())
+            InstructionAssertionsForBaseType(assert_instr, &intrinsic.base_type.as_ref())
                 .to_tokens(tokens)
         }
     }
@@ -1825,7 +1826,7 @@ fn create_tokens(intrinsic: &Intrinsic, endianness: Endianness, tokens: &mut Tok
 
 impl ToTokens for Intrinsic {
     fn to_tokens(&self, tokens: &mut TokenStream) {
-        if self.big_endian_compose.len() >= 1 {
+        if !self.big_endian_compose.is_empty() {
             for i in 0..2 {
                 match i {
                     0 => create_tokens(self, Endianness::Little, tokens),
diff --git a/library/stdarch/crates/stdarch-gen-arm/src/load_store_tests.rs b/library/stdarch/crates/stdarch-gen-arm/src/load_store_tests.rs
index a238c5fb33c..5cf39b2e11a 100644
--- a/library/stdarch/crates/stdarch-gen-arm/src/load_store_tests.rs
+++ b/library/stdarch/crates/stdarch-gen-arm/src/load_store_tests.rs
@@ -129,6 +129,7 @@ fn generate_single_test(
     let chars = LdIntrCharacteristics::new(&load)?;
     let fn_name = load.signature.fn_name().to_string();
 
+    #[allow(clippy::collapsible_if)]
     if let Some(ty) = &chars.gather_bases_type {
         if ty.base_type().unwrap().get_size() == Ok(32)
             && chars.gather_index_type.is_none()
@@ -372,7 +373,7 @@ fn generate_single_test(
             let create = format_ident!("svcreate{tuple_len}_{acle_type}");
             quote!(#create(#(#expecteds),*))
         };
-        let input = store.input.types.get(0).unwrap().get(0).unwrap();
+        let input = store.input.types.first().unwrap().get(0).unwrap();
         let store_type = input
             .get(store.test.get_typeset_index().unwrap())
             .and_then(InputType::typekind)
@@ -579,7 +580,7 @@ struct LdIntrCharacteristics {
 
 impl LdIntrCharacteristics {
     fn new(intr: &Intrinsic) -> Result<LdIntrCharacteristics, String> {
-        let input = intr.input.types.get(0).unwrap().get(0).unwrap();
+        let input = intr.input.types.first().unwrap().get(0).unwrap();
         let load_type = input
             .get(intr.test.get_typeset_index().unwrap())
             .and_then(InputType::typekind)
diff --git a/library/stdarch/crates/stdarch-gen-arm/src/main.rs b/library/stdarch/crates/stdarch-gen-arm/src/main.rs
index 9ea1917c14f..9bf7d0981de 100644
--- a/library/stdarch/crates/stdarch-gen-arm/src/main.rs
+++ b/library/stdarch/crates/stdarch-gen-arm/src/main.rs
@@ -164,11 +164,11 @@ use stdarch_test::assert_instr;
 use super::*;{uses_neon}
 
 "#,
-        uses_neon = generated_input
-            .ctx
-            .uses_neon_types
-            .then_some("\nuse crate::core_arch::arch::aarch64::*;")
-            .unwrap_or_default(),
+        uses_neon = if generated_input.ctx.uses_neon_types {
+            "\nuse crate::core_arch::arch::aarch64::*;"
+        } else {
+            ""
+        },
     )?;
     let intrinsics = generated_input.intrinsics;
     format_code(out, quote! { #(#intrinsics)* })?;
@@ -198,7 +198,7 @@ pub fn format_code(
 /// Panics if the resulting name is empty, or if file_name() is not UTF-8.
 fn make_output_filepath(in_filepath: &Path, out_dirpath: &Path) -> PathBuf {
     make_filepath(in_filepath, out_dirpath, |_name: &str| {
-        format!("generated.rs")
+        "generated.rs".to_owned()
     })
 }
 
diff --git a/library/stdarch/crates/stdarch-gen-arm/src/typekinds.rs b/library/stdarch/crates/stdarch-gen-arm/src/typekinds.rs
index bf22501b1dd..7c697cb7c0c 100644
--- a/library/stdarch/crates/stdarch-gen-arm/src/typekinds.rs
+++ b/library/stdarch/crates/stdarch-gen-arm/src/typekinds.rs
@@ -135,7 +135,7 @@ pub enum VectorTupleSize {
 }
 
 impl VectorTupleSize {
-    pub fn to_int(&self) -> u32 {
+    pub fn to_int(self) -> u32 {
         match self {
             Self::Two => 2,
             Self::Three => 3,
@@ -453,6 +453,7 @@ impl VectorType {
         is_scalable: bool,
         tuple_size: Option<VectorTupleSize>,
     ) -> VectorType {
+        #[allow(clippy::collapsible_if)]
         if is_scalable {
             if let BaseType::Sized(BaseTypeKind::Bool, size) = base_ty {
                 return Self::make_predicate_from_bitsize(size);
@@ -521,13 +522,12 @@ impl FromStr for VectorType {
                 .transpose()
                 .unwrap();
 
-            let v = Ok(VectorType {
+            Ok(VectorType {
                 base_type,
                 is_scalable: c.name("sv_ty").is_some(),
                 lanes,
                 tuple_size,
-            });
-            return v;
+            })
         } else {
             Err(format!("invalid vector type {s:#?} given"))
         }
diff --git a/library/stdarch/crates/stdarch-gen-arm/src/wildstring.rs b/library/stdarch/crates/stdarch-gen-arm/src/wildstring.rs
index 616c1172d49..4f8cc67f5e0 100644
--- a/library/stdarch/crates/stdarch-gen-arm/src/wildstring.rs
+++ b/library/stdarch/crates/stdarch-gen-arm/src/wildstring.rs
@@ -66,7 +66,7 @@ impl WildString {
         self.0.is_empty()
     }
 
-    pub fn replace<'a, P>(&'a self, from: P, to: &str) -> WildString
+    pub fn replace<P>(&self, from: P, to: &str) -> WildString
     where
         P: Pattern + Copy,
     {