Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce #[css(skip_if)] #20236

Merged
merged 7 commits into from Mar 8, 2018

style: Switch css(skip_if) to use a Path for consistency.

  • Loading branch information
emilio committed Mar 8, 2018
commit bf08c659a0396ad405d8213369931d6bb6cc0c68
@@ -5,7 +5,7 @@
use cg::{self, WhereClause};
use darling::util::Override;
use quote::{ToTokens, Tokens};
use syn::{self, Data, Ident};
use syn::{self, Data, Path};
use synstructure::{BindingInfo, Structure, VariantInfo};

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) };
if let Some(condition) = attrs.skip_if {
expr = quote! {
if !#first.#condition() {
if !#condition(#first) {
#expr
}
}
@@ -185,7 +185,7 @@ fn derive_single_field_expr(

if let Some(condition) = attrs.skip_if {
expr = quote! {
if !#field.#condition() {
if !#condition(#field) {
#expr
}
}
@@ -221,5 +221,5 @@ struct CssFieldAttrs {
ignore_bound: bool,
iterable: bool,
skip: bool,
skip_if: Option<Ident>,
skip_if: Option<Path>,
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.