From a3b41ed9598c0c7c13dc945e66129b7e6f468b77 Mon Sep 17 00:00:00 2001 From: Markus Siglreithmaier Date: Wed, 22 Nov 2023 00:42:59 +0100 Subject: [PATCH] Address CI failures (#247) --- autogen/src/binary.rs | 4 ++-- autogen/src/dr.rs | 2 +- rspirv/dr/constructs.rs | 6 ++++-- rspirv/lift/mod.rs | 6 +++++- rspirv/sr/storage.rs | 5 +---- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/autogen/src/binary.rs b/autogen/src/binary.rs index b1941867..bed9d061 100644 --- a/autogen/src/binary.rs +++ b/autogen/src/binary.rs @@ -237,7 +237,7 @@ pub fn gen_operand_parse_methods(grammar: &[structs::OperandKind]) -> TokenStrea // Logic operands that expand to concrete operand pairs, // that is, those operand kinds with 'Pair' name prefix. // We only have two cases. So hard code it. - let pair_kinds = vec![("IdRef", "LiteralInteger"), ("IdRef", "IdRef")]; + let pair_kinds = [("IdRef", "LiteralInteger"), ("IdRef", "IdRef")]; let pair_cases = pair_kinds.iter().map(|&(k0, k1)| { let kind = as_ident(&format!("Pair{}{}", k0, k1)); let kind0 = get_dr_operand_kind(k0); @@ -253,7 +253,7 @@ pub fn gen_operand_parse_methods(grammar: &[structs::OperandKind]) -> TokenStrea }); // These kinds are manually handled. - let manual_kinds = vec![ + let manual_kinds = [ "IdResultType", "IdResult", "LiteralContextDependentNumber", diff --git a/autogen/src/dr.rs b/autogen/src/dr.rs index 620ca540..cb686c25 100644 --- a/autogen/src/dr.rs +++ b/autogen/src/dr.rs @@ -281,7 +281,7 @@ pub fn gen_dr_operand_kinds(grammar: &[structs::OperandKind]) -> TokenStream { enum_kinds .chain(id_kinds) - .chain(num_kinds.into_iter()) + .chain(num_kinds) .chain(str_kinds) .collect::>() }; diff --git a/rspirv/dr/constructs.rs b/rspirv/dr/constructs.rs index 759b73d0..4e2fcf3d 100644 --- a/rspirv/dr/constructs.rs +++ b/rspirv/dr/constructs.rs @@ -392,9 +392,11 @@ mod tests { assert_eq!( format!( "{}", - dr::Operand::FunctionControl(spirv::FunctionControl::INLINE) + dr::Operand::FunctionControl( + spirv::FunctionControl::INLINE | spirv::FunctionControl::CONST + ) ), - "INLINE", + "FunctionControl(INLINE | CONST)", ); assert_eq!(format!("{}", dr::Operand::IdRef(3)), "%3"); assert_eq!(format!("{}", dr::Operand::LiteralBit32(3)), "3"); diff --git a/rspirv/lift/mod.rs b/rspirv/lift/mod.rs index 337db0df..af4de1f7 100644 --- a/rspirv/lift/mod.rs +++ b/rspirv/lift/mod.rs @@ -188,7 +188,11 @@ impl LiftContext { let start_label = fun.blocks[0].label.as_ref().unwrap().result_id.unwrap(); let start_block = context.blocks.lookup_token(start_label); let blocks = mem::replace(&mut context.blocks, LiftStorage::new()).unwrap(); - let fun_ret = fun.def.as_ref().and_then(|d| d.result_type).expect("functions must have a result type"); + let fun_ret = fun + .def + .as_ref() + .and_then(|d| d.result_type) + .expect("functions must have a result type"); functions.push(module::Function { control: def.function_control, diff --git a/rspirv/sr/storage.rs b/rspirv/sr/storage.rs index d9a31461..4055f2d1 100644 --- a/rspirv/sr/storage.rs +++ b/rspirv/sr/storage.rs @@ -16,10 +16,7 @@ pub struct Token { impl Clone for Token { fn clone(&self) -> Self { - Token { - index: self.index, - marker: self.marker, - } + *self } } impl Copy for Token {}