From 217ad9ec285b4923de1790b0976c8c793039c994 Mon Sep 17 00:00:00 2001 From: Joe Wilm Date: Mon, 10 Dec 2018 09:53:56 -0800 Subject: Upgrade to Rust 2018 This resolves a lot of NLL issues, however full NLL will be necessary to handle a couple of remaining issues. --- font/src/ft/mod.rs | 4 +--- font/src/lib.rs | 8 ++++---- font/src/rusttype/mod.rs | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) (limited to 'font') 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 { 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; + fn metrics(&self, _: FontKey, _: Size) -> Result; /// Load the font described by `FontDesc` and `Size` - fn load_font(&mut self, &FontDesc, Size) -> Result; + fn load_font(&mut self, _: &FontDesc, _: Size) -> Result; /// Rasterize the glyph described by `GlyphKey`. - fn get_glyph(&mut self, GlyphKey) -> Result; + fn get_glyph(&mut self, _: GlyphKey) -> Result; /// 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 { -- cgit v1.2.3