Skip to content

Commit

Permalink
Fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Mar 3, 2023
1 parent bf82093 commit f5f35e4
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 11 deletions.
2 changes: 0 additions & 2 deletions crates/swc_ecma_codegen/tests/sourcemap.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![feature(bench_black_box)]

use std::{fs::read_to_string, path::PathBuf};

use rustc_hash::FxHashSet;
Expand Down
1 change: 0 additions & 1 deletion crates/swc_ecma_parser/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@
//! [tc39/test262]:https://github.com/tc39/test262

#![cfg_attr(docsrs, feature(doc_cfg))]
#![cfg_attr(test, feature(bench_black_box))]
#![cfg_attr(test, feature(test))]
#![deny(clippy::all)]
#![deny(unused)]
Expand Down
11 changes: 4 additions & 7 deletions crates/swc_plugin_runner/src/memory_interop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub fn copy_bytes_into_host(memory: &Memory, bytes_ptr: u32, bytes_ptr_len: u32)

// Deref & read through plugin's wasm memory space via returned ptr
let derefed_ptr = ptr
.deref(memory, 0, bytes_ptr_len as u32)
.deref(memory, 0, bytes_ptr_len)
.expect("Should able to deref from given ptr");

derefed_ptr
Expand All @@ -33,12 +33,9 @@ where

let ptr_start: u32 = get_allocated_ptr(serialized_len);
let ptr_start_size: u32 = ptr_start;
let serialized_len_size: u32 = serialized_len.try_into().unwrap_or_else(|_| {
panic!(
"Should be able to convert the value {} to u32",
serialized_len
)
});
let serialized_len_size: u32 = serialized_len
.try_into()
.unwrap_or_else(|_| panic!("Should be able to convert the value {serialized_len} to u32"));

// Note: it's important to get a view from memory _after_ alloc completes
let view = memory.view::<u8>();
Expand Down
2 changes: 1 addition & 1 deletion crates/swc_plugin_runner/tests/issues.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ fn build_plugin(dir: &Path, crate_name: &str) -> Result<PathBuf, Error> {
let entry = entry?;

let s = entry.file_name().to_string_lossy().into_owned();
if s.eq_ignore_ascii_case(&format!("{}.wasm", crate_name)) {
if s.eq_ignore_ascii_case(&format!("{crate_name}.wasm")) {
return Ok(entry.path());
}
}
Expand Down

0 comments on commit f5f35e4

Please sign in to comment.