Skip to content
Myr

lib.rs

This file

Path

serde_derive/src/lib.rs

127 lines · 3.6 KiB · Rust

Last changed by

Release 1.0.229David Tolnaybefore adoption7fc3b4c

History of this file

Take it

The walk stopped after 200 commits: lines older than 3761854 point at it.

Merge pull request #2745 from dtolnay/docsrsDavid Tolnaybefore adoption3761854

lines 1–15why, one step back
1//! This crate provides Serde's two derive macros.
2//!3//! ```edition20214//! # use serde_derive::{Deserialize, Serialize};5//! #6//! #[derive(Serialize, Deserialize)]7//! # struct S;8//! #9//! # fn main() {}10//! ```11//!12//! Please refer to [https://serde.rs/derive.html] for how to set this up.13//!14//! [https://serde.rs/derive.html]: https://serde.rs/derive.html15

Release 1.0.229David Tolnaybefore adoption7fc3b4c

line 16why, one step back
16#![doc(html_root_url = "https://docs.rs/serde_derive/1.0.229")]

Merge pull request #2745 from dtolnay/docsrsDavid Tolnaybefore adoption3761854

lines 17–29why, one step back
17#![cfg_attr(not(check_cfg), allow(unexpected_cfgs))]
18// Ignored clippy lints19#![allow(20 // clippy false positive: https://github.com/rust-lang/rust-clippy/issues/705421 clippy::branches_sharing_code,22 clippy::cognitive_complexity,23 // clippy bug: https://github.com/rust-lang/rust-clippy/issues/757524 clippy::collapsible_match,25 clippy::derive_partial_eq_without_eq,26 clippy::enum_variant_names,27 // clippy bug: https://github.com/rust-lang/rust-clippy/issues/679728 clippy::manual_map,29 clippy::match_like_matches_macro,

Ignore needless_lifetimes clippy lintDavid Tolnaybefore adoption4b3178b

line 30why, one step back
30 clippy::needless_lifetimes,

Merge pull request #2745 from dtolnay/docsrsDavid Tolnaybefore adoption3761854

lines 31–43why, one step back
31 clippy::needless_pass_by_value,
32 clippy::too_many_arguments,33 clippy::trivially_copy_pass_by_ref,34 clippy::used_underscore_binding,35 clippy::wildcard_in_or_patterns,36 // clippy bug: https://github.com/rust-lang/rust-clippy/issues/570437 clippy::unnested_or_patterns,38)]39// Ignored clippy_pedantic lints40#![allow(41 clippy::cast_possible_truncation,42 clippy::checked_conversions,43 clippy::doc_markdown,

Ignore elidable_lifetime_names pedantic clippy lintDavid Tolnaybefore adoptionf0d1ae0

line 44why, one step back
44 clippy::elidable_lifetime_names,

Merge pull request #2745 from dtolnay/docsrsDavid Tolnaybefore adoption3761854

lines 45–59why, one step back
45 clippy::enum_glob_use,
46 clippy::indexing_slicing,47 clippy::items_after_statements,48 clippy::let_underscore_untyped,49 clippy::manual_assert,50 clippy::map_err_ignore,51 clippy::match_same_arms,52 // clippy bug: https://github.com/rust-lang/rust-clippy/issues/698453 clippy::match_wildcard_for_single_variants,54 clippy::module_name_repetitions,55 clippy::must_use_candidate,56 clippy::similar_names,57 clippy::single_match_else,58 clippy::struct_excessive_bools,59 clippy::too_many_lines,

Ignore uninlined_format_args pedantic clippy lintDavid Tolnaybefore adoption6a7de26

line 60why, one step back
60 clippy::uninlined_format_args,

Merge pull request #2745 from dtolnay/docsrsDavid Tolnaybefore adoption3761854

lines 61–66why, one step back
61 clippy::unseparated_literal_suffix,
62 clippy::unused_self,63 clippy::use_self,64 clippy::wildcard_imports65)]66#![cfg_attr(all(test, exhaustive), feature(non_exhaustive_omitted_patterns_lint))]

Ignore mismatched_lifetime_syntaxes lintDavid Tolnaybefore adoption2130ba5

line 67why, one step back
67#![allow(unknown_lints, mismatched_lifetime_syntaxes)]

Merge pull request #2745 from dtolnay/docsrsDavid Tolnaybefore adoption3761854

lines 68–77why, one step back
68
69extern crate proc_macro2;70extern crate quote;71extern crate syn;7273extern crate proc_macro;7475mod internals;7677use proc_macro::TokenStream;

Merge pull request #2980 from dtolnay/privateDavid Tolnaybefore adoption5b37e8a

lines 78–79why, one step back
78use proc_macro2::{Ident, Span};
79use quote::{ToTokens, TokenStreamExt as _};

Merge pull request #2745 from dtolnay/docsrsDavid Tolnaybefore adoption3761854

lines 80–88why, one step back
80use syn::parse_macro_input;
81use syn::DeriveInput;8283#[macro_use]84mod bound;85#[macro_use]86mod fragment;8788mod de;

Touch up PR 2879David Tolnaybefore adoption97168d3

line 89why, one step back
89mod deprecated;

Merge pull request #2745 from dtolnay/docsrsDavid Tolnaybefore adoption3761854

lines 90–93why, one step back
90mod dummy;
91mod pretend;92mod ser;93mod this;

Merge pull request #2980 from dtolnay/privateDavid Tolnaybefore adoption5b37e8a

lines 94–111why, one step back
94
95#[allow(non_camel_case_types)]96struct private;9798impl private {99 fn ident(&self) -> Ident {100 Ident::new(101 concat!("__private", env!("CARGO_PKG_VERSION_PATCH")),102 Span::call_site(),103 )104 }105}106107impl ToTokens for private {108 fn to_tokens(&self, tokens: &mut proc_macro2::TokenStream) {109 tokens.append(self.ident());110 }111}

Merge pull request #2745 from dtolnay/docsrsDavid Tolnaybefore adoption3761854

lines 112–127why, one step back
112
113#[proc_macro_derive(Serialize, attributes(serde))]114pub fn derive_serialize(input: TokenStream) -> TokenStream {115 let mut input = parse_macro_input!(input as DeriveInput);116 ser::expand_derive_serialize(&mut input)117 .unwrap_or_else(syn::Error::into_compile_error)118 .into()119}120121#[proc_macro_derive(Deserialize, attributes(serde))]122pub fn derive_deserialize(input: TokenStream) -> TokenStream {123 let mut input = parse_macro_input!(input as DeriveInput);124 de::expand_derive_deserialize(&mut input)125 .unwrap_or_else(syn::Error::into_compile_error)126 .into()127}