Skip to content

Commit 45c740b

Browse files
chore: cleanup clippy errors
Signed-off-by: Henry Gressmann <[email protected]>
1 parent c25e79b commit 45c740b

File tree

7 files changed

+38
-38
lines changed

7 files changed

+38
-38
lines changed

Cargo.lock

Lines changed: 15 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/tinywasm/src/runtime/executor/mod.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ use super::{DefaultRuntime, Stack};
22
use crate::{
33
get_label_args,
44
log::debug,
5-
runtime::{BlockType, LabelFrame, RawWasmValue},
5+
runtime::{BlockType, LabelFrame},
66
CallFrame, Error, ModuleInstance, Result, Store,
77
};
88
use alloc::vec::Vec;
99
use log::info;
10-
use tinywasm_types::{BlockArgs, FuncType, Instruction, ValType};
10+
use tinywasm_types::Instruction;
1111

1212
mod macros;
1313
use macros::*;
@@ -143,7 +143,7 @@ fn exec_one(
143143
instr_ptr: cf.instr_ptr,
144144
end_instr_ptr: cf.instr_ptr + *end_offset,
145145
stack_ptr: stack.values.len(), // - params,
146-
args: get_label_args(*args, &module)?,
146+
args: get_label_args(*args, module)?,
147147
ty: BlockType::If,
148148
},
149149
&mut stack.values,
@@ -158,7 +158,7 @@ fn exec_one(
158158
instr_ptr: cf.instr_ptr,
159159
end_instr_ptr: cf.instr_ptr + *end_offset,
160160
stack_ptr: stack.values.len(), // - params,
161-
args: get_label_args(*args, &module)?,
161+
args: get_label_args(*args, module)?,
162162
ty: BlockType::Loop,
163163
},
164164
&mut stack.values,
@@ -172,7 +172,7 @@ fn exec_one(
172172
instr_ptr: cf.instr_ptr,
173173
end_instr_ptr: cf.instr_ptr + *end_offset,
174174
stack_ptr: stack.values.len(), //- params,
175-
args: get_label_args(*args, &module)?,
175+
args: get_label_args(*args, module)?,
176176
ty: BlockType::Block,
177177
},
178178
&mut stack.values,
@@ -195,10 +195,10 @@ fn exec_one(
195195
todo!()
196196
}
197197

198-
Br(v) => cf.break_to(*v, &mut stack.values, module)?,
198+
Br(v) => cf.break_to(*v, &mut stack.values)?,
199199
BrIf(v) => {
200200
if stack.values.pop_t::<i32>()? > 0 {
201-
cf.break_to(*v, &mut stack.values, module)?
201+
cf.break_to(*v, &mut stack.values)?
202202
};
203203
}
204204

crates/tinywasm/src/runtime/stack/blocks.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use alloc::vec::Vec;
22
use log::info;
3-
use tinywasm_types::{BlockArgs, FuncType};
3+
use tinywasm_types::BlockArgs;
44

55
use crate::{ModuleInstance, Result};
66

@@ -65,15 +65,15 @@ pub(crate) enum BlockType {
6565
}
6666

6767
#[derive(Debug, Clone)]
68-
pub struct LabelArgs {
69-
pub params: usize,
70-
pub results: usize,
68+
pub(crate) struct LabelArgs {
69+
pub(crate) params: usize,
70+
pub(crate) results: usize,
7171
}
7272

73-
pub fn get_label_args(args: BlockArgs, module: &ModuleInstance) -> Result<LabelArgs> {
73+
pub(crate) fn get_label_args(args: BlockArgs, module: &ModuleInstance) -> Result<LabelArgs> {
7474
Ok(match args {
7575
BlockArgs::Empty => LabelArgs { params: 0, results: 0 },
76-
BlockArgs::Type(t) => LabelArgs { params: 0, results: 1 },
76+
BlockArgs::Type(_) => LabelArgs { params: 0, results: 1 },
7777
BlockArgs::FuncType(t) => LabelArgs {
7878
params: module.func_ty(t).params.len(),
7979
results: module.func_ty(t).results.len(),

crates/tinywasm/src/runtime/stack/call_stack.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
use crate::{runtime::RawWasmValue, BlockType, Error, LabelFrame, ModuleInstance, Result};
1+
use crate::{runtime::RawWasmValue, BlockType, Error, LabelFrame, Result};
22
use alloc::{boxed::Box, vec::Vec};
3-
use log::{debug, info};
4-
use tinywasm_types::{BlockArgs, ValType, WasmValue};
3+
use tinywasm_types::{ValType, WasmValue};
54

65
use super::blocks::Labels;
76

@@ -91,12 +90,7 @@ impl CallFrame {
9190

9291
/// Break to a block at the given index (relative to the current frame)
9392
#[inline]
94-
pub(crate) fn break_to(
95-
&mut self,
96-
break_to_relative: u32,
97-
value_stack: &mut super::ValueStack,
98-
module: &ModuleInstance,
99-
) -> Result<()> {
93+
pub(crate) fn break_to(&mut self, break_to_relative: u32, value_stack: &mut super::ValueStack) -> Result<()> {
10094
let current_label = self.labels.top().ok_or(Error::LabelStackUnderflow)?;
10195
let break_to = self
10296
.labels

crates/tinywasm/src/runtime/stack/value_stack.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
use core::ops::Range;
22

3-
use crate::{runtime::RawWasmValue, Error, ModuleInstance, Result};
3+
use crate::{runtime::RawWasmValue, Error, Result};
44
use alloc::vec::Vec;
55
use log::info;
6-
use tinywasm_types::BlockArgs;
76

87
// minimum stack size
98
pub(crate) const STACK_SIZE: usize = 1024;
@@ -44,7 +43,7 @@ impl ValueStack {
4443
}
4544

4645
#[inline]
47-
pub(crate) fn truncate(&mut self, n: usize) {
46+
pub(crate) fn _truncate(&mut self, n: usize) {
4847
assert!(self.top <= self.stack.len());
4948
self.top -= n;
5049
self.stack.truncate(self.top);
@@ -65,7 +64,7 @@ impl ValueStack {
6564
}
6665

6766
#[inline]
68-
pub(crate) fn extend(&mut self, values: impl IntoIterator<Item = RawWasmValue> + ExactSizeIterator) {
67+
pub(crate) fn _extend(&mut self, values: impl IntoIterator<Item = RawWasmValue> + ExactSizeIterator) {
6968
self.top += values.len();
7069
self.stack.extend(values);
7170
}
@@ -125,7 +124,7 @@ mod tests {
125124

126125
fn crate_stack<T: Into<RawWasmValue> + Copy>(data: &[T]) -> ValueStack {
127126
let mut stack = ValueStack::default();
128-
stack.extend(data.iter().map(|v| (*v).into()));
127+
stack._extend(data.iter().map(|v| (*v).into()));
129128
stack
130129
}
131130

0 commit comments

Comments
 (0)