mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Utilize if let
instead of match
in a few places
This commit is contained in:
parent
44a4b7886d
commit
a9b0607bf1
2 changed files with 13 additions and 21 deletions
|
@ -140,9 +140,8 @@ impl Font {
|
|||
text: text.to_owned(),
|
||||
options: options.clone(),
|
||||
};
|
||||
match self.shape_cache.find(&lookup_key) {
|
||||
None => {}
|
||||
Some(glyphs) => return glyphs.clone(),
|
||||
if let Some(glyphs) = self.shape_cache.find(&lookup_key) {
|
||||
return glyphs.clone();
|
||||
}
|
||||
|
||||
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 {
|
||||
// fast path: already created a shaper
|
||||
match self.shaper {
|
||||
Some(ref mut shaper) => {
|
||||
shaper.set_options(options);
|
||||
return shaper
|
||||
},
|
||||
None => {}
|
||||
if let Some(ref mut shaper) = self.shaper {
|
||||
shaper.set_options(options);
|
||||
return shaper
|
||||
}
|
||||
|
||||
let shaper = Shaper::new(self, options);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue