Clippy Fixes

This commit is contained in:
Andrew Wheeler(Genusis) 2022-10-25 10:43:38 -04:00 committed by Jeremy Soller
parent e39f8eabd5
commit 5200f67196
5 changed files with 61 additions and 62 deletions

View file

@ -10,7 +10,12 @@ pub struct CacheKey {
}
impl CacheKey {
pub fn new(font_id: fontdb::ID, glyph_id: u16, font_size: i32, pos: (f32, f32)) -> (Self, i32, i32) {
pub fn new(
font_id: fontdb::ID,
glyph_id: u16,
font_size: i32,
pos: (f32, f32),
) -> (Self, i32, i32) {
let (x, x_bin) = SubpixelBin::new(pos.0);
let (y, y_bin) = SubpixelBin::new(pos.1);
(
@ -54,6 +59,7 @@ impl SubpixelBin {
(trunc - 1, Self::Zero)
}
} else {
#[allow(clippy::collapsible_else_if)]
if fract < 0.125 {
(trunc, Self::Zero)
} else if fract < 0.375 {

View file

@ -132,7 +132,7 @@ impl<'a> FontMatches<'a> {
&self.fonts,
&["Fira Sans", "Fira Mono"],
scripts,
&self.locale
self.locale
);
let (mut glyphs, mut missing) = self.shape_fallback(
@ -306,7 +306,7 @@ impl<'a> FontMatches<'a> {
log::trace!("Line {}: '{}'", if line_rtl { "RTL" } else { "LTR" }, line);
let paragraph = unicode_bidi::Paragraph::new(&bidi, &para_info);
let paragraph = unicode_bidi::Paragraph::new(&bidi, para_info);
let mut start = 0;
let mut span_rtl = line_rtl;

View file

@ -23,7 +23,7 @@ impl<'a> FontShapeGlyph<'a> {
FontLayoutGlyph {
start: self.start,
end: self.end,
x: x,
x,
w: x_advance,
rtl,
font: self.font,

View file

@ -43,10 +43,10 @@ impl FontSystem {
Self { locale, db }
}
pub fn matches<'a, F: Fn(&fontdb::FaceInfo) -> bool>(
&'a self,
pub fn matches<F: Fn(&fontdb::FaceInfo) -> bool>(
&self,
f: F,
) -> Option<FontMatches<'a>> {
) -> Option<FontMatches<'_>> {
let mut fonts = Vec::new();
for face in self.db.faces() {
if !f(face) {
@ -84,3 +84,9 @@ impl FontSystem {
}
}
}
impl Default for FontSystem {
fn default() -> Self {
Self::new()
}
}