Wasm: clippy fixes

This commit is contained in:
Brian Carroll 2022-01-07 23:53:06 +00:00
parent a1f737d6d8
commit c89f74f7e8
2 changed files with 3 additions and 10 deletions

View file

@ -430,7 +430,7 @@ enum SubSectionId {
SymbolTable = 8,
}
fn serialize_subsection<'a, I: Serialize, T: SerialBuffer>(
fn serialize_subsection<I: Serialize, T: SerialBuffer>(
buffer: &mut T,
id: SubSectionId,
items: &[I],

View file

@ -629,7 +629,7 @@ impl SectionCounter {
/// A Wasm module section that we don't use for Roc code,
/// but may be present in a preloaded binary
#[derive(Debug)]
#[derive(Debug, Default)]
pub struct OpaqueSection<'a> {
bytes: &'a [u8],
}
@ -640,16 +640,10 @@ impl<'a> OpaqueSection<'a> {
}
}
impl<'a> Default for OpaqueSection<'a> {
fn default() -> Self {
Self { bytes: &[] }
}
}
impl Serialize for OpaqueSection<'_> {
fn serialize<T: SerialBuffer>(&self, buffer: &mut T) {
if !self.bytes.is_empty() {
buffer.append_slice(&self.bytes);
buffer.append_slice(self.bytes);
}
}
}
@ -682,7 +676,6 @@ impl<'a> WasmModule<'a> {
/// Serialize the module to bytes
/// (Mutates some data related to linking)
#[allow(clippy::unit_arg)]
pub fn serialize_mut<T: SerialBuffer>(&mut self, buffer: &mut T) {
buffer.append_u8(0);
buffer.append_slice("asm".as_bytes());