Auto merge of #6316 - frewsxcv:if-let, r=Ms2ger

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6316)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-06-10 03:11:13 -06:00
commit 6e0d0072b8
2 changed files with 13 additions and 21 deletions

View file

@ -140,9 +140,8 @@ impl Font {
text: text.to_owned(), text: text.to_owned(),
options: options.clone(), options: options.clone(),
}; };
match self.shape_cache.find(&lookup_key) { if let Some(glyphs) = self.shape_cache.find(&lookup_key) {
None => {} return glyphs.clone();
Some(glyphs) => return glyphs.clone(),
} }
let mut glyphs = GlyphStore::new(text.chars().count(), let mut glyphs = GlyphStore::new(text.chars().count(),
@ -159,12 +158,9 @@ impl Font {
fn make_shaper<'a>(&'a mut self, options: &ShapingOptions) -> &'a Shaper { fn make_shaper<'a>(&'a mut self, options: &ShapingOptions) -> &'a Shaper {
// fast path: already created a shaper // fast path: already created a shaper
match self.shaper { if let Some(ref mut shaper) = self.shaper {
Some(ref mut shaper) => {
shaper.set_options(options); shaper.set_options(options);
return shaper return shaper
},
None => {}
} }
let shaper = Shaper::new(self, options); let shaper = Shaper::new(self, options);

View file

@ -23,10 +23,8 @@ pub fn get_available_families<F>(mut callback: F) where F: FnMut(String) {
pub fn get_variations_for_family<F>(family_name: &str, mut callback: F) where F: FnMut(String) { pub fn get_variations_for_family<F>(family_name: &str, mut callback: F) where F: FnMut(String) {
debug!("Looking for faces of family: {}", family_name); debug!("Looking for faces of family: {}", family_name);
let family_collection = let family_collection = core_text::font_collection::create_for_family(family_name);
core_text::font_collection::create_for_family(family_name); if let Some(family_collection) = family_collection {
match family_collection {
Some(family_collection) => {
let family_descriptors = family_collection.get_descriptors(); let family_descriptors = family_collection.get_descriptors();
for descref in family_descriptors.iter() { for descref in family_descriptors.iter() {
let descref: CTFontDescriptorRef = unsafe { mem::transmute(descref) }; let descref: CTFontDescriptorRef = unsafe { mem::transmute(descref) };
@ -35,8 +33,6 @@ pub fn get_variations_for_family<F>(family_name: &str, mut callback: F) where F:
callback(postscript_name); callback(postscript_name);
} }
} }
None => {}
}
} }
pub fn get_system_default_family(_generic_name: &str) -> Option<String> { pub fn get_system_default_family(_generic_name: &str) -> Option<String> {