Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove impls for NonZero<T> #1265

Merged
merged 1 commit into from
May 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions serde/src/de/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
( $( $T: ty, )+ ) => {
$(
Expand Down
1 change: 0 additions & 1 deletion serde/src/de/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@
//! - Path
//! - PathBuf
//! - Range\<T\>
//! - NonZero\<T\> (unstable, deprecated)
//! - num::NonZero* (unstable)
//! - **Net types**:
//! - IpAddr
Expand Down
6 changes: 1 addition & 5 deletions serde/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
// discussion of these features please refer to this issue:
//
// 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 = "cargo-clippy", deny(clippy, clippy_pedantic))]
// Whitelisted clippy lints
Expand Down Expand Up @@ -213,10 +213,6 @@ mod lib {
#[cfg(feature = "std")]
pub use std::time::{Duration, SystemTime, UNIX_EPOCH};

#[cfg(feature = "unstable")]
#[allow(deprecated)]
pub use core::nonzero::{NonZero, Zeroable};

#[cfg(feature = "unstable")]
pub use core::num::{NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU8, NonZeroUsize};
}
Expand Down
14 changes: 0 additions & 14 deletions serde/src/ser/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
( $( $T: ident, )+ ) => {
$(
Expand Down
1 change: 0 additions & 1 deletion serde/src/ser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@
//! - Path
//! - PathBuf
//! - Range\<T\>
//! - NonZero\<T\> (unstable, deprecated)
//! - num::NonZero* (unstable)
//! - **Net types**:
//! - IpAddr
Expand Down