From ab90fbc7c982234788f64fc3d89c5d59c58ab767 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sun, 30 Jul 2023 21:34:06 -0700 Subject: [PATCH] Apply 'cargo fix --edition' --- serde/src/de/format.rs | 4 ++-- serde/src/de/ignored_any.rs | 4 ++-- serde/src/de/impls.rs | 32 ++++++++++++++++---------------- serde/src/de/mod.rs | 14 +++++++------- serde/src/de/seed.rs | 2 +- serde/src/de/utf8.rs | 2 +- serde/src/de/value.rs | 14 ++++++++------ serde/src/lib.rs | 4 ++-- serde/src/private/de.rs | 20 ++++++++++---------- serde/src/private/doc.rs | 4 ++-- serde/src/private/mod.rs | 22 +++++++++++----------- serde/src/private/ser.rs | 20 ++++++++++---------- serde/src/private/size_hint.rs | 2 +- serde/src/ser/fmt.rs | 4 ++-- serde/src/ser/impls.rs | 4 ++-- serde/src/ser/impossible.rs | 4 ++-- serde/src/ser/mod.rs | 8 ++++---- serde/src/std_error.rs | 2 +- 18 files changed, 84 insertions(+), 82 deletions(-) diff --git a/serde/src/de/format.rs b/serde/src/de/format.rs index f14580b8..9053cc07 100644 --- a/serde/src/de/format.rs +++ b/serde/src/de/format.rs @@ -1,5 +1,5 @@ -use lib::fmt::{self, Write}; -use lib::str; +use crate::lib::fmt::{self, Write}; +use crate::lib::str; pub(super) struct Buf<'a> { bytes: &'a mut [u8], diff --git a/serde/src/de/ignored_any.rs b/serde/src/de/ignored_any.rs index 83e221f0..a40281f4 100644 --- a/serde/src/de/ignored_any.rs +++ b/serde/src/de/ignored_any.rs @@ -1,6 +1,6 @@ -use lib::*; +use crate::lib::*; -use de::{ +use crate::de::{ Deserialize, Deserializer, EnumAccess, Error, MapAccess, SeqAccess, VariantAccess, Visitor, }; diff --git a/serde/src/de/impls.rs b/serde/src/de/impls.rs index dd13f911..ee8e3b62 100644 --- a/serde/src/de/impls.rs +++ b/serde/src/de/impls.rs @@ -1,14 +1,14 @@ -use lib::*; +use crate::lib::*; -use de::{ +use crate::de::{ Deserialize, Deserializer, EnumAccess, Error, MapAccess, SeqAccess, Unexpected, VariantAccess, Visitor, }; -use seed::InPlaceSeed; +use crate::seed::InPlaceSeed; #[cfg(any(feature = "std", feature = "alloc"))] -use __private::size_hint; +use crate::__private::size_hint; //////////////////////////////////////////////////////////////////////////////// @@ -1555,7 +1555,7 @@ impl<'de> Deserialize<'de> for net::IpAddr { if deserializer.is_human_readable() { deserializer.deserialize_str(FromStrVisitor::new("IP address")) } else { - use lib::net::IpAddr; + use crate::lib::net::IpAddr; deserialize_enum! { IpAddr IpAddrKind (V4; b"V4"; 0, V6; b"V6"; 1) "`V4` or `V6`", @@ -1598,7 +1598,7 @@ impl<'de> Deserialize<'de> for net::SocketAddr { if deserializer.is_human_readable() { deserializer.deserialize_str(FromStrVisitor::new("socket address")) } else { - use lib::net::SocketAddr; + use crate::lib::net::SocketAddr; deserialize_enum! { SocketAddr SocketAddrKind (V4; b"V4"; 0, V6; b"V6"; 1) "`V4` or `V6`", @@ -1968,7 +1968,7 @@ impl<'de> Deserialize<'de> for Duration { b"secs" => Ok(Field::Secs), b"nanos" => Ok(Field::Nanos), _ => { - let value = ::__private::from_utf8_lossy(value); + let value = crate::__private::from_utf8_lossy(value); Err(Error::unknown_field(&*value, FIELDS)) } } @@ -2259,9 +2259,9 @@ where } mod range { - use lib::*; + use crate::lib::*; - use de::{Deserialize, Deserializer, Error, MapAccess, SeqAccess, Visitor}; + use crate::de::{Deserialize, Deserializer, Error, MapAccess, SeqAccess, Visitor}; pub const FIELDS: &[&str] = &["start", "end"]; @@ -2307,7 +2307,7 @@ mod range { b"start" => Ok(Field::Start), b"end" => Ok(Field::End), _ => { - let value = ::__private::from_utf8_lossy(value); + let value = crate::__private::from_utf8_lossy(value); Err(Error::unknown_field(&*value, FIELDS)) } } @@ -2417,9 +2417,9 @@ where } mod range_from { - use lib::*; + use crate::lib::*; - use de::{Deserialize, Deserializer, Error, MapAccess, SeqAccess, Visitor}; + use crate::de::{Deserialize, Deserializer, Error, MapAccess, SeqAccess, Visitor}; pub const FIELDS: &[&str] = &["end"]; @@ -2462,7 +2462,7 @@ mod range_from { match value { b"end" => Ok(Field::End), _ => { - let value = ::__private::from_utf8_lossy(value); + let value = crate::__private::from_utf8_lossy(value); Err(Error::unknown_field(&*value, FIELDS)) } } @@ -2555,9 +2555,9 @@ where } mod range_to { - use lib::*; + use crate::lib::*; - use de::{Deserialize, Deserializer, Error, MapAccess, SeqAccess, Visitor}; + use crate::de::{Deserialize, Deserializer, Error, MapAccess, SeqAccess, Visitor}; pub const FIELDS: &[&str] = &["start"]; @@ -2600,7 +2600,7 @@ mod range_to { match value { b"start" => Ok(Field::Start), _ => { - let value = ::__private::from_utf8_lossy(value); + let value = crate::__private::from_utf8_lossy(value); Err(Error::unknown_field(&*value, FIELDS)) } } diff --git a/serde/src/de/mod.rs b/serde/src/de/mod.rs index 411b6251..ad80426e 100644 --- a/serde/src/de/mod.rs +++ b/serde/src/de/mod.rs @@ -112,7 +112,7 @@ //! [derive section of the manual]: https://serde.rs/derive.html //! [data formats]: https://serde.rs/#data-formats -use lib::*; +use crate::lib::*; //////////////////////////////////////////////////////////////////////////////// @@ -126,15 +126,15 @@ mod utf8; pub use self::ignored_any::IgnoredAny; +#[cfg(not(any(feature = "std", feature = "unstable")))] +#[doc(no_inline)] +pub use crate::std_error::Error as StdError; #[cfg(all(feature = "unstable", not(feature = "std")))] #[doc(no_inline)] pub use core::error::Error as StdError; #[cfg(feature = "std")] #[doc(no_inline)] pub use std::error::Error as StdError; -#[cfg(not(any(feature = "std", feature = "unstable")))] -#[doc(no_inline)] -pub use std_error::Error as StdError; //////////////////////////////////////////////////////////////////////////////// @@ -1229,11 +1229,11 @@ pub trait Deserializer<'de>: Sized { #[doc(hidden)] fn __deserialize_content( self, - _: ::actually_private::T, + _: crate::actually_private::T, visitor: V, - ) -> Result<::private::de::Content<'de>, Self::Error> + ) -> Result, Self::Error> where - V: Visitor<'de, Value = ::private::de::Content<'de>>, + V: Visitor<'de, Value = crate::private::de::Content<'de>>, { self.deserialize_any(visitor) } diff --git a/serde/src/de/seed.rs b/serde/src/de/seed.rs index 13b7ea46..52fb89d8 100644 --- a/serde/src/de/seed.rs +++ b/serde/src/de/seed.rs @@ -1,4 +1,4 @@ -use de::{Deserialize, DeserializeSeed, Deserializer}; +use crate::de::{Deserialize, DeserializeSeed, Deserializer}; /// A DeserializeSeed helper for implementing deserialize_in_place Visitors. /// diff --git a/serde/src/de/utf8.rs b/serde/src/de/utf8.rs index 96731cd6..16bd67e8 100644 --- a/serde/src/de/utf8.rs +++ b/serde/src/de/utf8.rs @@ -1,4 +1,4 @@ -use lib::*; +use crate::lib::*; const TAG_CONT: u8 = 0b1000_0000; const TAG_TWO_B: u8 = 0b1100_0000; diff --git a/serde/src/de/value.rs b/serde/src/de/value.rs index 0bfdd201..f9247050 100644 --- a/serde/src/de/value.rs +++ b/serde/src/de/value.rs @@ -21,12 +21,12 @@ //! } //! ``` -use lib::*; +use crate::lib::*; use self::private::{First, Second}; -use __private::size_hint; -use de::{self, Deserializer, Expected, IntoDeserializer, SeqAccess, Visitor}; -use ser; +use crate::__private::size_hint; +use crate::de::{self, Deserializer, Expected, IntoDeserializer, SeqAccess, Visitor}; +use crate::ser; //////////////////////////////////////////////////////////////////////////////// @@ -1546,9 +1546,11 @@ where //////////////////////////////////////////////////////////////////////////////// mod private { - use lib::*; + use crate::lib::*; - use de::{self, DeserializeSeed, Deserializer, MapAccess, Unexpected, VariantAccess, Visitor}; + use crate::de::{ + self, DeserializeSeed, Deserializer, MapAccess, Unexpected, VariantAccess, Visitor, + }; pub struct UnitOnly { marker: PhantomData, diff --git a/serde/src/lib.rs b/serde/src/lib.rs index 483d9b8a..38997a32 100644 --- a/serde/src/lib.rs +++ b/serde/src/lib.rs @@ -298,9 +298,9 @@ pub mod de; pub mod ser; #[doc(inline)] -pub use de::{Deserialize, Deserializer}; +pub use crate::de::{Deserialize, Deserializer}; #[doc(inline)] -pub use ser::{Serialize, Serializer}; +pub use crate::ser::{Serialize, Serializer}; // Used by generated code and doc tests. Not public API. #[doc(hidden)] diff --git a/serde/src/private/de.rs b/serde/src/private/de.rs index 15d20ce3..48ccb5bc 100644 --- a/serde/src/private/de.rs +++ b/serde/src/private/de.rs @@ -1,10 +1,10 @@ -use lib::*; +use crate::lib::*; -use de::value::{BorrowedBytesDeserializer, BytesDeserializer}; -use de::{Deserialize, Deserializer, Error, IntoDeserializer, Visitor}; +use crate::de::value::{BorrowedBytesDeserializer, BytesDeserializer}; +use crate::de::{Deserialize, Deserializer, Error, IntoDeserializer, Visitor}; #[cfg(any(feature = "std", feature = "alloc"))] -use de::{DeserializeSeed, MapAccess, Unexpected}; +use crate::de::{DeserializeSeed, MapAccess, Unexpected}; #[cfg(any(feature = "std", feature = "alloc"))] pub use self::content::{ @@ -13,7 +13,7 @@ pub use self::content::{ TagOrContentField, TagOrContentFieldVisitor, TaggedContentVisitor, UntaggedUnitVisitor, }; -pub use seed::InPlaceSeed; +pub use crate::seed::InPlaceSeed; /// If the missing field is of type `Option` then treat is as `None`, /// otherwise it is an error. @@ -203,12 +203,12 @@ mod content { // This issue is tracking making some of this stuff public: // https://github.com/serde-rs/serde/issues/741 - use lib::*; + use crate::lib::*; - use __private::size_hint; - use actually_private; - use de::value::{MapDeserializer, SeqDeserializer}; - use de::{ + use crate::__private::size_hint; + use crate::actually_private; + use crate::de::value::{MapDeserializer, SeqDeserializer}; + use crate::de::{ self, Deserialize, DeserializeSeed, Deserializer, EnumAccess, Expected, IgnoredAny, MapAccess, SeqAccess, Unexpected, Visitor, }; diff --git a/serde/src/private/doc.rs b/serde/src/private/doc.rs index f597af84..1b18fe6b 100644 --- a/serde/src/private/doc.rs +++ b/serde/src/private/doc.rs @@ -1,8 +1,8 @@ // Used only by Serde doc tests. Not public API. -use lib::*; +use crate::lib::*; -use ser; +use crate::ser; #[doc(hidden)] #[derive(Debug)] diff --git a/serde/src/private/mod.rs b/serde/src/private/mod.rs index e8969023..17f61386 100644 --- a/serde/src/private/mod.rs +++ b/serde/src/private/mod.rs @@ -8,25 +8,25 @@ pub mod size_hint; // FIXME: #[cfg(doctest)] once https://github.com/rust-lang/rust/issues/67295 is fixed. pub mod doc; -pub use lib::clone::Clone; -pub use lib::convert::{From, Into}; -pub use lib::default::Default; -pub use lib::fmt::{self, Formatter}; -pub use lib::marker::PhantomData; -pub use lib::option::Option::{self, None, Some}; -pub use lib::ptr; -pub use lib::result::Result::{self, Err, Ok}; +pub use crate::lib::clone::Clone; +pub use crate::lib::convert::{From, Into}; +pub use crate::lib::default::Default; +pub use crate::lib::fmt::{self, Formatter}; +pub use crate::lib::marker::PhantomData; +pub use crate::lib::option::Option::{self, None, Some}; +pub use crate::lib::ptr; +pub use crate::lib::result::Result::{self, Err, Ok}; pub use self::string::from_utf8_lossy; #[cfg(any(feature = "alloc", feature = "std"))] -pub use lib::{ToString, Vec}; +pub use crate::lib::{ToString, Vec}; #[cfg(not(no_core_try_from))] -pub use lib::convert::TryFrom; +pub use crate::lib::convert::TryFrom; mod string { - use lib::*; + use crate::lib::*; #[cfg(any(feature = "std", feature = "alloc"))] pub fn from_utf8_lossy(bytes: &[u8]) -> Cow { diff --git a/serde/src/private/ser.rs b/serde/src/private/ser.rs index 842440d3..016f647e 100644 --- a/serde/src/private/ser.rs +++ b/serde/src/private/ser.rs @@ -1,6 +1,6 @@ -use lib::*; +use crate::lib::*; -use ser::{self, Impossible, Serialize, SerializeMap, SerializeStruct, Serializer}; +use crate::ser::{self, Impossible, Serialize, SerializeMap, SerializeStruct, Serializer}; #[cfg(any(feature = "std", feature = "alloc"))] use self::content::{ @@ -337,9 +337,9 @@ where #[cfg(any(feature = "std", feature = "alloc"))] mod content { - use lib::*; + use crate::lib::*; - use ser::{self, Serialize, Serializer}; + use crate::ser::{self, Serialize, Serializer}; pub struct SerializeTupleVariantAsMapValue { map: M, @@ -499,7 +499,7 @@ mod content { } Content::Seq(ref elements) => elements.serialize(serializer), Content::Tuple(ref elements) => { - use ser::SerializeTuple; + use crate::ser::SerializeTuple; let mut tuple = tri!(serializer.serialize_tuple(elements.len())); for e in elements { tri!(tuple.serialize_element(e)); @@ -507,7 +507,7 @@ mod content { tuple.end() } Content::TupleStruct(n, ref fields) => { - use ser::SerializeTupleStruct; + use crate::ser::SerializeTupleStruct; let mut ts = tri!(serializer.serialize_tuple_struct(n, fields.len())); for f in fields { tri!(ts.serialize_field(f)); @@ -515,7 +515,7 @@ mod content { ts.end() } Content::TupleVariant(n, i, v, ref fields) => { - use ser::SerializeTupleVariant; + use crate::ser::SerializeTupleVariant; let mut tv = tri!(serializer.serialize_tuple_variant(n, i, v, fields.len())); for f in fields { tri!(tv.serialize_field(f)); @@ -523,7 +523,7 @@ mod content { tv.end() } Content::Map(ref entries) => { - use ser::SerializeMap; + use crate::ser::SerializeMap; let mut map = tri!(serializer.serialize_map(Some(entries.len()))); for (k, v) in entries { tri!(map.serialize_entry(k, v)); @@ -531,7 +531,7 @@ mod content { map.end() } Content::Struct(n, ref fields) => { - use ser::SerializeStruct; + use crate::ser::SerializeStruct; let mut s = tri!(serializer.serialize_struct(n, fields.len())); for &(k, ref v) in fields { tri!(s.serialize_field(k, v)); @@ -539,7 +539,7 @@ mod content { s.end() } Content::StructVariant(n, i, v, ref fields) => { - use ser::SerializeStructVariant; + use crate::ser::SerializeStructVariant; let mut sv = tri!(serializer.serialize_struct_variant(n, i, v, fields.len())); for &(k, ref v) in fields { tri!(sv.serialize_field(k, v)); diff --git a/serde/src/private/size_hint.rs b/serde/src/private/size_hint.rs index 571af496..4a4fe25d 100644 --- a/serde/src/private/size_hint.rs +++ b/serde/src/private/size_hint.rs @@ -1,4 +1,4 @@ -use lib::*; +use crate::lib::*; pub fn from_bounds(iter: &I) -> Option where diff --git a/serde/src/ser/fmt.rs b/serde/src/ser/fmt.rs index ce2d05ca..89807686 100644 --- a/serde/src/ser/fmt.rs +++ b/serde/src/ser/fmt.rs @@ -1,5 +1,5 @@ -use lib::*; -use ser::{Error, Impossible, Serialize, Serializer}; +use crate::lib::*; +use crate::ser::{Error, Impossible, Serialize, Serializer}; impl Error for fmt::Error { fn custom(_msg: T) -> Self { diff --git a/serde/src/ser/impls.rs b/serde/src/ser/impls.rs index eee40227..69366b04 100644 --- a/serde/src/ser/impls.rs +++ b/serde/src/ser/impls.rs @@ -1,6 +1,6 @@ -use lib::*; +use crate::lib::*; -use ser::{Error, Serialize, SerializeTuple, Serializer}; +use crate::ser::{Error, Serialize, SerializeTuple, Serializer}; //////////////////////////////////////////////////////////////////////////////// diff --git a/serde/src/ser/impossible.rs b/serde/src/ser/impossible.rs index 1d1d7ac8..479be940 100644 --- a/serde/src/ser/impossible.rs +++ b/serde/src/ser/impossible.rs @@ -1,8 +1,8 @@ //! This module contains `Impossible` serializer and its implementations. -use lib::*; +use crate::lib::*; -use ser::{ +use crate::ser::{ self, Serialize, SerializeMap, SerializeSeq, SerializeStruct, SerializeStructVariant, SerializeTuple, SerializeTupleStruct, SerializeTupleVariant, }; diff --git a/serde/src/ser/mod.rs b/serde/src/ser/mod.rs index 326c4166..24f87ad6 100644 --- a/serde/src/ser/mod.rs +++ b/serde/src/ser/mod.rs @@ -107,7 +107,7 @@ //! [derive section of the manual]: https://serde.rs/derive.html //! [data formats]: https://serde.rs/#data-formats -use lib::*; +use crate::lib::*; mod fmt; mod impls; @@ -115,15 +115,15 @@ mod impossible; pub use self::impossible::Impossible; +#[cfg(not(any(feature = "std", feature = "unstable")))] +#[doc(no_inline)] +pub use crate::std_error::Error as StdError; #[cfg(all(feature = "unstable", not(feature = "std")))] #[doc(no_inline)] pub use core::error::Error as StdError; #[cfg(feature = "std")] #[doc(no_inline)] pub use std::error::Error as StdError; -#[cfg(not(any(feature = "std", feature = "unstable")))] -#[doc(no_inline)] -pub use std_error::Error as StdError; //////////////////////////////////////////////////////////////////////////////// diff --git a/serde/src/std_error.rs b/serde/src/std_error.rs index fca023d1..f15a4d74 100644 --- a/serde/src/std_error.rs +++ b/serde/src/std_error.rs @@ -1,4 +1,4 @@ -use lib::{Debug, Display}; +use crate::lib::{Debug, Display}; /// Either a re-export of std::error::Error or a new identical trait, depending /// on whether Serde's "std" feature is enabled.