mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Don't use Ident for #[css(function)]
CSS identifiers aren't Rust identifiers.
This commit is contained in:
parent
529a30a682
commit
3b31ec36f1
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::Tokens;
|
use quote::Tokens;
|
||||||
use syn::{self, Ident};
|
use syn::{self, Data};
|
||||||
use synstructure::{Structure, VariantInfo};
|
use synstructure::{Structure, VariantInfo};
|
||||||
|
|
||||||
pub fn derive(input: syn::DeriveInput) -> Tokens {
|
pub fn derive(input: syn::DeriveInput) -> Tokens {
|
||||||
|
@ -124,7 +124,7 @@ fn derive_variant_arm(
|
||||||
::std::fmt::Write::write_str(dest, #identifier)
|
::std::fmt::Write::write_str(dest, #identifier)
|
||||||
}
|
}
|
||||||
} else if let Some(function) = variant_attrs.function {
|
} else if let Some(function) = variant_attrs.function {
|
||||||
let mut identifier = function.explicit().map_or(identifier, |name| name.to_string());
|
let mut identifier = function.explicit().map_or(identifier, |name| name);
|
||||||
identifier.push_str("(");
|
identifier.push_str("(");
|
||||||
expr = quote! {
|
expr = quote! {
|
||||||
::std::fmt::Write::write_str(dest, #identifier)?;
|
::std::fmt::Write::write_str(dest, #identifier)?;
|
||||||
|
@ -140,7 +140,7 @@ fn derive_variant_arm(
|
||||||
struct CssInputAttrs {
|
struct CssInputAttrs {
|
||||||
derive_debug: bool,
|
derive_debug: bool,
|
||||||
// Here because structs variants are also their whole type definition.
|
// Here because structs variants are also their whole type definition.
|
||||||
function: Option<Override<Ident>>,
|
function: Option<Override<String>>,
|
||||||
// Here because structs variants are also their whole type definition.
|
// Here because structs variants are also their whole type definition.
|
||||||
comma: bool,
|
comma: bool,
|
||||||
// Here because structs variants are also their whole type definition.
|
// Here because structs variants are also their whole type definition.
|
||||||
|
@ -150,7 +150,7 @@ struct CssInputAttrs {
|
||||||
#[darling(attributes(css), default)]
|
#[darling(attributes(css), default)]
|
||||||
#[derive(Default, FromVariant)]
|
#[derive(Default, FromVariant)]
|
||||||
pub struct CssVariantAttrs {
|
pub struct CssVariantAttrs {
|
||||||
pub function: Option<Override<Ident>>,
|
pub function: Option<Override<String>>,
|
||||||
pub iterable: bool,
|
pub iterable: bool,
|
||||||
pub comma: bool,
|
pub comma: bool,
|
||||||
pub dimension: bool,
|
pub dimension: bool,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue