Clippy fixes (#692)
This commit is contained in:
@@ -77,7 +77,7 @@ impl CodeMemory {
|
||||
.expect("failed to push current memory map");
|
||||
|
||||
for (m, t) in &mut self.mmaps[self.published..] {
|
||||
if m.len() != 0 {
|
||||
if !m.is_empty() {
|
||||
unsafe {
|
||||
region::protect(m.as_mut_ptr(), m.len(), region::Protection::ReadExecute)
|
||||
}
|
||||
@@ -179,7 +179,7 @@ impl CodeMemory {
|
||||
),
|
||||
);
|
||||
|
||||
if previous.0.len() > 0 {
|
||||
if !previous.0.is_empty() {
|
||||
self.mmaps.push(previous);
|
||||
} else {
|
||||
assert_eq!(previous.1.len(), 0);
|
||||
|
||||
@@ -175,14 +175,14 @@ impl Compiler {
|
||||
};
|
||||
let bytes = emit_debugsections_image(
|
||||
self.isa.triple().clone(),
|
||||
&target_config,
|
||||
target_config,
|
||||
&debug_data,
|
||||
&module_vmctx_info,
|
||||
&address_transform,
|
||||
&value_ranges,
|
||||
&funcs,
|
||||
)
|
||||
.map_err(|e| SetupError::DebugInfo(e))?;
|
||||
.map_err(SetupError::DebugInfo)?;
|
||||
Some(bytes)
|
||||
} else {
|
||||
None
|
||||
|
||||
@@ -244,6 +244,6 @@ impl Context {
|
||||
pub fn get_global_exports(
|
||||
&mut self,
|
||||
) -> Rc<RefCell<HashMap<String, Option<wasmtime_runtime::Export>>>> {
|
||||
Rc::clone(&mut self.global_exports)
|
||||
Rc::clone(&self.global_exports)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ impl CompiledModule {
|
||||
imports,
|
||||
data_initializers,
|
||||
signatures,
|
||||
dbg_jit_registration: dbg_jit_registration.map(|r| Rc::new(r)),
|
||||
dbg_jit_registration: dbg_jit_registration.map(Rc::new),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -254,6 +254,7 @@ impl OwnedDataInitializer {
|
||||
///
|
||||
/// This is equivalent to createing a `CompiledModule` and calling `instantiate()` on it,
|
||||
/// but avoids creating an intermediate copy of the data initializers.
|
||||
#[allow(clippy::implicit_hasher)]
|
||||
pub fn instantiate(
|
||||
compiler: &mut Compiler,
|
||||
data: &[u8],
|
||||
@@ -270,7 +271,7 @@ pub fn instantiate(
|
||||
raw.imports,
|
||||
&*raw.data_initializers,
|
||||
raw.signatures,
|
||||
raw.dbg_jit_registration.map(|r| Rc::new(r)),
|
||||
raw.dbg_jit_registration.map(Rc::new),
|
||||
Box::new(()),
|
||||
)
|
||||
.map_err(SetupError::Instantiate)
|
||||
|
||||
@@ -129,16 +129,14 @@ pub fn link_module(
|
||||
|
||||
// Sanity-check: Ensure that the imported memory has at least
|
||||
// guard-page protections the importing module expects it to have.
|
||||
match (memory.style, &import_memory.style) {
|
||||
(
|
||||
MemoryStyle::Static { bound },
|
||||
MemoryStyle::Static {
|
||||
bound: import_bound,
|
||||
},
|
||||
) => {
|
||||
assert_ge!(bound, *import_bound);
|
||||
}
|
||||
_ => (),
|
||||
if let (
|
||||
MemoryStyle::Static { bound },
|
||||
MemoryStyle::Static {
|
||||
bound: import_bound,
|
||||
},
|
||||
) = (memory.style, &import_memory.style)
|
||||
{
|
||||
assert_ge!(bound, *import_bound);
|
||||
}
|
||||
assert_ge!(memory.offset_guard_size, import_memory.offset_guard_size);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user