Skip to content

Commit

Permalink
Delete unuseful RangeFull impls
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Jul 6, 2023
1 parent 0fca04e commit e6a4a37
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 46 deletions.
34 changes: 0 additions & 34 deletions serde/src/de/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2708,40 +2708,6 @@ mod range_to {

////////////////////////////////////////////////////////////////////////////////

// Similar to:
//
// #[derive(Deserialize)]
// #[serde(deny_unknown_fields)]
// struct RangeFull;
impl<'de> Deserialize<'de> for RangeFull {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: Deserializer<'de>,
{
deserializer.deserialize_unit_struct("RangeFull", RangeFullVisitor)
}
}

struct RangeFullVisitor;

impl<'de> Visitor<'de> for RangeFullVisitor {
type Value = RangeFull;

fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
formatter.write_str("unit")
}

#[inline]
fn visit_unit<E>(self) -> Result<Self::Value, E>
where
E: Error,
{
Ok(..)
}
}

////////////////////////////////////////////////////////////////////////////////

#[cfg(any(not(no_ops_bound), all(feature = "std", not(no_collections_bound))))]
impl<'de, T> Deserialize<'de> for Bound<T>
where
Expand Down
2 changes: 1 addition & 1 deletion serde/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ mod lib {
pub use self::core::fmt::{self, Debug, Display};
pub use self::core::marker::{self, PhantomData};
pub use self::core::num::Wrapping;
pub use self::core::ops::{Range, RangeFrom, RangeFull, RangeTo};
pub use self::core::ops::{Range, RangeFrom, RangeTo};
pub use self::core::option::{self, Option};
pub use self::core::result::{self, Result};

Expand Down
11 changes: 0 additions & 11 deletions serde/src/ser/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,17 +274,6 @@ where

////////////////////////////////////////////////////////////////////////////////

impl Serialize for RangeFull {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
serializer.serialize_unit_struct("RangeFull")
}
}

////////////////////////////////////////////////////////////////////////////////

#[cfg(not(no_range_inclusive))]
impl<Idx> Serialize for RangeInclusive<Idx>
where
Expand Down

0 comments on commit e6a4a37

Please sign in to comment.