mirror of
https://github.com/serde-rs/serde.git
synced 2025-10-02 15:25:38 +00:00
Remove impls for NonZero<T>
This commit is contained in:
parent
f58000cb41
commit
593bcb087d
@ -2005,24 +2005,6 @@ where
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#[cfg(feature = "unstable")]
|
|
||||||
#[allow(deprecated)]
|
|
||||||
impl<'de, T> Deserialize<'de> for NonZero<T>
|
|
||||||
where
|
|
||||||
T: Deserialize<'de> + Zeroable,
|
|
||||||
{
|
|
||||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
|
||||||
where
|
|
||||||
D: Deserializer<'de>,
|
|
||||||
{
|
|
||||||
let value = try!(Deserialize::deserialize(deserializer));
|
|
||||||
match NonZero::new(value) {
|
|
||||||
Some(nonzero) => Ok(nonzero),
|
|
||||||
None => Err(Error::custom("expected a non-zero value")),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
macro_rules! nonzero_integers {
|
macro_rules! nonzero_integers {
|
||||||
( $( $T: ty, )+ ) => {
|
( $( $T: ty, )+ ) => {
|
||||||
$(
|
$(
|
||||||
|
@ -98,7 +98,6 @@
|
|||||||
//! - Path
|
//! - Path
|
||||||
//! - PathBuf
|
//! - PathBuf
|
||||||
//! - Range\<T\>
|
//! - Range\<T\>
|
||||||
//! - NonZero\<T\> (unstable, deprecated)
|
|
||||||
//! - num::NonZero* (unstable)
|
//! - num::NonZero* (unstable)
|
||||||
//! - **Net types**:
|
//! - **Net types**:
|
||||||
//! - IpAddr
|
//! - IpAddr
|
||||||
|
@ -86,7 +86,7 @@
|
|||||||
// discussion of these features please refer to this issue:
|
// discussion of these features please refer to this issue:
|
||||||
//
|
//
|
||||||
// https://github.com/serde-rs/serde/issues/812
|
// https://github.com/serde-rs/serde/issues/812
|
||||||
#![cfg_attr(feature = "unstable", feature(nonzero, specialization))]
|
#![cfg_attr(feature = "unstable", feature(specialization))]
|
||||||
#![cfg_attr(feature = "alloc", feature(alloc))]
|
#![cfg_attr(feature = "alloc", feature(alloc))]
|
||||||
#![cfg_attr(feature = "cargo-clippy", deny(clippy, clippy_pedantic))]
|
#![cfg_attr(feature = "cargo-clippy", deny(clippy, clippy_pedantic))]
|
||||||
// Whitelisted clippy lints
|
// Whitelisted clippy lints
|
||||||
@ -213,10 +213,6 @@ mod lib {
|
|||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
pub use std::time::{Duration, SystemTime, UNIX_EPOCH};
|
pub use std::time::{Duration, SystemTime, UNIX_EPOCH};
|
||||||
|
|
||||||
#[cfg(feature = "unstable")]
|
|
||||||
#[allow(deprecated)]
|
|
||||||
pub use core::nonzero::{NonZero, Zeroable};
|
|
||||||
|
|
||||||
#[cfg(feature = "unstable")]
|
#[cfg(feature = "unstable")]
|
||||||
pub use core::num::{NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU8, NonZeroUsize};
|
pub use core::num::{NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU8, NonZeroUsize};
|
||||||
}
|
}
|
||||||
|
@ -408,20 +408,6 @@ where
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#[cfg(feature = "unstable")]
|
|
||||||
#[allow(deprecated)]
|
|
||||||
impl<T> Serialize for NonZero<T>
|
|
||||||
where
|
|
||||||
T: Serialize + Zeroable + Clone,
|
|
||||||
{
|
|
||||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
|
||||||
where
|
|
||||||
S: Serializer,
|
|
||||||
{
|
|
||||||
self.clone().get().serialize(serializer)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
macro_rules! nonzero_integers {
|
macro_rules! nonzero_integers {
|
||||||
( $( $T: ident, )+ ) => {
|
( $( $T: ident, )+ ) => {
|
||||||
$(
|
$(
|
||||||
|
@ -93,7 +93,6 @@
|
|||||||
//! - Path
|
//! - Path
|
||||||
//! - PathBuf
|
//! - PathBuf
|
||||||
//! - Range\<T\>
|
//! - Range\<T\>
|
||||||
//! - NonZero\<T\> (unstable, deprecated)
|
|
||||||
//! - num::NonZero* (unstable)
|
//! - num::NonZero* (unstable)
|
||||||
//! - **Net types**:
|
//! - **Net types**:
|
||||||
//! - IpAddr
|
//! - IpAddr
|
||||||
|
Loading…
x
Reference in New Issue
Block a user