summaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorHenry Gressmann <mail@henrygressmann.de>2024-08-01 19:56:51 +0200
committerHenry Gressmann <mail@henrygressmann.de>2024-08-01 19:56:51 +0200
commitd33a0c66a17316755e572b3620fb030ec1e52f61 (patch)
tree12e761d23dd0c15341d1142e708c1177873a92d6 /crates
parentad47fb727e90ebe1fae991e08ea7dfcb907c15f7 (diff)
chore: enable unnecessarily disabled clippy rules
(detection has been fixed upstream) Signed-off-by: Henry Gressmann <mail@henrygressmann.de>
Diffstat (limited to 'crates')
-rw-r--r--crates/tinywasm/src/interpreter/values.rs10
-rw-r--r--crates/tinywasm/src/lib.rs1
-rw-r--r--crates/tinywasm/tests/testsuite/mod.rs2
3 files changed, 9 insertions, 4 deletions
diff --git a/crates/tinywasm/src/interpreter/values.rs b/crates/tinywasm/src/interpreter/values.rs
index 35341fc..b35f481 100644
--- a/crates/tinywasm/src/interpreter/values.rs
+++ b/crates/tinywasm/src/interpreter/values.rs
@@ -1,4 +1,3 @@
-#![allow(missing_docs)]
use crate::Result;
use tinywasm_types::{LocalAddr, ValType, WasmValue};
@@ -12,9 +11,13 @@ pub(crate) type ValueRef = Option<u32>;
#[derive(Debug, Clone, Copy, PartialEq)]
/// A untyped WebAssembly value
pub enum TinyWasmValue {
+ /// A 32-bit value
Value32(Value32),
+ /// A 64-bit value
Value64(Value64),
+ /// A 128-bit value
Value128(Value128),
+ /// A reference value
ValueRef(ValueRef),
}
@@ -64,6 +67,7 @@ impl From<&[ValType]> for StackHeight {
}
impl TinyWasmValue {
+ /// Asserts that the value is a 32-bit value and returns it (panics if the value is the wrong size)
pub fn unwrap_32(&self) -> Value32 {
match self {
TinyWasmValue::Value32(v) => *v,
@@ -71,6 +75,7 @@ impl TinyWasmValue {
}
}
+ /// Asserts that the value is a 64-bit value and returns it (panics if the value is the wrong size)
pub fn unwrap_64(&self) -> Value64 {
match self {
TinyWasmValue::Value64(v) => *v,
@@ -78,6 +83,7 @@ impl TinyWasmValue {
}
}
+ /// Asserts that the value is a 128-bit value and returns it (panics if the value is the wrong size)
pub fn unwrap_128(&self) -> Value128 {
match self {
TinyWasmValue::Value128(v) => *v,
@@ -85,6 +91,7 @@ impl TinyWasmValue {
}
}
+ /// Asserts that the value is a reference value and returns it (panics if the value is the wrong size)
pub fn unwrap_ref(&self) -> ValueRef {
match self {
TinyWasmValue::ValueRef(v) => *v,
@@ -92,6 +99,7 @@ impl TinyWasmValue {
}
}
+ /// Attaches a type to the value (panics if the size of the value is not the same as the type)
pub fn attach_type(&self, ty: ValType) -> WasmValue {
match ty {
ValType::I32 => WasmValue::I32(self.unwrap_32() as i32),
diff --git a/crates/tinywasm/src/lib.rs b/crates/tinywasm/src/lib.rs
index 1bb257d..f53f4c6 100644
--- a/crates/tinywasm/src/lib.rs
+++ b/crates/tinywasm/src/lib.rs
@@ -3,7 +3,6 @@
no_crate_inject,
attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_assignments, unused_variables))
))]
-#![allow(unexpected_cfgs, clippy::reserve_after_initialization)]
#![warn(missing_docs, missing_debug_implementations, rust_2018_idioms, unreachable_pub)]
#![cfg_attr(feature = "nightly", feature(portable_simd))]
#![forbid(unsafe_code)]
diff --git a/crates/tinywasm/tests/testsuite/mod.rs b/crates/tinywasm/tests/testsuite/mod.rs
index 35f0607..350a1b9 100644
--- a/crates/tinywasm/tests/testsuite/mod.rs
+++ b/crates/tinywasm/tests/testsuite/mod.rs
@@ -1,5 +1,3 @@
-#![allow(dead_code)] // rust analyzer doesn't recognize that code is used by tests without harness
-
use eyre::Result;
use owo_colors::OwoColorize;
use std::io::{BufRead, Seek, SeekFrom};