Suppress warning about using num::Zero

This commit is contained in:
David Tolnay 2017-01-21 19:14:56 -08:00
parent 530c29466e
commit 089c7eb1d7
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -60,6 +60,7 @@ use std::time::Duration;
use core::nonzero::{NonZero, Zeroable}; use core::nonzero::{NonZero, Zeroable};
#[cfg(feature = "unstable")] #[cfg(feature = "unstable")]
#[allow(deprecated)] // required for impl Deserialize for NonZero<T>
use core::num::Zero; use core::num::Zero;
use de::{ use de::{
@ -1079,6 +1080,7 @@ impl Deserialize for Duration {
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#[cfg(feature = "unstable")] #[cfg(feature = "unstable")]
#[allow(deprecated)] // num::Zero is deprecated but there is no replacement
impl<T> Deserialize for NonZero<T> where T: Deserialize + PartialEq + Zeroable + Zero { impl<T> Deserialize for NonZero<T> where T: Deserialize + PartialEq + Zeroable + Zero {
fn deserialize<D>(deserializer: D) -> Result<NonZero<T>, D::Error> where D: Deserializer { fn deserialize<D>(deserializer: D) -> Result<NonZero<T>, D::Error> where D: Deserializer {
let value = try!(Deserialize::deserialize(deserializer)); let value = try!(Deserialize::deserialize(deserializer));