From 246c54041a04c995fdc471598ae8799d7fc9b95f Mon Sep 17 00:00:00 2001 From: wucke13 Date: Wed, 17 Jul 2024 10:02:42 +0200 Subject: [PATCH] fix: all cargo doc warnings Signed-off-by: wucke13 --- src/core/reader/types/mod.rs | 14 +++++++------- src/core/reader/types/values.rs | 12 ++++++------ tests/start_function.rs | 4 ++-- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/core/reader/types/mod.rs b/src/core/reader/types/mod.rs index 5a6c2c14..7a94699d 100644 --- a/src/core/reader/types/mod.rs +++ b/src/core/reader/types/mod.rs @@ -1,4 +1,4 @@ -//! Methods to read WASM Types from a [Wasm] object. +//! Methods to read WASM Types from a [WasmReader] object. //! //! See: @@ -18,7 +18,7 @@ pub mod memarg; pub mod opcode; pub mod values; -/// https://webassembly.github.io/spec/core/binary/types.html#number-types +/// #[derive(Debug, Copy, Clone, PartialEq, Eq)] pub enum NumType { I32, @@ -55,7 +55,7 @@ impl WasmReadable for NumType { } } -/// https://webassembly.github.io/spec/core/binary/types.html#vector-types +/// struct VecType; impl WasmReadable for VecType { @@ -77,7 +77,7 @@ impl WasmReadable for VecType { } } -/// https://webassembly.github.io/spec/core/binary/types.html#reference-types +/// #[derive(Debug, Copy, Clone, PartialEq, Eq)] pub enum RefType { FuncRef, @@ -105,7 +105,7 @@ impl WasmReadable for RefType { } } -/// https://webassembly.github.io/spec/core/binary/types.html#reference-types +/// /// TODO flatten [NumType] and [RefType] enums, as they are not used individually and `wasmparser` also does it. #[derive(Debug, Copy, Clone, PartialEq, Eq)] #[allow(clippy::all)] @@ -147,7 +147,7 @@ impl WasmReadable for ValType { } } -/// https://webassembly.github.io/spec/core/binary/types.html#value-types +/// #[derive(Debug, Clone, PartialEq, Eq)] pub struct ResultType { pub valtypes: Vec, @@ -169,7 +169,7 @@ impl WasmReadable for ResultType { } } -/// https://webassembly.github.io/spec/core/binary/types.html#function-types +/// #[derive(Debug, Clone, PartialEq, Eq)] pub struct FuncType { pub params: ResultType, diff --git a/src/core/reader/types/values.rs b/src/core/reader/types/values.rs index 35a1eece..a5759813 100644 --- a/src/core/reader/types/values.rs +++ b/src/core/reader/types/values.rs @@ -1,8 +1,8 @@ -//! Methods to read basic WASM Values from a [Wasm] object. +//! Methods to read basic WASM Values from a [WasmReader] object. //! //! See: //! -//! Note: If any of these methods return `Err`, they may have consumed some bytes from the [Wasm] object and thus consequent calls may result in unexpected behaviour. +//! Note: If any of these methods return `Err`, they may have consumed some bytes from the [WasmReader] object and thus consequent calls may result in unexpected behaviour. //! This is due to the fact that these methods read elemental types which cannot be split. use alloc::vec::Vec; @@ -12,7 +12,7 @@ use crate::core::reader::WasmReader; use crate::{Error, Result}; impl WasmReader<'_> { - /// Note: If `Err`, the [Wasm] object is no longer guaranteed to be in a valid state + /// Note: If `Err`, the [WasmReader] object is no longer guaranteed to be in a valid state pub fn read_u8(&mut self) -> Result { let value = *self.current.first().ok_or(Error::Eof)?; @@ -25,7 +25,7 @@ impl WasmReader<'_> { } /// Parses a variable-length `u32` as specified by [LEB128](https://en.wikipedia.org/wiki/LEB128#Unsigned_LEB128). - /// Note: If `Err`, the [Wasm] object is no longer guaranteed to be in a valid state + /// Note: If `Err`, the [WasmReader] object is no longer guaranteed to be in a valid state pub fn read_var_u32(&mut self) -> Result { let mut result: u32 = 0; let mut shift: u32 = 0; @@ -62,7 +62,7 @@ impl WasmReader<'_> { Ok(result) } - /// Note: If `Err`, the [Wasm] object is no longer guaranteed to be in a valid state + /// Note: If `Err`, the [WasmReader] object is no longer guaranteed to be in a valid state pub fn read_name(&mut self) -> Result<&str> { let len = self.read_var_u32()? as usize; @@ -87,7 +87,7 @@ impl WasmReader<'_> { }) } - /// Note: If `Err`, the [Wasm] object is no longer guaranteed to be in a valid state + /// Note: If `Err`, the [WasmReader] object is no longer guaranteed to be in a valid state pub fn read_vec(&mut self, mut read_element: F) -> Result> where F: FnMut(&mut WasmReader) -> Result, diff --git a/tests/start_function.rs b/tests/start_function.rs index d1a3e6bb..d957ae25 100644 --- a/tests/start_function.rs +++ b/tests/start_function.rs @@ -1,5 +1,5 @@ -/// The WASM program stores 42 into linear memory upon instantiation through a start function. -/// Then it reads the same value and checks its value. +//! The WASM program stores 42 into linear memory upon instantiation through a start function. +//! Then it reads the same value and checks its value. #[test_log::test] fn start_function() { use wasm::{validate, RuntimeInstance};