mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
style: Switch css(skip_if) to use a Path for consistency.
This commit is contained in:
parent
1f4b3556e6
commit
bf08c659a0
1 changed files with 4 additions and 4 deletions
|
@ -5,7 +5,7 @@
|
||||||
use cg::{self, WhereClause};
|
use cg::{self, WhereClause};
|
||||||
use darling::util::Override;
|
use darling::util::Override;
|
||||||
use quote::{ToTokens, Tokens};
|
use quote::{ToTokens, Tokens};
|
||||||
use syn::{self, Data, Ident};
|
use syn::{self, Data, Path};
|
||||||
use synstructure::{BindingInfo, Structure, VariantInfo};
|
use synstructure::{BindingInfo, Structure, VariantInfo};
|
||||||
|
|
||||||
pub fn derive(input: syn::DeriveInput) -> Tokens {
|
pub fn derive(input: syn::DeriveInput) -> Tokens {
|
||||||
|
@ -131,7 +131,7 @@ fn derive_variant_fields_expr(
|
||||||
let mut expr = quote! { ::style_traits::ToCss::to_css(#first, dest) };
|
let mut expr = quote! { ::style_traits::ToCss::to_css(#first, dest) };
|
||||||
if let Some(condition) = attrs.skip_if {
|
if let Some(condition) = attrs.skip_if {
|
||||||
expr = quote! {
|
expr = quote! {
|
||||||
if !#first.#condition() {
|
if !#condition(#first) {
|
||||||
#expr
|
#expr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,7 @@ fn derive_single_field_expr(
|
||||||
|
|
||||||
if let Some(condition) = attrs.skip_if {
|
if let Some(condition) = attrs.skip_if {
|
||||||
expr = quote! {
|
expr = quote! {
|
||||||
if !#field.#condition() {
|
if !#condition(#field) {
|
||||||
#expr
|
#expr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -221,5 +221,5 @@ struct CssFieldAttrs {
|
||||||
ignore_bound: bool,
|
ignore_bound: bool,
|
||||||
iterable: bool,
|
iterable: bool,
|
||||||
skip: bool,
|
skip: bool,
|
||||||
skip_if: Option<Ident>,
|
skip_if: Option<Path>,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue