From 8084258a3edc1dc4007e8df7f24b022d015b5fb0 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Tue, 20 Oct 2020 19:17:50 -0700 Subject: [PATCH 1/8] Update ui tests to nightly-2020-10-20 --- test_suite/tests/ui/remote/wrong_de.stderr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test_suite/tests/ui/remote/wrong_de.stderr b/test_suite/tests/ui/remote/wrong_de.stderr index 370a41ef1..937667481 100644 --- a/test_suite/tests/ui/remote/wrong_de.stderr +++ b/test_suite/tests/ui/remote/wrong_de.stderr @@ -5,6 +5,6 @@ error[E0308]: mismatched types | ^^^^^^^^^^^ | | | expected `u16`, found `u8` - | help: you can convert an `u8` to `u16`: `Deserialize.into()` + | help: you can convert a `u8` to a `u16`: `Deserialize.into()` | = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) From 0d5b6c180c8383feea6a213afa667af333623575 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Tue, 27 Oct 2020 19:18:27 -0700 Subject: [PATCH 2/8] Resolve ptr_eq clippy lint error: use `std::ptr::eq` when comparing raw pointers --> serde_derive/src/de.rs:362:12 | 362 | if field as *const Field == transparent_field as *const Field { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::eq(field, transparent_field)` | note: the lint level is defined here --> serde_derive/src/lib.rs:18:9 | 18 | #![deny(clippy::all, clippy::pedantic)] | ^^^^^^^^^^^ = note: `#[deny(clippy::ptr_eq)]` implied by `#[deny(clippy::all)]` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_eq --- serde_derive/src/de.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/serde_derive/src/de.rs b/serde_derive/src/de.rs index 1f5733a6d..55ab808bc 100644 --- a/serde_derive/src/de.rs +++ b/serde_derive/src/de.rs @@ -12,6 +12,7 @@ use internals::{attr, ungroup, Ctxt, Derive}; use pretend; use std::collections::BTreeSet; +use std::ptr; pub fn expand_derive_deserialize(input: &syn::DeriveInput) -> Result> { let ctxt = Ctxt::new(); @@ -359,7 +360,7 @@ fn deserialize_transparent(cont: &Container, params: &Parameters) -> Fragment { let assign = fields.iter().map(|field| { let member = &field.member; - if field as *const Field == transparent_field as *const Field { + if ptr::eq(field, transparent_field) { quote!(#member: __transparent) } else { let value = match field.attrs.default() { From 0e1c4093c857d4550573386a1da907707ca6af17 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Tue, 27 Oct 2020 19:20:45 -0700 Subject: [PATCH 3/8] Suppress new result_unit_err clippy lint --- serde/src/lib.rs | 1 + serde_derive_internals/lib.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/serde/src/lib.rs b/serde/src/lib.rs index 0acf0583a..61b1af21a 100644 --- a/serde/src/lib.rs +++ b/serde/src/lib.rs @@ -119,6 +119,7 @@ // correctly used enum_glob_use, map_err_ignore, + result_unit_err, wildcard_imports, // not practical needless_pass_by_value, diff --git a/serde_derive_internals/lib.rs b/serde_derive_internals/lib.rs index ce96383b8..5bc767569 100644 --- a/serde_derive_internals/lib.rs +++ b/serde_derive_internals/lib.rs @@ -6,6 +6,7 @@ allow( cognitive_complexity, redundant_field_names, + result_unit_err, trivially_copy_pass_by_ref, wildcard_in_or_patterns, // clippy bug: https://github.com/rust-lang/rust-clippy/issues/5704 From e3d871ff7bf10dadf10bdc234a55692228358d0e Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sat, 31 Oct 2020 13:28:19 -0700 Subject: [PATCH 4/8] Opt in to experimental trybuild diffs --- test_suite/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test_suite/Cargo.toml b/test_suite/Cargo.toml index b0ddbb8af..53effd4eb 100644 --- a/test_suite/Cargo.toml +++ b/test_suite/Cargo.toml @@ -23,4 +23,4 @@ rustversion = "1.0" serde = { path = "../serde", features = ["rc", "derive"] } serde_derive = { path = "../serde_derive", features = ["deserialize_in_place"] } serde_test = { path = "../serde_test" } -trybuild = "1.0" +trybuild = { version = "1.0.19", features = ["diff"] } From ede40bdfaaba943928629295db6b84d8d3bdc76a Mon Sep 17 00:00:00 2001 From: William Hua Date: Tue, 24 Nov 2020 00:50:59 -0500 Subject: [PATCH 5/8] Allow serializing of Wrapping without std --- serde/src/de/impls.rs | 1 - serde/src/lib.rs | 3 +-- serde/src/ser/impls.rs | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/serde/src/de/impls.rs b/serde/src/de/impls.rs index ae4f9dc80..557144d1f 100644 --- a/serde/src/de/impls.rs +++ b/serde/src/de/impls.rs @@ -2570,7 +2570,6 @@ where //////////////////////////////////////////////////////////////////////////////// -#[cfg(feature = "std")] impl<'de, T> Deserialize<'de> for Wrapping where T: Deserialize<'de>, diff --git a/serde/src/lib.rs b/serde/src/lib.rs index 61b1af21a..da6b5ab02 100644 --- a/serde/src/lib.rs +++ b/serde/src/lib.rs @@ -166,6 +166,7 @@ mod lib { pub use self::core::default::{self, Default}; 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; pub use self::core::option::{self, Option}; pub use self::core::result::{self, Result}; @@ -217,8 +218,6 @@ mod lib { #[cfg(feature = "std")] pub use std::io::Write; #[cfg(feature = "std")] - pub use std::num::Wrapping; - #[cfg(feature = "std")] pub use std::path::{Path, PathBuf}; #[cfg(feature = "std")] pub use std::sync::{Mutex, RwLock}; diff --git a/serde/src/ser/impls.rs b/serde/src/ser/impls.rs index 40e48ba9d..431a478cc 100644 --- a/serde/src/ser/impls.rs +++ b/serde/src/ser/impls.rs @@ -824,7 +824,6 @@ impl Serialize for OsString { //////////////////////////////////////////////////////////////////////////////// -#[cfg(feature = "std")] impl Serialize for Wrapping where T: Serialize, From 192c7819eede472d73389c5901adf21bc25c0966 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sat, 28 Nov 2020 19:06:37 -0800 Subject: [PATCH 6/8] Format with rustfmt 1.4.25-beta --- serde/src/de/impls.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/serde/src/de/impls.rs b/serde/src/de/impls.rs index ae4f9dc80..aeb1abd18 100644 --- a/serde/src/de/impls.rs +++ b/serde/src/de/impls.rs @@ -2334,10 +2334,7 @@ where 0 => Ok(Field::Unbounded), 1 => Ok(Field::Included), 2 => Ok(Field::Excluded), - _ => Err(Error::invalid_value( - Unexpected::Unsigned(value), - &self, - )), + _ => Err(Error::invalid_value(Unexpected::Unsigned(value), &self)), } } @@ -2499,10 +2496,7 @@ where match value { 0 => Ok(Field::Ok), 1 => Ok(Field::Err), - _ => Err(Error::invalid_value( - Unexpected::Unsigned(value), - &self, - )), + _ => Err(Error::invalid_value(Unexpected::Unsigned(value), &self)), } } From 84721920fd24380bad5f09501470d3ebfae1a525 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sat, 28 Nov 2020 19:08:09 -0800 Subject: [PATCH 7/8] Resolve clippy items_after_statements lint error: adding items after statements is confusing, since items exist from the start of the scope --> serde/src/de/impls.rs:1876:9 | 1876 | / impl<'de> Deserialize<'de> for Field { 1877 | | fn deserialize(deserializer: D) -> Result 1878 | | where 1879 | | D: Deserializer<'de>, ... | 1917 | | } 1918 | | } | |_________^ | note: the lint level is defined here --> serde/src/lib.rs:95:52 | 95 | #![cfg_attr(feature = "cargo-clippy", deny(clippy, clippy_pedantic))] | ^^^^^^^^^^^^^^^ = note: `#[deny(clippy::items_after_statements)]` implied by `#[deny(clippy::pedantic)]` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#items_after_statements error: adding items after statements is confusing, since items exist from the start of the scope --> serde/src/de/impls.rs:1920:9 | 1920 | struct DurationVisitor; | ^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#items_after_statements error: adding items after statements is confusing, since items exist from the start of the scope --> serde/src/de/impls.rs:1922:9 | 1922 | / impl<'de> Visitor<'de> for DurationVisitor { 1923 | | type Value = Duration; 1924 | | 1925 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { ... | 1979 | | } 1980 | | } | |_________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#items_after_statements error: adding items after statements is confusing, since items exist from the start of the scope --> serde/src/de/impls.rs:1982:9 | 1982 | const FIELDS: &'static [&'static str] = &["secs", "nanos"]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#items_after_statements error: adding items after statements is confusing, since items exist from the start of the scope --> serde/src/de/impls.rs:2001:9 | 2001 | / impl<'de> Deserialize<'de> for Field { 2002 | | fn deserialize(deserializer: D) -> Result 2003 | | where 2004 | | D: Deserializer<'de>, ... | 2042 | | } 2043 | | } | |_________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#items_after_statements error: adding items after statements is confusing, since items exist from the start of the scope --> serde/src/de/impls.rs:2045:9 | 2045 | struct DurationVisitor; | ^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#items_after_statements error: adding items after statements is confusing, since items exist from the start of the scope --> serde/src/de/impls.rs:2047:9 | 2047 | / impl<'de> Visitor<'de> for DurationVisitor { 2048 | | type Value = Duration; 2049 | | 2050 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { ... | 2108 | | } 2109 | | } | |_________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#items_after_statements error: adding items after statements is confusing, since items exist from the start of the scope --> serde/src/de/impls.rs:2111:9 | 2111 | const FIELDS: &'static [&'static str] = &["secs_since_epoch", "nanos_since_epoch"]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#items_after_statements --- serde/src/de/impls.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/serde/src/de/impls.rs b/serde/src/de/impls.rs index aeb1abd18..91dce4029 100644 --- a/serde/src/de/impls.rs +++ b/serde/src/de/impls.rs @@ -1871,7 +1871,7 @@ impl<'de> Deserialize<'de> for Duration { enum Field { Secs, Nanos, - }; + } impl<'de> Deserialize<'de> for Field { fn deserialize(deserializer: D) -> Result @@ -1996,7 +1996,7 @@ impl<'de> Deserialize<'de> for SystemTime { enum Field { Secs, Nanos, - }; + } impl<'de> Deserialize<'de> for Field { fn deserialize(deserializer: D) -> Result From e7974312681c9c1c54f7586e86b0d7013b350a54 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sat, 5 Dec 2020 13:45:47 -0800 Subject: [PATCH 8/8] Release 1.0.118 --- serde/Cargo.toml | 4 ++-- serde/src/lib.rs | 2 +- serde_derive/Cargo.toml | 2 +- serde_derive/src/lib.rs | 2 +- serde_test/Cargo.toml | 2 +- serde_test/src/lib.rs | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/serde/Cargo.toml b/serde/Cargo.toml index 5fc7a37bd..a04ee8e57 100644 --- a/serde/Cargo.toml +++ b/serde/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "serde" -version = "1.0.117" # remember to update html_root_url and serde_derive dependency +version = "1.0.118" # remember to update html_root_url and serde_derive dependency authors = ["Erick Tryzelaar ", "David Tolnay "] license = "MIT OR Apache-2.0" description = "A generic serialization/deserialization framework" @@ -14,7 +14,7 @@ include = ["build.rs", "src/**/*.rs", "crates-io.md", "README.md", "LICENSE-APAC build = "build.rs" [dependencies] -serde_derive = { version = "=1.0.117", optional = true, path = "../serde_derive" } +serde_derive = { version = "=1.0.118", optional = true, path = "../serde_derive" } [dev-dependencies] serde_derive = { version = "1.0", path = "../serde_derive" } diff --git a/serde/src/lib.rs b/serde/src/lib.rs index da6b5ab02..12154da25 100644 --- a/serde/src/lib.rs +++ b/serde/src/lib.rs @@ -82,7 +82,7 @@ //////////////////////////////////////////////////////////////////////////////// // Serde types in rustdoc of other crates get linked to here. -#![doc(html_root_url = "https://docs.rs/serde/1.0.117")] +#![doc(html_root_url = "https://docs.rs/serde/1.0.118")] // Support using Serde without the standard library! #![cfg_attr(not(feature = "std"), no_std)] // Unstable functionality only if the user asks for it. For tracking and diff --git a/serde_derive/Cargo.toml b/serde_derive/Cargo.toml index 4dfdd92b1..ed08716c2 100644 --- a/serde_derive/Cargo.toml +++ b/serde_derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "serde_derive" -version = "1.0.117" # remember to update html_root_url +version = "1.0.118" # remember to update html_root_url authors = ["Erick Tryzelaar ", "David Tolnay "] license = "MIT OR Apache-2.0" description = "Macros 1.1 implementation of #[derive(Serialize, Deserialize)]" diff --git a/serde_derive/src/lib.rs b/serde_derive/src/lib.rs index 1711340ba..266bc9ded 100644 --- a/serde_derive/src/lib.rs +++ b/serde_derive/src/lib.rs @@ -13,7 +13,7 @@ //! //! [https://serde.rs/derive.html]: https://serde.rs/derive.html -#![doc(html_root_url = "https://docs.rs/serde_derive/1.0.117")] +#![doc(html_root_url = "https://docs.rs/serde_derive/1.0.118")] #![allow(unknown_lints, bare_trait_objects)] #![deny(clippy::all, clippy::pedantic)] // Ignored clippy lints diff --git a/serde_test/Cargo.toml b/serde_test/Cargo.toml index 8fed31904..84c2fb889 100644 --- a/serde_test/Cargo.toml +++ b/serde_test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "serde_test" -version = "1.0.117" # remember to update html_root_url +version = "1.0.118" # remember to update html_root_url authors = ["Erick Tryzelaar ", "David Tolnay "] license = "MIT OR Apache-2.0" description = "Token De/Serializer for testing De/Serialize implementations" diff --git a/serde_test/src/lib.rs b/serde_test/src/lib.rs index cca0a4fa1..3a3efe352 100644 --- a/serde_test/src/lib.rs +++ b/serde_test/src/lib.rs @@ -144,7 +144,7 @@ //! # } //! ``` -#![doc(html_root_url = "https://docs.rs/serde_test/1.0.117")] +#![doc(html_root_url = "https://docs.rs/serde_test/1.0.118")] #![cfg_attr(feature = "cargo-clippy", allow(renamed_and_removed_lints))] #![cfg_attr(feature = "cargo-clippy", deny(clippy, clippy_pedantic))] // Ignored clippy lints