More efficient try!() alternative

This commit is contained in:
David Tolnay
2018-04-21 10:51:32 -07:00
parent 382f3c2771
commit 6a8c39b2aa
4 changed files with 32 additions and 0 deletions
+3
View File
@@ -16,6 +16,7 @@ use bound;
use fragment::{Expr, Fragment, Match, Stmts};
use internals::ast::{Container, Data, Field, Style, Variant};
use internals::{self, attr};
use try;
use std::collections::BTreeSet;
@@ -63,10 +64,12 @@ pub fn expand_derive_deserialize(input: &syn::DeriveInput) -> Result<Tokens, Str
}
};
let try_replacement = try::replacement();
let generated = quote! {
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
const #dummy_const: () = {
extern crate serde as _serde;
#try_replacement
#impl_block
};
};