Skip to content

Commit 4a9a19b

Browse files
committed
const folding: silence clippy in macro
1 parent d300cda commit 4a9a19b

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

crates/rustc_codegen_spirv/src/builder/builder_methods.rs

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -192,19 +192,21 @@ macro_rules! simple_uni_op {
192192
fn $func_name(&mut self, val: Self::Value) -> Self::Value {
193193
let result_type = val.ty;
194194

195-
$(if let Some(const_val) = self.try_get_const_int_value(val) {
196-
#[allow(unreachable_patterns)]
197-
match const_val {
198-
$(
199-
ConstValue::Unsigned($int_val) => return self.const_uint_big(result_type, $fold_int),
200-
ConstValue::Signed($int_val) => return self.const_uint_big(result_type, $fold_int as u128),
201-
)?
202-
$(ConstValue::Unsigned($uint_val) => return self.const_uint_big(result_type, $fold_uint), )?
203-
$(ConstValue::Signed($sint_val) => return self.const_uint_big(result_type, $fold_sint as u128), )?
204-
$(ConstValue::Bool($bool_val) => return self.const_uint_big(result_type, ($fold_bool).into()), )?
205-
_ => (),
195+
$(
196+
#[allow(unreachable_patterns, clippy::collapsible_match)]
197+
if let Some(const_val) = self.try_get_const_int_value(val) {
198+
match const_val {
199+
$(
200+
ConstValue::Unsigned($int_val) => return self.const_uint_big(result_type, $fold_int),
201+
ConstValue::Signed($int_val) => return self.const_uint_big(result_type, $fold_int as u128),
202+
)?
203+
$(ConstValue::Unsigned($uint_val) => return self.const_uint_big(result_type, $fold_uint), )?
204+
$(ConstValue::Signed($sint_val) => return self.const_uint_big(result_type, $fold_sint as u128), )?
205+
$(ConstValue::Bool($bool_val) => return self.const_uint_big(result_type, ($fold_bool).into()), )?
206+
_ => (),
207+
}
206208
}
207-
})?
209+
)?
208210

209211
match self.lookup_type(result_type) {
210212
$(SpirvType::Integer(_, _) => {

0 commit comments

Comments
 (0)