summaryrefslogtreecommitdiff
path: root/font/src/ft/mod.rs
diff options
context:
space:
mode:
authorChristian Duerr <chrisduerr@users.noreply.github.com>2018-06-17 09:19:30 +0000
committerGitHub <noreply@github.com>2018-06-17 09:19:30 +0000
commit5ba34d4f9766a55a06ed5e3e44cc384af1b09f65 (patch)
tree11965fbe66f5d25ea00be1a02e74b724c4071d3c /font/src/ft/mod.rs
parent0f700a01bd73623cdfc0afc4a54f9e82f46d8f49 (diff)
downloadalacritty-5ba34d4f9766a55a06ed5e3e44cc384af1b09f65.tar.gz
alacritty-5ba34d4f9766a55a06ed5e3e44cc384af1b09f65.zip
Move to cargo clippy
Using clippy as a library has been deprecated, instead the `cargo clippy` command should be used instead. To comply with this change clippy has been removed from the `Cargo.toml` and is now installed with cargo when building in CI. This has also lead to a few new clippy issues to show up, this includes everything in the `font` subdirectory. This has been fixed and `font` should now be covered by clippy CI too. This also upgrades all dependencies, as a result this fixes #1341 and this fixes #1344.
Diffstat (limited to 'font/src/ft/mod.rs')
-rw-r--r--font/src/ft/mod.rs30
1 files changed, 13 insertions, 17 deletions
diff --git a/font/src/ft/mod.rs b/font/src/ft/mod.rs
index 68d2faf3..7c5fb768 100644
--- a/font/src/ft/mod.rs
+++ b/font/src/ft/mod.rs
@@ -80,8 +80,8 @@ impl ::Rasterize for FreeTypeRasterizer {
Ok(FreeTypeRasterizer {
faces: HashMap::new(),
keys: HashMap::new(),
- library: library,
- device_pixel_ratio: device_pixel_ratio,
+ library,
+ device_pixel_ratio,
})
}
@@ -94,7 +94,7 @@ impl ::Rasterize for FreeTypeRasterizer {
Ok(Metrics {
average_advance: full.cell_width,
line_height: height,
- descent: descent,
+ descent,
})
}
@@ -172,7 +172,7 @@ impl FreeTypeRasterizer {
} as f64;
Ok(FullMetrics {
- size_metrics: size_metrics,
+ size_metrics,
cell_width: width
})
}
@@ -188,7 +188,7 @@ impl FreeTypeRasterizer {
pattern.add_family(&desc.name);
pattern.set_weight(weight.into_fontconfig_type());
pattern.set_slant(slant.into_fontconfig_type());
- pattern.add_pixelsize(size.as_f32_pts() as _);
+ pattern.add_pixelsize(f64::from(size.as_f32_pts()));
let font = fc::font_match(fc::Config::get_current(), &mut pattern)
.ok_or_else(|| Error::MissingFont(desc.to_owned()))?;
@@ -210,7 +210,7 @@ impl FreeTypeRasterizer {
let mut pattern = fc::Pattern::new();
pattern.add_family(&desc.name);
pattern.add_style(style);
- pattern.add_pixelsize(size.as_f32_pts() as _);
+ pattern.add_pixelsize(f64::from(size.as_f32_pts()));
let font = fc::font_match(fc::Config::get_current(), &mut pattern)
.ok_or_else(|| Error::MissingFont(desc.to_owned()))?;
@@ -244,12 +244,12 @@ impl FreeTypeRasterizer {
};
let face = Face {
- ft_face: ft_face,
+ ft_face,
key: FontKey::next(),
load_flags: Self::ft_load_flags(pattern),
render_mode: Self::ft_render_mode(pattern),
lcd_filter: Self::ft_lcd_filter(pattern),
- non_scalable: non_scalable,
+ non_scalable,
};
debug!("Loaded Face {:?}", face);
@@ -269,14 +269,10 @@ impl FreeTypeRasterizer {
let use_initial_face = if self.faces.contains_key(&glyph_key.font_key) {
// Get face and unwrap since we just checked for presence.
- let face = self.faces.get(&glyph_key.font_key).unwrap();
+ let face = &self.faces[&glyph_key.font_key];
let index = face.ft_face.get_char_index(c as usize);
- if index != 0 || have_recursed {
- true
- } else {
- false
- }
+ index != 0 || have_recursed
} else {
false
};
@@ -334,7 +330,7 @@ impl FreeTypeRasterizer {
// Render a normal character if it's not a cursor
let font_key = self.face_for_glyph(glyph_key, false)?;
- let face = self.faces.get(&font_key).unwrap();
+ let face = &self.faces[&font_key];
let index = face.ft_face.get_char_index(glyph_key.c as usize);
let size = face.non_scalable.as_ref()
@@ -360,7 +356,7 @@ impl FreeTypeRasterizer {
left: glyph.bitmap_left(),
width: pixel_width,
height: glyph.bitmap().rows(),
- buf: buf,
+ buf,
})
}
@@ -490,7 +486,7 @@ impl FreeTypeRasterizer {
}
Ok((bitmap.width(), packed))
},
- mode @ _ => panic!("unhandled pixel mode: {:?}", mode)
+ mode => panic!("unhandled pixel mode: {:?}", mode)
}
}