Auto merge of #17402 - servo:derive-all-the-things, r=emilio

Use generics for the filter property

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17402)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-06-20 06:23:17 -07:00 committed by GitHub
commit fc2c5b7ef4
21 changed files with 822 additions and 496 deletions

View file

@ -41,7 +41,10 @@ macro_rules! no_viewport_percentage {
no_viewport_percentage!(bool, f32);
impl<T: HasViewportPercentage> HasViewportPercentage for Box<T> {
impl<T> HasViewportPercentage for Box<T>
where
T: ?Sized + HasViewportPercentage
{
#[inline]
fn has_viewport_percentage(&self) -> bool {
(**self).has_viewport_percentage()
@ -69,6 +72,13 @@ impl<T: HasViewportPercentage> HasViewportPercentage for Vec<T> {
}
}
impl<T: HasViewportPercentage> HasViewportPercentage for [T] {
#[inline]
fn has_viewport_percentage(&self) -> bool {
self.iter().any(T::has_viewport_percentage)
}
}
/// A set of viewport descriptors:
///
/// https://drafts.csswg.org/css-device-adapt/#viewport-desc