From eb00aa41649ce761003a83d7791b0e1e604149cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sat, 9 Dec 2017 20:27:16 +0100 Subject: [PATCH] gfx: Use ? on Option more often. --- components/gfx/platform/macos/font.rs | 6 +----- components/gfx/text/text_run.rs | 5 +---- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/components/gfx/platform/macos/font.rs b/components/gfx/platform/macos/font.rs index 3ecef760a15..beb8f9f4f2f 100644 --- a/components/gfx/platform/macos/font.rs +++ b/components/gfx/platform/macos/font.rs @@ -69,11 +69,7 @@ impl FontHandle { /// Cache all the data needed for basic horizontal kerning. This is used only as a fallback or /// fast path (when the GPOS table is missing or unnecessary) so it needn't handle every case. fn find_h_kern_subtable(&self) -> Option { - let font_table = match self.table_for_tag(KERN) { - Some(table) => table, - None => return None - }; - + let font_table = self.table_for_tag(KERN)?; let mut result = CachedKernTable { font_table: font_table, pair_data_range: 0..0, diff --git a/components/gfx/text/text_run.rs b/components/gfx/text/text_run.rs index e66b6550dc3..8121140e480 100644 --- a/components/gfx/text/text_run.rs +++ b/components/gfx/text/text_run.rs @@ -149,10 +149,7 @@ impl<'a> Iterator for CharacterSliceIterator<'a> { // inline(always) due to the inefficient rt failures messing up inline heuristics, I think. #[inline(always)] fn next(&mut self) -> Option> { - let glyph_run = match self.glyph_run { - None => return None, - Some(glyph_run) => glyph_run, - }; + let glyph_run = self.glyph_run?; debug_assert!(!self.range.is_empty()); let byte_start = self.range.begin();