cleanup some deprecation warnings
This commit is contained in:
parent
503ce310f5
commit
b5e64abba1
@ -2,10 +2,8 @@
|
||||
use core::any::TypeId;
|
||||
use core::fmt::{Debug, Display};
|
||||
|
||||
|
||||
/// A stand-in for `std::error::Error`, which requires no allocation.
|
||||
#[cfg(feature = "unstable")]
|
||||
pub trait Error: Debug + Display + ::core::marker::Reflect {
|
||||
pub trait Error: Debug + Display {
|
||||
/// A short description of the error.
|
||||
///
|
||||
/// The description should not contain newlines or sentence-ending
|
||||
@ -22,23 +20,3 @@ pub trait Error: Debug + Display + ::core::marker::Reflect {
|
||||
TypeId::of::<Self>()
|
||||
}
|
||||
}
|
||||
|
||||
/// A stand-in for `std::error::Error`, which requires no allocation.
|
||||
#[cfg(not(feature = "unstable"))]
|
||||
pub trait Error: Debug + Display {
|
||||
/// A short description of the error.
|
||||
///
|
||||
/// The description should not contain newlines or sentence-ending
|
||||
/// punctuation, to facilitate embedding in larger user-facing
|
||||
/// strings.
|
||||
fn description(&self) -> &str;
|
||||
|
||||
/// The lower-level cause of this error, if any.
|
||||
fn cause(&self) -> Option<&Error> { None }
|
||||
|
||||
/// Stubbed! Returns type_id of `()`
|
||||
#[doc(hidden)]
|
||||
fn type_id(&self) -> TypeId where Self: 'static {
|
||||
TypeId::of::<()>()
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
#![doc(html_root_url="https://docs.serde.rs")]
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
#![cfg_attr(feature = "unstable", feature(reflect_marker, unicode, nonzero, plugin, step_trait, zero_one))]
|
||||
#![cfg_attr(feature = "unstable", feature(reflect_marker, unicode, nonzero, plugin, step_trait, zero_one, inclusive_range))]
|
||||
#![cfg_attr(feature = "alloc", feature(alloc))]
|
||||
#![cfg_attr(feature = "collections", feature(collections, enumset))]
|
||||
#![cfg_attr(feature = "clippy", plugin(clippy))]
|
||||
|
@ -324,15 +324,31 @@ impl<T> Serialize for VecDeque<T>
|
||||
|
||||
#[cfg(feature = "unstable")]
|
||||
impl<A> Serialize for ops::Range<A>
|
||||
where A: Serialize + Clone + iter::Step + num::One,
|
||||
for<'a> &'a A: ops::Add<&'a A, Output = A>,
|
||||
where ops::Range<A>: ExactSizeIterator + iter::Iterator<Item = A> + Clone,
|
||||
A: Serialize,
|
||||
{
|
||||
#[inline]
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where S: Serializer,
|
||||
{
|
||||
let len = iter::Step::steps_between(&self.start, &self.end, &A::one());
|
||||
let mut seq = try!(serializer.serialize_seq(len));
|
||||
let mut seq = try!(serializer.serialize_seq(Some(self.len())));
|
||||
for e in self.clone() {
|
||||
try!(seq.serialize_element(e));
|
||||
}
|
||||
seq.end()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "unstable")]
|
||||
impl<A> Serialize for ops::RangeInclusive<A>
|
||||
where ops::RangeInclusive<A>: ExactSizeIterator + iter::Iterator<Item = A> + Clone,
|
||||
A: Serialize,
|
||||
{
|
||||
#[inline]
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where S: Serializer,
|
||||
{
|
||||
let mut seq = try!(serializer.serialize_seq(Some(self.len())));
|
||||
for e in self.clone() {
|
||||
try!(seq.serialize_element(e));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user