Skip to content

Commit

Permalink
fix: clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiphoseer committed Aug 20, 2024
1 parent 6b08a09 commit 3cf790b
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 15 deletions.
4 changes: 2 additions & 2 deletions crates/ccitt/src/bit_iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl BitWriter {
self.state = unsafe {
// This is safe, because `todo < avail < 8`
// and state + 1 = avail, so todo <= state
std::mem::transmute((avail - 1 - todo) as u8)
std::mem::transmute::<u8, State>((avail - 1 - todo) as u8)
};
return;
} else {
Expand All @@ -115,7 +115,7 @@ impl BitWriter {
self.curr = (mask & val) as u8;
self.state = unsafe {
// This is safe, because todo < 8 as per the loop above
std::mem::transmute((7 - todo) as u8)
std::mem::transmute::<u8, State>((7 - todo) as u8)
};
}

Expand Down
12 changes: 2 additions & 10 deletions crates/sdo-web/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ pub struct Handle {
output: HtmlElement,
input: HtmlInputElement,
fs: OriginPrivateFS,
#[allow(dead_code)]
closures: Vec<Closure<dyn FnMut(JsValue)>>,

fc: ChsetCache,
Expand Down Expand Up @@ -153,7 +154,7 @@ impl Handle {
for chr in charsets {
let name = decode_atari_str(chr.as_ref());
html.push_str("<li>");
ar.push(js_sys::JsString::from(name.as_ref()).as_ref());
ar.push(JsString::from(name.as_ref()).as_ref());
html.push_str(&name);
html.push_str("</li>");
}
Expand Down Expand Up @@ -653,12 +654,3 @@ impl Handle {
Ok(())
}
}

const ACCEPT: &[FourCC] = &[
FourCC::SDOC,
FourCC::ESET,
FourCC::PS09,
FourCC::PS24,
FourCC::LS30,
FourCC::BIMC,
];
12 changes: 12 additions & 0 deletions crates/signum/src/chsets/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ impl UseTable {
}
}

impl Default for UseTable {
fn default() -> Self {
Self::new()
}
}

/// Matrix of character usage in a single document
pub struct UseMatrix {
/// One entry for each charset
Expand All @@ -80,6 +86,12 @@ impl UseMatrix {
}
}

impl Default for UseMatrix {
fn default() -> Self {
Self::new()
}
}

/// List of character usage tables, for use with font caches
pub struct UseTableVec {
/// One entry for each charset
Expand Down
2 changes: 1 addition & 1 deletion crates/signum/src/chsets/printer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ impl PSetChar<'_> {
top: self.top,
height: self.height,
width: self.width,
bitmap: unsafe { std::mem::transmute(buffer.as_ref()) },
bitmap: unsafe { std::mem::transmute::<&[u8], &[u8]>(buffer.as_ref()) },
},
buffer,
}
Expand Down
4 changes: 2 additions & 2 deletions crates/signum/src/util/bit_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ impl BitWriter {
self.state = unsafe {
// This is safe, because `todo < avail < 8`
// and state + 1 = avail, so todo <= state
std::mem::transmute((avail - 1 - todo) as u8)
std::mem::transmute::<u8, State>((avail - 1 - todo) as u8)
};
return;
} else {
Expand All @@ -113,7 +113,7 @@ impl BitWriter {
self.curr = (mask & val) as u8;
self.state = unsafe {
// This is safe, because todo < 8 as per the loop above
std::mem::transmute((7 - todo) as u8)
std::mem::transmute::<u8, State>((7 - todo) as u8)
};
}

Expand Down

0 comments on commit 3cf790b

Please sign in to comment.