From 21eb50aa50586ae95d553ae097cb1199334ac1c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Tue, 3 Jul 2018 00:11:24 +0200 Subject: Enable clippy in font/copypasta crates Enabled clippy in the sub-crates font and copypasta. All issues that were discovered by this change have also been fixed. --- font/src/ft/mod.rs | 6 +++--- font/src/lib.rs | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'font') diff --git a/font/src/ft/mod.rs b/font/src/ft/mod.rs index cdae88cb..516f3b9c 100644 --- a/font/src/ft/mod.rs +++ b/font/src/ft/mod.rs @@ -232,15 +232,15 @@ impl FreeTypeRasterizer { let ft_face = self.library.new_face(&path, index)?; // Get available pixel sizes if font isn't scalable. - let non_scalable = if !pattern.scalable().next().unwrap_or(true) { + let non_scalable = if pattern.scalable().next().unwrap_or(true) { + None + } else { let mut pixelsize = pattern.pixelsize(); debug!("pixelsizes: {:?}", pixelsize); Some(FixedSize { pixelsize: pixelsize.next().expect("has 1+ pixelsize"), }) - } else { - None }; let face = Face { diff --git a/font/src/lib.rs b/font/src/lib.rs index ad94d084..fe9e9e85 100644 --- a/font/src/lib.rs +++ b/font/src/lib.rs @@ -17,6 +17,9 @@ //! CoreText is used on Mac OS. //! FreeType is used on everything that's not Mac OS. //! Eventually, ClearType support will be available for windows + +#![cfg_attr(feature = "cargo-clippy", deny(clippy, if_not_else, enum_glob_use, wrong_pub_self_convention))] + #[cfg(not(target_os = "macos"))] extern crate fontconfig; #[cfg(not(target_os = "macos"))] -- cgit v1.2.3