mirror of
https://github.com/servo/servo.git
synced 2025-07-30 18:50:36 +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 darling::util::Override;
|
||||
use quote::{ToTokens, Tokens};
|
||||
use syn::{self, Data, GenericParam, Path, WhereClause};
|
||||
use syn::{self, Data, Path, WhereClause};
|
||||
use synstructure::{BindingInfo, Structure, VariantInfo};
|
||||
|
||||
pub fn derive(mut input: syn::DeriveInput) -> Tokens {
|
||||
let mut where_clause = input.generics.where_clause.take();
|
||||
for param in &input.generics.params {
|
||||
let param = match *param {
|
||||
GenericParam::Type(ref param) => param,
|
||||
_ => continue,
|
||||
};
|
||||
for param in input.generics.type_params() {
|
||||
cg::add_predicate(
|
||||
&mut where_clause,
|
||||
parse_quote!(#param: ::style_traits::ToCss),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue