summaryrefslogtreecommitdiffstats
path: root/font
diff options
context:
space:
mode:
authorJoe Wilm <jwilm@users.noreply.github.com>2018-12-10 09:53:56 -0800
committerChristian Duerr <chrisduerr@users.noreply.github.com>2018-12-10 17:53:56 +0000
commit217ad9ec285b4923de1790b0976c8c793039c994 (patch)
tree440e0d6d35f119246d2b113fd01b431f4f9c2c38 /font
parent7ab0b448479c9705fa14003bda97040630710b7a (diff)
Upgrade to Rust 2018
This resolves a lot of NLL issues, however full NLL will be necessary to handle a couple of remaining issues.
Diffstat (limited to 'font')
-rw-r--r--font/src/ft/mod.rs4
-rw-r--r--font/src/lib.rs8
-rw-r--r--font/src/rusttype/mod.rs2
3 files changed, 6 insertions, 8 deletions
diff --git a/font/src/ft/mod.rs b/font/src/ft/mod.rs
index c67665ab..1d3f64bd 100644
--- a/font/src/ft/mod.rs
+++ b/font/src/ft/mod.rs
@@ -270,9 +270,7 @@ impl FreeTypeRasterizer {
fn face_for_glyph(&mut self, glyph_key: GlyphKey, have_recursed: bool) -> Result<FontKey, Error> {
let c = glyph_key.c;
- 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[&glyph_key.font_key];
+ let use_initial_face = if let Some(face) = self.faces.get(&glyph_key.font_key) {
let index = face.ft_face.get_char_index(c as usize);
index != 0 || have_recursed
diff --git a/font/src/lib.rs b/font/src/lib.rs
index 6df96f28..1db08217 100644
--- a/font/src/lib.rs
+++ b/font/src/lib.rs
@@ -58,7 +58,7 @@ pub use ft::{Error, FreeTypeRasterizer as Rasterizer};
#[cfg(windows)]
pub mod rusttype;
#[cfg(windows)]
-pub use rusttype::{Error, RustTypeRasterizer as Rasterizer};
+pub use crate::rusttype::{Error, RustTypeRasterizer as Rasterizer};
// If target is macos, reexport everything from darwin
#[cfg(target_os = "macos")]
@@ -348,13 +348,13 @@ pub trait Rasterize {
Self: Sized;
/// Get `Metrics` for the given `FontKey`
- fn metrics(&self, FontKey, Size) -> Result<Metrics, Self::Err>;
+ fn metrics(&self, _: FontKey, _: Size) -> Result<Metrics, Self::Err>;
/// Load the font described by `FontDesc` and `Size`
- fn load_font(&mut self, &FontDesc, Size) -> Result<FontKey, Self::Err>;
+ fn load_font(&mut self, _: &FontDesc, _: Size) -> Result<FontKey, Self::Err>;
/// Rasterize the glyph described by `GlyphKey`.
- fn get_glyph(&mut self, GlyphKey) -> Result<RasterizedGlyph, Self::Err>;
+ fn get_glyph(&mut self, _: GlyphKey) -> Result<RasterizedGlyph, Self::Err>;
/// Update the Rasterizer's DPI factor
fn update_dpr(&mut self, device_pixel_ratio: f32);
diff --git a/font/src/rusttype/mod.rs b/font/src/rusttype/mod.rs
index c4fda66f..dea58150 100644
--- a/font/src/rusttype/mod.rs
+++ b/font/src/rusttype/mod.rs
@@ -11,7 +11,7 @@ pub struct RustTypeRasterizer {
dpi_ratio: f32,
}
-impl ::Rasterize for RustTypeRasterizer {
+impl crate::Rasterize for RustTypeRasterizer {
type Err = Error;
fn new(device_pixel_ratio: f32, _: bool) -> Result<RustTypeRasterizer, Error> {