mirror of
https://github.com/servo/servo.git
synced 2025-08-02 04:00:32 +01:00
Simplify some code in #[derive(ToCss)]
This commit is contained in:
parent
324e22db03
commit
02b0f71d45
1 changed files with 2 additions and 6 deletions
|
@ -5,16 +5,12 @@
|
||||||
use cg;
|
use cg;
|
||||||
use darling::util::Override;
|
use darling::util::Override;
|
||||||
use quote::{ToTokens, Tokens};
|
use quote::{ToTokens, Tokens};
|
||||||
use syn::{self, Data, GenericParam, Path, WhereClause};
|
use syn::{self, Data, Path, WhereClause};
|
||||||
use synstructure::{BindingInfo, Structure, VariantInfo};
|
use synstructure::{BindingInfo, Structure, VariantInfo};
|
||||||
|
|
||||||
pub fn derive(mut input: syn::DeriveInput) -> Tokens {
|
pub fn derive(mut input: syn::DeriveInput) -> Tokens {
|
||||||
let mut where_clause = input.generics.where_clause.take();
|
let mut where_clause = input.generics.where_clause.take();
|
||||||
for param in &input.generics.params {
|
for param in input.generics.type_params() {
|
||||||
let param = match *param {
|
|
||||||
GenericParam::Type(ref param) => param,
|
|
||||||
_ => continue,
|
|
||||||
};
|
|
||||||
cg::add_predicate(
|
cg::add_predicate(
|
||||||
&mut where_clause,
|
&mut where_clause,
|
||||||
parse_quote!(#param: ::style_traits::ToCss),
|
parse_quote!(#param: ::style_traits::ToCss),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue