diff options
| author | Henry Gressmann <mail@henrygressmann.de> | 2023-12-05 23:45:45 +0100 |
|---|---|---|
| committer | Henry Gressmann <mail@henrygressmann.de> | 2023-12-05 23:45:45 +0100 |
| commit | ef4dbf261d13a72931887dad8db02d53a695a810 (patch) | |
| tree | 5158792703337483594ceb49e50e9c00b83f0b16 /crates/parser/src/module.rs | |
| parent | 15c7ec404c0e4c6aa8829ac6b2d13a6e11cddd9a (diff) | |
feat: block stack, make cargofmt a bit more sane
Signed-off-by: Henry Gressmann <mail@henrygressmann.de>
Diffstat (limited to 'crates/parser/src/module.rs')
| -rw-r--r-- | crates/parser/src/module.rs | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/crates/parser/src/module.rs b/crates/parser/src/module.rs index 2beba9e..5bdbcd8 100644 --- a/crates/parser/src/module.rs +++ b/crates/parser/src/module.rs @@ -58,18 +58,12 @@ impl ModuleReader { use wasmparser::Payload::*; match payload { - Version { - num, - encoding, - range, - } => { + Version { num, encoding, range } => { validator.version(num, encoding, &range)?; self.version = Some(num); match encoding { wasmparser::Encoding::Module => {} - wasmparser::Encoding::Component => { - return Err(ParseError::InvalidEncoding(encoding)) - } + wasmparser::Encoding::Component => return Err(ParseError::InvalidEncoding(encoding)), } } StartSection { func, range } => { @@ -88,10 +82,7 @@ impl ModuleReader { FunctionSection(reader) => { debug!("Found function section"); validator.function_section(&reader)?; - self.function_section = reader - .into_iter() - .map(|f| Ok(f?)) - .collect::<Result<Vec<_>>>()?; + self.function_section = reader.into_iter().map(|f| Ok(f?)).collect::<Result<Vec<_>>>()?; } TableSection(_reader) => { return Err(ParseError::UnsupportedSection("Table section".into())); @@ -135,8 +126,7 @@ impl ModuleReader { debug!("Found code section entry"); validator.code_section_entry(&function)?; - self.code_section - .push(conversion::convert_module_code(function)?); + self.code_section.push(conversion::convert_module_code(function)?); } ImportSection(_reader) => { return Err(ParseError::UnsupportedSection("Import section".into())); @@ -166,9 +156,7 @@ impl ModuleReader { debug!("Found custom section"); debug!("Skipping custom section: {:?}", reader.name()); } - UnknownSection { .. } => { - return Err(ParseError::UnsupportedSection("Unknown section".into())) - } + UnknownSection { .. } => return Err(ParseError::UnsupportedSection("Unknown section".into())), section => { return Err(ParseError::UnsupportedSection(format!( "Unsupported section: {:?}", |
