From 04edcff48c3b7c37ecd680f0c91baa39088d993a Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sat, 7 Dec 2024 00:38:24 +0100 Subject: [PATCH] Remove dead code (#4300) --- crates/cli-support/src/js/binding.rs | 1 - crates/cli-support/src/wit/mod.rs | 3 +-- crates/cli-support/src/wit/outgoing.rs | 11 +++++------ crates/cli-support/src/wit/standard.rs | 4 ---- 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/crates/cli-support/src/js/binding.rs b/crates/cli-support/src/js/binding.rs index d5ed01363ad..54be1481163 100644 --- a/crates/cli-support/src/js/binding.rs +++ b/crates/cli-support/src/js/binding.rs @@ -1246,7 +1246,6 @@ fn instruction( Instruction::CachedStringLoad { owned, - optional: _, mem, free, table, diff --git a/crates/cli-support/src/wit/mod.rs b/crates/cli-support/src/wit/mod.rs index 07fb5090a78..930fddca566 100644 --- a/crates/cli-support/src/wit/mod.rs +++ b/crates/cli-support/src/wit/mod.rs @@ -1205,7 +1205,7 @@ impl<'a> Context<'a> { kind: AdapterJsImportKind, ) -> Result { let import = self.module.imports.get(import); - let (import_module, import_name) = (import.module.clone(), import.name.clone()); + let import_name = import.name.clone(); let import_id = import.id(); let core_id = match import.kind { walrus::ImportKind::Function(f) => f, @@ -1242,7 +1242,6 @@ impl<'a> Context<'a> { ret.input, vec![], AdapterKind::Import { - module: import_module, name: import_name, kind, }, diff --git a/crates/cli-support/src/wit/outgoing.rs b/crates/cli-support/src/wit/outgoing.rs index ba15babf5c9..b5eaeefa84b 100644 --- a/crates/cli-support/src/wit/outgoing.rs +++ b/crates/cli-support/src/wit/outgoing.rs @@ -110,7 +110,7 @@ impl InstructionBuilder<'_, '_> { Descriptor::Ref(d) => self.outgoing_ref(false, d)?, Descriptor::RefMut(d) => self.outgoing_ref(true, d)?, - Descriptor::CachedString => self.cached_string(false, true)?, + Descriptor::CachedString => self.cached_string(true)?, Descriptor::String => { // fetch the ptr/length ... @@ -193,7 +193,7 @@ impl InstructionBuilder<'_, '_> { &[AdapterType::NamedExternref(name.clone())], ); } - Descriptor::CachedString => self.cached_string(false, false)?, + Descriptor::CachedString => self.cached_string(false)?, Descriptor::String => { self.instruction( @@ -335,7 +335,7 @@ impl InstructionBuilder<'_, '_> { Descriptor::Ref(d) => self.outgoing_option_ref(false, d)?, Descriptor::RefMut(d) => self.outgoing_option_ref(true, d)?, - Descriptor::CachedString => self.cached_string(true, true)?, + Descriptor::CachedString => self.cached_string(true)?, Descriptor::String | Descriptor::Vector(_) => { let kind = arg.vector_kind().ok_or_else(|| { @@ -525,7 +525,7 @@ impl InstructionBuilder<'_, '_> { &[AdapterType::NamedExternref(name.clone()).option()], ); } - Descriptor::CachedString => self.cached_string(true, false)?, + Descriptor::CachedString => self.cached_string(false)?, Descriptor::String | Descriptor::Slice(_) => { let kind = arg.vector_kind().ok_or_else(|| { format_err!( @@ -574,14 +574,13 @@ impl InstructionBuilder<'_, '_> { self.instruction(&[AdapterType::I64], instr, &[output]); } - fn cached_string(&mut self, optional: bool, owned: bool) -> Result<(), Error> { + fn cached_string(&mut self, owned: bool) -> Result<(), Error> { let mem = self.cx.memory()?; let free = self.cx.free()?; self.instruction( &[AdapterType::I32, AdapterType::I32], Instruction::CachedStringLoad { owned, - optional, mem, free, table: None, diff --git a/crates/cli-support/src/wit/standard.rs b/crates/cli-support/src/wit/standard.rs index b0b1cb6832e..8b3780f37fb 100644 --- a/crates/cli-support/src/wit/standard.rs +++ b/crates/cli-support/src/wit/standard.rs @@ -40,8 +40,6 @@ pub enum AdapterKind { instructions: Vec, }, Import { - #[allow(dead_code)] - module: String, name: String, kind: AdapterJsImportKind, }, @@ -314,8 +312,6 @@ pub enum Instruction { /// pops ptr/length i32, loads string from cache CachedStringLoad { owned: bool, - #[allow(dead_code)] - optional: bool, mem: walrus::MemoryId, free: walrus::FunctionId, /// If we're in reference-types mode, the externref table ID to get the cached string from.