mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-27 14:37:55 +00:00
Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a916aa9420 | |||
| d9c63d0784 | |||
| 41dcb969e8 | |||
| 6dbaea34ba | |||
| ce17301b8b | |||
| b0e78c6be4 | |||
| 898f65fa46 | |||
| 84e384196d | |||
| d827b101d9 | |||
| c45ab6b304 | |||
| cc9d85b293 | |||
| 02493d83be | |||
| a1280c672a | |||
| a740f76772 |
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.66" # remember to update html_root_url
|
version = "1.0.68" # remember to update html_root_url
|
||||||
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
|
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
|
||||||
license = "MIT/Apache-2.0"
|
license = "MIT/Apache-2.0"
|
||||||
description = "A generic serialization/deserialization framework"
|
description = "A generic serialization/deserialization framework"
|
||||||
|
|||||||
+1
-5
@@ -593,11 +593,7 @@ pub trait Deserialize<'de>: Sized {
|
|||||||
///
|
///
|
||||||
/// [Understanding deserializer lifetimes]: https://serde.rs/lifetimes.html
|
/// [Understanding deserializer lifetimes]: https://serde.rs/lifetimes.html
|
||||||
pub trait DeserializeOwned: for<'de> Deserialize<'de> {}
|
pub trait DeserializeOwned: for<'de> Deserialize<'de> {}
|
||||||
impl<T> DeserializeOwned for T
|
impl<T> DeserializeOwned for T where T: for<'de> Deserialize<'de> {}
|
||||||
where
|
|
||||||
T: for<'de> Deserialize<'de>,
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// `DeserializeSeed` is the stateful form of the `Deserialize` trait. If you
|
/// `DeserializeSeed` is the stateful form of the `Deserialize` trait. If you
|
||||||
/// ever find yourself looking for a way to pass data into a `Deserialize` impl,
|
/// ever find yourself looking for a way to pass data into a `Deserialize` impl,
|
||||||
|
|||||||
+6
-2
@@ -82,7 +82,7 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Serde types in rustdoc of other crates get linked to here.
|
// Serde types in rustdoc of other crates get linked to here.
|
||||||
#![doc(html_root_url = "https://docs.rs/serde/1.0.66")]
|
#![doc(html_root_url = "https://docs.rs/serde/1.0.68")]
|
||||||
// Support using Serde without the standard library!
|
// Support using Serde without the standard library!
|
||||||
#![cfg_attr(not(feature = "std"), no_std)]
|
#![cfg_attr(not(feature = "std"), no_std)]
|
||||||
// Unstable functionality only if the user asks for it. For tracking and
|
// Unstable functionality only if the user asks for it. For tracking and
|
||||||
@@ -118,6 +118,7 @@
|
|||||||
stutter,
|
stutter,
|
||||||
use_self,
|
use_self,
|
||||||
// not practical
|
// not practical
|
||||||
|
indexing_slicing,
|
||||||
many_single_char_names,
|
many_single_char_names,
|
||||||
missing_docs_in_private_items,
|
missing_docs_in_private_items,
|
||||||
similar_names,
|
similar_names,
|
||||||
@@ -126,7 +127,10 @@
|
|||||||
use_debug,
|
use_debug,
|
||||||
))]
|
))]
|
||||||
// Blacklisted Rust lints.
|
// Blacklisted Rust lints.
|
||||||
#![deny(missing_docs, unused_imports)]
|
//
|
||||||
|
// Compiler bug involving unused_imports:
|
||||||
|
// https://github.com/rust-lang/rust/issues/51661
|
||||||
|
#![deny(missing_docs, /*unused_imports*/)]
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|||||||
@@ -69,6 +69,15 @@ impl Serialize for String {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'a> Serialize for fmt::Arguments<'a> {
|
||||||
|
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||||
|
where
|
||||||
|
S: Serializer,
|
||||||
|
{
|
||||||
|
serializer.collect_str(self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "serde_derive"
|
name = "serde_derive"
|
||||||
version = "1.0.66" # remember to update html_root_url
|
version = "1.0.68" # remember to update html_root_url
|
||||||
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
|
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
|
||||||
license = "MIT/Apache-2.0"
|
license = "MIT/Apache-2.0"
|
||||||
description = "Macros 1.1 implementation of #[derive(Serialize, Deserialize)]"
|
description = "Macros 1.1 implementation of #[derive(Serialize, Deserialize)]"
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ pub fn with_bound(
|
|||||||
lifetimes: None,
|
lifetimes: None,
|
||||||
// the type parameter that is being bounded e.g. T
|
// the type parameter that is being bounded e.g. T
|
||||||
bounded_ty: syn::Type::Path(bounded_ty),
|
bounded_ty: syn::Type::Path(bounded_ty),
|
||||||
colon_token: Default::default(),
|
colon_token: <Token![:]>::default(),
|
||||||
// the bound e.g. Serialize
|
// the bound e.g. Serialize
|
||||||
bounds: vec![syn::TypeParamBound::Trait(syn::TraitBound {
|
bounds: vec![syn::TypeParamBound::Trait(syn::TraitBound {
|
||||||
paren_token: None,
|
paren_token: None,
|
||||||
@@ -233,7 +233,7 @@ pub fn with_self_bound(
|
|||||||
lifetimes: None,
|
lifetimes: None,
|
||||||
// the type that is being bounded e.g. MyStruct<'a, T>
|
// the type that is being bounded e.g. MyStruct<'a, T>
|
||||||
bounded_ty: type_of_item(cont),
|
bounded_ty: type_of_item(cont),
|
||||||
colon_token: Default::default(),
|
colon_token: <Token![:]>::default(),
|
||||||
// the bound e.g. Default
|
// the bound e.g. Default
|
||||||
bounds: vec![syn::TypeParamBound::Trait(syn::TraitBound {
|
bounds: vec![syn::TypeParamBound::Trait(syn::TraitBound {
|
||||||
paren_token: None,
|
paren_token: None,
|
||||||
@@ -289,7 +289,7 @@ fn type_of_item(cont: &Container) -> syn::Type {
|
|||||||
arguments: syn::PathArguments::AngleBracketed(
|
arguments: syn::PathArguments::AngleBracketed(
|
||||||
syn::AngleBracketedGenericArguments {
|
syn::AngleBracketedGenericArguments {
|
||||||
colon2_token: None,
|
colon2_token: None,
|
||||||
lt_token: Default::default(),
|
lt_token: <Token![<]>::default(),
|
||||||
args: cont
|
args: cont
|
||||||
.generics
|
.generics
|
||||||
.params
|
.params
|
||||||
@@ -309,7 +309,7 @@ fn type_of_item(cont: &Container) -> syn::Type {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.collect(),
|
.collect(),
|
||||||
gt_token: Default::default(),
|
gt_token: <Token![>]>::default(),
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
}].into_iter()
|
}].into_iter()
|
||||||
|
|||||||
@@ -73,6 +73,9 @@ pub fn expand_derive_deserialize(input: &syn::DeriveInput) -> Result<TokenStream
|
|||||||
let generated = quote! {
|
let generated = quote! {
|
||||||
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
|
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
|
||||||
const #dummy_const: () = {
|
const #dummy_const: () = {
|
||||||
|
#[allow(unknown_lints)]
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(useless_attribute))]
|
||||||
|
#[allow(rust_2018_idioms)]
|
||||||
extern crate serde as _serde;
|
extern crate serde as _serde;
|
||||||
#try_replacement
|
#try_replacement
|
||||||
#impl_block
|
#impl_block
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
//!
|
//!
|
||||||
//! [https://serde.rs/derive.html]: https://serde.rs/derive.html
|
//! [https://serde.rs/derive.html]: https://serde.rs/derive.html
|
||||||
|
|
||||||
#![doc(html_root_url = "https://docs.rs/serde_derive/1.0.66")]
|
#![doc(html_root_url = "https://docs.rs/serde_derive/1.0.68")]
|
||||||
#![cfg_attr(feature = "cargo-clippy", deny(clippy, clippy_pedantic))]
|
#![cfg_attr(feature = "cargo-clippy", deny(clippy, clippy_pedantic))]
|
||||||
// Whitelisted clippy lints
|
// Whitelisted clippy lints
|
||||||
#![cfg_attr(
|
#![cfg_attr(
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
feature = "cargo-clippy",
|
feature = "cargo-clippy",
|
||||||
allow(
|
allow(
|
||||||
items_after_statements, doc_markdown, stutter, similar_names, use_self, single_match_else,
|
items_after_statements, doc_markdown, stutter, similar_names, use_self, single_match_else,
|
||||||
enum_glob_use, match_same_arms, filter_map, cast_possible_truncation
|
enum_glob_use, match_same_arms, filter_map, cast_possible_truncation, indexing_slicing,
|
||||||
)
|
)
|
||||||
)]
|
)]
|
||||||
// The `quote!` macro requires deep recursion.
|
// The `quote!` macro requires deep recursion.
|
||||||
|
|||||||
@@ -61,6 +61,9 @@ pub fn expand_derive_serialize(input: &syn::DeriveInput) -> Result<TokenStream,
|
|||||||
let generated = quote! {
|
let generated = quote! {
|
||||||
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
|
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
|
||||||
const #dummy_const: () = {
|
const #dummy_const: () = {
|
||||||
|
#[allow(unknown_lints)]
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(useless_attribute))]
|
||||||
|
#[allow(rust_2018_idioms)]
|
||||||
extern crate serde as _serde;
|
extern crate serde as _serde;
|
||||||
#try_replacement
|
#try_replacement
|
||||||
#impl_block
|
#impl_block
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "serde_test"
|
name = "serde_test"
|
||||||
version = "1.0.66" # remember to update html_root_url
|
version = "1.0.68" # remember to update html_root_url
|
||||||
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
|
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
|
||||||
license = "MIT/Apache-2.0"
|
license = "MIT/Apache-2.0"
|
||||||
description = "Token De/Serializer for testing De/Serialize implementations"
|
description = "Token De/Serializer for testing De/Serialize implementations"
|
||||||
|
|||||||
@@ -161,7 +161,7 @@
|
|||||||
//! # }
|
//! # }
|
||||||
//! ```
|
//! ```
|
||||||
|
|
||||||
#![doc(html_root_url = "https://docs.rs/serde_test/1.0.66")]
|
#![doc(html_root_url = "https://docs.rs/serde_test/1.0.68")]
|
||||||
#![cfg_attr(feature = "cargo-clippy", deny(clippy, clippy_pedantic))]
|
#![cfg_attr(feature = "cargo-clippy", deny(clippy, clippy_pedantic))]
|
||||||
// Whitelisted clippy lints
|
// Whitelisted clippy lints
|
||||||
#![cfg_attr(feature = "cargo-clippy", allow(float_cmp))]
|
#![cfg_attr(feature = "cargo-clippy", allow(float_cmp))]
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(lang_items, start)]
|
#![feature(lang_items, start, panic_implementation)]
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
extern crate libc;
|
extern crate libc;
|
||||||
@@ -20,13 +20,8 @@ fn start(_argc: isize, _argv: *const *const u8) -> isize {
|
|||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn rust_eh_personality() {}
|
pub extern "C" fn rust_eh_personality() {}
|
||||||
|
|
||||||
#[lang = "panic_fmt"]
|
#[panic_implementation]
|
||||||
#[no_mangle]
|
fn panic(_info: &core::panic::PanicInfo) -> ! {
|
||||||
pub extern "C" fn rust_begin_panic(
|
|
||||||
_msg: core::fmt::Arguments,
|
|
||||||
_file: &'static str,
|
|
||||||
_line: u32,
|
|
||||||
) -> ! {
|
|
||||||
unsafe {
|
unsafe {
|
||||||
libc::abort();
|
libc::abort();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -462,6 +462,11 @@ declare_tests! {
|
|||||||
Token::SeqEnd,
|
Token::SeqEnd,
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
test_fmt_arguments {
|
||||||
|
format_args!("{}{}", 1, 'a') => &[
|
||||||
|
Token::Str("1a"),
|
||||||
|
],
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
declare_tests! {
|
declare_tests! {
|
||||||
|
|||||||
Reference in New Issue
Block a user