Skip to content

Commit 04edcff

Browse files
authored
Remove dead code (#4300)
1 parent 8fe5bf1 commit 04edcff

File tree

4 files changed

+6
-13
lines changed

4 files changed

+6
-13
lines changed

crates/cli-support/src/js/binding.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1246,7 +1246,6 @@ fn instruction(
12461246

12471247
Instruction::CachedStringLoad {
12481248
owned,
1249-
optional: _,
12501249
mem,
12511250
free,
12521251
table,

crates/cli-support/src/wit/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1205,7 +1205,7 @@ impl<'a> Context<'a> {
12051205
kind: AdapterJsImportKind,
12061206
) -> Result<AdapterId, Error> {
12071207
let import = self.module.imports.get(import);
1208-
let (import_module, import_name) = (import.module.clone(), import.name.clone());
1208+
let import_name = import.name.clone();
12091209
let import_id = import.id();
12101210
let core_id = match import.kind {
12111211
walrus::ImportKind::Function(f) => f,
@@ -1242,7 +1242,6 @@ impl<'a> Context<'a> {
12421242
ret.input,
12431243
vec![],
12441244
AdapterKind::Import {
1245-
module: import_module,
12461245
name: import_name,
12471246
kind,
12481247
},

crates/cli-support/src/wit/outgoing.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ impl InstructionBuilder<'_, '_> {
110110
Descriptor::Ref(d) => self.outgoing_ref(false, d)?,
111111
Descriptor::RefMut(d) => self.outgoing_ref(true, d)?,
112112

113-
Descriptor::CachedString => self.cached_string(false, true)?,
113+
Descriptor::CachedString => self.cached_string(true)?,
114114

115115
Descriptor::String => {
116116
// fetch the ptr/length ...
@@ -193,7 +193,7 @@ impl InstructionBuilder<'_, '_> {
193193
&[AdapterType::NamedExternref(name.clone())],
194194
);
195195
}
196-
Descriptor::CachedString => self.cached_string(false, false)?,
196+
Descriptor::CachedString => self.cached_string(false)?,
197197

198198
Descriptor::String => {
199199
self.instruction(
@@ -335,7 +335,7 @@ impl InstructionBuilder<'_, '_> {
335335
Descriptor::Ref(d) => self.outgoing_option_ref(false, d)?,
336336
Descriptor::RefMut(d) => self.outgoing_option_ref(true, d)?,
337337

338-
Descriptor::CachedString => self.cached_string(true, true)?,
338+
Descriptor::CachedString => self.cached_string(true)?,
339339

340340
Descriptor::String | Descriptor::Vector(_) => {
341341
let kind = arg.vector_kind().ok_or_else(|| {
@@ -525,7 +525,7 @@ impl InstructionBuilder<'_, '_> {
525525
&[AdapterType::NamedExternref(name.clone()).option()],
526526
);
527527
}
528-
Descriptor::CachedString => self.cached_string(true, false)?,
528+
Descriptor::CachedString => self.cached_string(false)?,
529529
Descriptor::String | Descriptor::Slice(_) => {
530530
let kind = arg.vector_kind().ok_or_else(|| {
531531
format_err!(
@@ -574,14 +574,13 @@ impl InstructionBuilder<'_, '_> {
574574
self.instruction(&[AdapterType::I64], instr, &[output]);
575575
}
576576

577-
fn cached_string(&mut self, optional: bool, owned: bool) -> Result<(), Error> {
577+
fn cached_string(&mut self, owned: bool) -> Result<(), Error> {
578578
let mem = self.cx.memory()?;
579579
let free = self.cx.free()?;
580580
self.instruction(
581581
&[AdapterType::I32, AdapterType::I32],
582582
Instruction::CachedStringLoad {
583583
owned,
584-
optional,
585584
mem,
586585
free,
587586
table: None,

crates/cli-support/src/wit/standard.rs

-4
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ pub enum AdapterKind {
4040
instructions: Vec<InstructionData>,
4141
},
4242
Import {
43-
#[allow(dead_code)]
44-
module: String,
4543
name: String,
4644
kind: AdapterJsImportKind,
4745
},
@@ -314,8 +312,6 @@ pub enum Instruction {
314312
/// pops ptr/length i32, loads string from cache
315313
CachedStringLoad {
316314
owned: bool,
317-
#[allow(dead_code)]
318-
optional: bool,
319315
mem: walrus::MemoryId,
320316
free: walrus::FunctionId,
321317
/// If we're in reference-types mode, the externref table ID to get the cached string from.

0 commit comments

Comments
 (0)