From ef4dbf261d13a72931887dad8db02d53a695a810 Mon Sep 17 00:00:00 2001 From: Henry Gressmann Date: Tue, 5 Dec 2023 23:45:45 +0100 Subject: feat: block stack, make cargofmt a bit more sane Signed-off-by: Henry Gressmann --- crates/parser/src/lib.rs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'crates/parser/src/lib.rs') diff --git a/crates/parser/src/lib.rs b/crates/parser/src/lib.rs index fdfea49..31e8cc8 100644 --- a/crates/parser/src/lib.rs +++ b/crates/parser/src/lib.rs @@ -38,14 +38,10 @@ impl Parser { } #[cfg(feature = "std")] - pub fn parse_module_file( - &self, - path: impl AsRef + Clone, - ) -> Result { + pub fn parse_module_file(&self, path: impl AsRef + Clone) -> Result { use alloc::format; - let f = crate::std::fs::File::open(path.clone()).map_err(|e| { - ParseError::Other(format!("Error opening file {:?}: {}", path.as_ref(), e)) - })?; + let f = crate::std::fs::File::open(path.clone()) + .map_err(|e| ParseError::Other(format!("Error opening file {:?}: {}", path.as_ref(), e)))?; let mut reader = crate::std::io::BufReader::new(f); self.parse_module_stream(&mut reader) @@ -66,9 +62,9 @@ impl Parser { wasmparser::Chunk::NeedMoreData(hint) => { let len = buffer.len(); buffer.extend((0..hint).map(|_| 0u8)); - let read_bytes = stream.read(&mut buffer[len..]).map_err(|e| { - ParseError::Other(format!("Error reading from stream: {}", e)) - })?; + let read_bytes = stream + .read(&mut buffer[len..]) + .map_err(|e| ParseError::Other(format!("Error reading from stream: {}", e)))?; buffer.truncate(len + read_bytes); eof = read_bytes == 0; } -- cgit v1.3.1