Skip to content

Commit

Permalink
Merge pull request #2546 from dtolnay/edition
Browse files Browse the repository at this point in the history
Update to 2018 edition
  • Loading branch information
dtolnay authored Jul 31, 2023
2 parents 9388433 + 0d7349f commit 339dca8
Show file tree
Hide file tree
Showing 21 changed files with 98 additions and 101 deletions.
22 changes: 8 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,28 +72,22 @@ jobs:
if: matrix.os != 'windows'

build:
name: Rust 1.34.0
name: Rust ${{matrix.rust}}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
rust: [1.31.0, 1.34.0]
timeout-minutes: 45
steps:
- uses: actions/checkout@v3
- uses: dtolnay/[email protected]
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{matrix.rust}}
- run: cd serde && cargo build --features rc
- run: cd serde && cargo build --no-default-features
- run: cd serde && cargo build

more:
name: Rust 1.28.0
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v3
- uses: dtolnay/[email protected]
# Work around failing to parse manifest because editions are unstable.
- run: sed -i /test_suite/d Cargo.toml
- run: cd serde && cargo build --no-default-features
- run: cd serde && cargo build

derive:
name: Rust 1.56.0
runs-on: ubuntu-latest
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Serde   [![Build Status]][actions] [![Latest Version]][crates.io] [![serde: rustc 1.28+]][Rust 1.28] [![serde_derive: rustc 1.56+]][Rust 1.56]
# Serde   [![Build Status]][actions] [![Latest Version]][crates.io] [![serde: rustc 1.31+]][Rust 1.31] [![serde_derive: rustc 1.56+]][Rust 1.56]

[Build Status]: https://img.shields.io/github/actions/workflow/status/serde-rs/serde/ci.yml?branch=master
[actions]: https://github.com/serde-rs/serde/actions?query=branch%3Amaster
[Latest Version]: https://img.shields.io/crates/v/serde.svg
[crates.io]: https://crates.io/crates/serde
[serde: rustc 1.28+]: https://img.shields.io/badge/serde-rustc_1.28+-lightgray.svg
[serde: rustc 1.31+]: https://img.shields.io/badge/serde-rustc_1.31+-lightgray.svg
[serde_derive: rustc 1.56+]: https://img.shields.io/badge/serde_derive-rustc_1.56+-lightgray.svg
[Rust 1.28]: https://blog.rust-lang.org/2018/08/02/Rust-1.28.html
[Rust 1.31]: https://blog.rust-lang.org/2018/12/06/Rust-1.31-and-rust-2018.html
[Rust 1.56]: https://blog.rust-lang.org/2021/10/21/Rust-1.56.0.html

**Serde is a framework for *ser*ializing and *de*serializing Rust data structures efficiently and generically.**
Expand Down
3 changes: 2 additions & 1 deletion serde/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ build = "build.rs"
categories = ["encoding", "no-std", "no-std::no-alloc"]
description = "A generic serialization/deserialization framework"
documentation = "https://docs.rs/serde"
edition = "2018"
homepage = "https://serde.rs"
keywords = ["serde", "serialization", "no_std"]
license = "MIT OR Apache-2.0"
readme = "crates-io.md"
repository = "https://github.com/serde-rs/serde"
rust-version = "1.28"
rust-version = "1.31"

[dependencies]
serde_derive = { version = "=1.0.179", optional = true, path = "../serde_derive" }
Expand Down
4 changes: 2 additions & 2 deletions serde/src/de/format.rs
Original file line number Diff line number Diff line change
@@ -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],
Expand Down
4 changes: 2 additions & 2 deletions serde/src/de/ignored_any.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use lib::*;
use crate::lib::*;

use de::{
use crate::de::{
Deserialize, Deserializer, EnumAccess, Error, MapAccess, SeqAccess, VariantAccess, Visitor,
};

Expand Down
32 changes: 16 additions & 16 deletions serde/src/de/impls.rs
Original file line number Diff line number Diff line change
@@ -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;

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

Expand Down Expand Up @@ -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`",
Expand Down Expand Up @@ -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`",
Expand Down Expand Up @@ -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))
}
}
Expand Down Expand Up @@ -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"];

Expand Down Expand Up @@ -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))
}
}
Expand Down Expand Up @@ -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"];

Expand Down Expand Up @@ -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))
}
}
Expand Down Expand Up @@ -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"];

Expand Down Expand Up @@ -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))
}
}
Expand Down
14 changes: 7 additions & 7 deletions serde/src/de/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;

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

Expand All @@ -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;

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

Expand Down Expand Up @@ -1229,11 +1229,11 @@ pub trait Deserializer<'de>: Sized {
#[doc(hidden)]
fn __deserialize_content<V>(
self,
_: ::actually_private::T,
_: crate::actually_private::T,
visitor: V,
) -> Result<::private::de::Content<'de>, Self::Error>
) -> Result<crate::private::de::Content<'de>, Self::Error>
where
V: Visitor<'de, Value = ::private::de::Content<'de>>,
V: Visitor<'de, Value = crate::private::de::Content<'de>>,
{
self.deserialize_any(visitor)
}
Expand Down
2 changes: 1 addition & 1 deletion serde/src/de/seed.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use de::{Deserialize, DeserializeSeed, Deserializer};
use crate::de::{Deserialize, DeserializeSeed, Deserializer};

/// A DeserializeSeed helper for implementing deserialize_in_place Visitors.
///
Expand Down
2 changes: 1 addition & 1 deletion serde/src/de/utf8.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use lib::*;
use crate::lib::*;

const TAG_CONT: u8 = 0b1000_0000;
const TAG_TWO_B: u8 = 0b1100_0000;
Expand Down
14 changes: 8 additions & 6 deletions serde/src/de/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

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

Expand Down Expand Up @@ -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<E> {
marker: PhantomData<E>,
Expand Down
6 changes: 3 additions & 3 deletions serde/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ mod lib {
pub use std::collections::{BTreeMap, BTreeSet, BinaryHeap, LinkedList, VecDeque};

#[cfg(all(not(no_core_cstr), not(feature = "std")))]
pub use core::ffi::CStr;
pub use self::core::ffi::CStr;
#[cfg(feature = "std")]
pub use std::ffi::CStr;

Expand Down Expand Up @@ -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)]
Expand Down
20 changes: 10 additions & 10 deletions serde/src/private/de.rs
Original file line number Diff line number Diff line change
@@ -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::{
Expand All @@ -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<T>` then treat is as `None`,
/// otherwise it is an error.
Expand Down Expand Up @@ -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,
};
Expand Down
4 changes: 2 additions & 2 deletions serde/src/private/doc.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
22 changes: 11 additions & 11 deletions serde/src/private/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<str> {
Expand Down
Loading

0 comments on commit 339dca8

Please sign in to comment.