diff --git a/crates/replay_gen/src/codegen.rs b/crates/replay_gen/src/codegen.rs index 46a7e382..977aa31c 100644 --- a/crates/replay_gen/src/codegen.rs +++ b/crates/replay_gen/src/codegen.rs @@ -214,7 +214,7 @@ pub fn generate_standalone(wasm_path: &Path, code: &Replay) -> std::io::Result<( let mut current = 0; for r in func.results.iter() { let ty = code.func_idx_to_ty.get(&(funcidx as usize)).unwrap(); - let param_tys = ty.params.clone(); + let _param_tys = ty.params.clone(); let new_c = current + r.reps; let res = match r.results.get(0) { Some(v) => format!( @@ -240,7 +240,7 @@ pub fn generate_standalone(wasm_path: &Path, code: &Replay) -> std::io::Result<( current = new_c; } let ty = code.func_idx_to_ty.get(&(funcidx as usize)).unwrap(); - let param_tys = ty.params.clone(); + let _param_tys = ty.params.clone(); let default_return = match ty.results.get(0) { Some(v) => match v { ValType::I32 => "(i32.const 0)", @@ -306,14 +306,14 @@ pub fn generate_standalone(wasm_path: &Path, code: &Replay) -> std::io::Result<( "(" }; - let to_write = (first_part.to_string() + let to_write = first_part.to_string() + &format!( "{}{} {:?}){})", hack_for_diff_format, &valty_to_const(&global.value), &global.initial, fourth_part - )); + ); write(stream, &to_write)?; write(stream, "\n")?; } @@ -374,7 +374,11 @@ fn hostevent_to_js(event: &HostEvent) -> String { .join(",") } let str = match event { - HostEvent::ExportCall { idx, name, params } => { + HostEvent::ExportCall { + idx: _, + name, + params, + } => { format!( "instance.exports.{}({})\n", name, @@ -382,7 +386,7 @@ fn hostevent_to_js(event: &HostEvent) -> String { ) } HostEvent::ExportCallTable { - idx, + idx: _, table_name, funcidx, params, @@ -432,8 +436,8 @@ fn hostevent_to_js(event: &HostEvent) -> String { } } HostEvent::MutateTable { - tableidx, - funcidx, + tableidx: _, + funcidx: _, idx, func_import, func_name, @@ -454,7 +458,7 @@ fn hostevent_to_js(event: &HostEvent) -> String { js_string } HostEvent::GrowTable { - idx, + idx: _, amount, import, name, @@ -466,7 +470,7 @@ fn hostevent_to_js(event: &HostEvent) -> String { } } HostEvent::MutateGlobal { - idx, + idx: _, value, valtype, import, @@ -492,7 +496,11 @@ fn hostevent_to_js(event: &HostEvent) -> String { fn hostevent_to_wat(event: &HostEvent, code: &Replay) -> String { let str = match event { - HostEvent::ExportCall { idx, name, params } => { + HostEvent::ExportCall { + idx, + name: _, + params, + } => { let ty = code.func_idx_to_ty.get(&(*idx as usize)).unwrap(); let param_tys = ty.params.clone(); let result_count = ty.results.len(); @@ -507,8 +515,8 @@ fn hostevent_to_wat(event: &HostEvent, code: &Replay) -> String { } HostEvent::ExportCallTable { idx, - table_name, - funcidx, + table_name: _, + funcidx: _, params, } => { let ty = code.func_idx_to_ty.get(&(*idx as usize)).unwrap(); @@ -526,8 +534,8 @@ fn hostevent_to_wat(event: &HostEvent, code: &Replay) -> String { HostEvent::MutateMemory { addr, data, - import, - name, + import: _, + name: _, } => { let mut js_string = String::new(); for (j, byte) in data.iter().enumerate() { @@ -539,8 +547,8 @@ fn hostevent_to_wat(event: &HostEvent, code: &Replay) -> String { } HostEvent::GrowMemory { amount, - import, - name, + import: _, + name: _, } => { format!("(memory.grow (i32.const {})) (drop)\n", amount) } @@ -548,10 +556,10 @@ fn hostevent_to_wat(event: &HostEvent, code: &Replay) -> String { tableidx, funcidx, idx, - func_import, - func_name, - import, - name, + func_import: _, + func_name: _, + import: _, + name: _, } => { format!( "(table.set {} (i32.const {}) (ref.func {}))", @@ -559,10 +567,10 @@ fn hostevent_to_wat(event: &HostEvent, code: &Replay) -> String { ) } HostEvent::GrowTable { - idx, + idx: _, amount, - import, - name, + import: _, + name: _, } => { format!("(table.grow (i32.const {})) (drop)\n", amount) } @@ -570,8 +578,8 @@ fn hostevent_to_wat(event: &HostEvent, code: &Replay) -> String { idx, value, valtype, - import, - name, + import: _, + name: _, } => { let valtype = match valtype { ValType::I32 => "i32.const", diff --git a/crates/replay_gen/src/irgen.rs b/crates/replay_gen/src/irgen.rs index 33035b7f..f5c39d2e 100644 --- a/crates/replay_gen/src/irgen.rs +++ b/crates/replay_gen/src/irgen.rs @@ -153,7 +153,7 @@ impl IRGenerator { for i in module.imports.iter() { match i.kind { walrus::ImportKind::Function(f) => { - let ty = module.types.get(module.funcs.get(f).ty()); + let _ty = module.types.get(module.funcs.get(f).ty()); func_imports.insert( f.index() as i32, Function { diff --git a/crates/replay_gen/src/lib.rs b/crates/replay_gen/src/lib.rs index 51817a69..1adade99 100644 --- a/crates/replay_gen/src/lib.rs +++ b/crates/replay_gen/src/lib.rs @@ -8,7 +8,6 @@ mod tests { use core::panic; use crate::{ - codegen::generate_javascript, irgen::IRGenerator, opt::merge_fn_results, trace::encode_trace, }; @@ -98,10 +97,10 @@ mod tests { use std::io; use std::io::BufRead; use std::io::Read; - use std::io::{Seek, SeekFrom}; + use std::path::Path; - use tempfile::tempfile; + fn visit_dirs(dir: &Path) -> io::Result<()> { if dir.is_dir() { diff --git a/crates/replay_gen/src/main.rs b/crates/replay_gen/src/main.rs index bdedf7e6..b95ee29d 100644 --- a/crates/replay_gen/src/main.rs +++ b/crates/replay_gen/src/main.rs @@ -1,10 +1,10 @@ use std::fs::File; -use std::io::{self, BufRead, Write}; +use std::io::{self, BufRead}; use std::path::Path; -use std::process::Command; + use std::{env, fs}; -use replay_gen::codegen::{generate_javascript, generate_standalone, write}; +use replay_gen::codegen::{generate_javascript, generate_standalone}; use replay_gen::irgen::IRGenerator; use replay_gen::opt::merge_fn_results; use replay_gen::trace; diff --git a/crates/replay_gen/src/trace.rs b/crates/replay_gen/src/trace.rs index 54835558..feac1b88 100644 --- a/crates/replay_gen/src/trace.rs +++ b/crates/replay_gen/src/trace.rs @@ -176,16 +176,6 @@ impl From for ValType { } } -fn from_short_str(s: &str) -> Result { - match s { - "i" => Ok(ValType::I32), - "I" => Ok(ValType::I64), - "f" => Ok(ValType::F32), - "F" => Ok(ValType::F64), - _ => Err(()), - } -} - fn join_vec(args: &Vec) -> String { args.iter() .map(|x| x.to_string()) @@ -217,14 +207,6 @@ fn test_parse_number() { assert_ne!(s, parse_number(s).unwrap().to_string()); } -fn parse_tys(s: &str) -> Vec { - let mut tys = vec![]; - for ty in s.chars() { - tys.push(from_short_str(&ty.to_string()).unwrap()); - } - tys -} - #[derive(Debug)] pub enum ErrorKind { LegacyTrace,