Skip to content
This repository has been archived by the owner on Aug 26, 2023. It is now read-only.

Commit

Permalink
Clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lwagner94 committed Feb 4, 2023
1 parent 0d1818a commit 4a5e4de
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ fn init_rayon(threads: Option<usize>) {
// build_global only seems to return an error
// if called twice, so this should be fine.
let _ = rayon::ThreadPoolBuilder::new()
.num_threads(threads as usize)
.num_threads(threads)
.build_global();
}

Expand Down
6 changes: 3 additions & 3 deletions src/reporter/html.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ impl<'a> HTMLReporter<'a> {

/// Create the output directory
fn create_output_directory(&self) -> Result<()> {
std::fs::create_dir_all(&self.output_directory)?;
std::fs::create_dir_all(self.output_directory)?;
Ok(())
}

Expand Down Expand Up @@ -254,8 +254,8 @@ impl<'a> HTMLReporter<'a> {
let data = BTreeMap::from([
("source_files", handlebars::to_json(source_files)),
("file", handlebars::to_json::<Option<String>>(None)),
("report_info", handlebars::to_json(&report_info)),
("stats", handlebars::to_json(&stats)),
("report_info", handlebars::to_json(report_info)),
("stats", handlebars::to_json(stats)),
]);
let writer = BufWriter::new(File::create(self.output_directory.join("index.html"))?);
template_engine
Expand Down
8 changes: 4 additions & 4 deletions src/runtime/wasmer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ impl WasmerRuntime {
.exports
.get_function("_start")
.context("Failed to resolve _start function")?
.typed::<(), ()>(&mut self.store)
.typed::<(), ()>(&self.store)
.context("Failed to get native _start function")?;

let result = func.call(&mut self.store).map(|_| 0);
Expand Down Expand Up @@ -258,8 +258,8 @@ fn create_store(compiler: Compiler) -> Store {
let metering = Arc::new(Metering::new(u64::MAX, cost_function));

let mut compiler_config: Box<dyn CompilerConfig> = match compiler {
Compiler::Singlepass => Box::new(Singlepass::default()),
Compiler::Cranelift => Box::new(Cranelift::default()),
Compiler::Singlepass => Box::<Singlepass>::default(),
Compiler::Cranelift => Box::<Cranelift>::default(),
};

compiler_config.push_middleware(metering);
Expand All @@ -270,7 +270,7 @@ fn create_store(compiler: Compiler) -> Store {

fn create_module(module: &WasmModule, store: &Store) -> Result<Module> {
let bytecode: Vec<u8> = module.to_bytes()?;
let module = Module::new(store, &bytecode).context("Failed to create wasmer module")?;
let module = Module::new(store, bytecode).context("Failed to create wasmer module")?;

Ok(module)
}
Expand Down
2 changes: 1 addition & 1 deletion src/wasmmodule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl<'a> WasmModule<'a> {
.code_section()
.context("Module has no code section")?;

let bytes = std::fs::read(&self.path.as_ref())
let bytes = std::fs::read(self.path.as_ref())
.with_context(|| format!("Could not read bytecode from {}", self.path))?;

Ok(code_section
Expand Down

0 comments on commit 4a5e4de

Please sign in to comment.