mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-23 18:48:03 +00:00
368784949e
* move to cargo clippy instead of using the clippy plugin fixes #729 * non-exectable scripts must be run with `sh` * don't build serde in the clippy travis job * only run clippy tests if installing clippy succeeds * why is travis so picky? * no more serde_codegen * serde_test_suite_deps has no features * don't use empty loops, llvm optimizes them to undefined behaviour * abort the clippy job when clippy lints are triggered * use caches on travis to speed up builds * why are we even using `travis-cargo`? * need to reinstall clippy frequently due to nightly updates * command line tools are hard
37 lines
1.0 KiB
Rust
37 lines
1.0 KiB
Rust
#![cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))]
|
|
#![cfg_attr(feature = "cargo-clippy", allow(used_underscore_binding))]
|
|
|
|
// The `quote!` macro requires deep recursion.
|
|
#![recursion_limit = "192"]
|
|
|
|
extern crate syn;
|
|
#[macro_use]
|
|
extern crate quote;
|
|
|
|
extern crate serde_codegen_internals as internals;
|
|
|
|
extern crate proc_macro;
|
|
use proc_macro::TokenStream;
|
|
|
|
mod bound;
|
|
mod de;
|
|
mod ser;
|
|
|
|
#[proc_macro_derive(Serialize, attributes(serde))]
|
|
pub fn derive_serialize(input: TokenStream) -> TokenStream {
|
|
let input = syn::parse_derive_input(&input.to_string()).unwrap();
|
|
match ser::expand_derive_serialize(&input) {
|
|
Ok(expanded) => expanded.parse().unwrap(),
|
|
Err(msg) => panic!(msg),
|
|
}
|
|
}
|
|
|
|
#[proc_macro_derive(Deserialize, attributes(serde))]
|
|
pub fn derive_deserialize(input: TokenStream) -> TokenStream {
|
|
let input = syn::parse_derive_input(&input.to_string()).unwrap();
|
|
match de::expand_derive_deserialize(&input) {
|
|
Ok(expanded) => expanded.parse().unwrap(),
|
|
Err(msg) => panic!(msg),
|
|
}
|
|
}
|