diff options
Diffstat (limited to 'crates/parser')
| -rw-r--r-- | crates/parser/Cargo.toml | 2 | ||||
| -rw-r--r-- | crates/parser/src/module.rs | 2 | ||||
| -rw-r--r-- | crates/parser/src/visit.rs | 18 |
3 files changed, 10 insertions, 12 deletions
diff --git a/crates/parser/Cargo.toml b/crates/parser/Cargo.toml index 7bd9cad..3cbeee1 100644 --- a/crates/parser/Cargo.toml +++ b/crates/parser/Cargo.toml @@ -7,6 +7,8 @@ license.workspace=true authors.workspace=true repository.workspace=true rust-version.workspace=true +keywords.workspace=true +categories.workspace=true [dependencies] wasmparser={workspace=true, features=["validate", "features", "simd"]} diff --git a/crates/parser/src/module.rs b/crates/parser/src/module.rs index 3a3becd..1651bf0 100644 --- a/crates/parser/src/module.rs +++ b/crates/parser/src/module.rs @@ -30,7 +30,7 @@ pub(crate) struct ModuleReader { } impl ModuleReader { - pub(crate) fn new() -> ModuleReader { + pub(crate) fn new() -> Self { Self::default() } diff --git a/crates/parser/src/visit.rs b/crates/parser/src/visit.rs index 1635d2d..4ae2cc1 100644 --- a/crates/parser/src/visit.rs +++ b/crates/parser/src/visit.rs @@ -370,17 +370,13 @@ impl<'a, R: WasmModuleResources> wasmparser::VisitOperator<'a> for FunctionBuild let if_instruction = &mut self.instructions[if_label_pointer]; - let (else_offset, end_offset) = match if_instruction { - Instruction::If(else_offset, end_offset) - | Instruction::IfWithFuncType(_, else_offset, end_offset) - | Instruction::IfWithType(_, else_offset, end_offset) => (else_offset, end_offset), - _ => { - self.errors.push(crate::ParseError::UnsupportedOperator( - "Expected to end an if block, but the last label was not an if".to_string(), - )); - - return; - } + let (Instruction::If(else_offset, end_offset) + | Instruction::IfWithFuncType(_, else_offset, end_offset) + | Instruction::IfWithType(_, else_offset, end_offset)) = if_instruction + else { + return self.errors.push(crate::ParseError::UnsupportedOperator( + "Expected to end an if block, but the last label was not an if".to_string(), + )); }; *else_offset = (label_pointer - if_label_pointer) |
