Make Stylesheet::is_effective_for_device more idiomatic

This commit is contained in:
Brandon Fairchild 2015-11-17 17:02:01 -05:00
parent 6a28d62b15
commit 7f75a881a4

View file

@ -148,10 +148,7 @@ impl Stylesheet {
///
/// Always true if no associated MediaQueryList exists.
pub fn is_effective_for_device(&self, device: &Device) -> bool {
match self.media {
Some(ref media) => media.evaluate(device),
None => true
}
self.media.as_ref().map_or(true, |ref media| media.evaluate(device))
}
/// Return an iterator over all the rules within the style-sheet.