diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 22b778b96..ab3041616 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,25 +23,22 @@ jobs: - run: cd test_suite && cargo test --features unstable -- --skip ui --exact stable: - name: Rust stable + name: Rust ${{matrix.rust}} runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + rust: [stable, beta] steps: - uses: actions/checkout@v2 - - uses: dtolnay/rust-toolchain@stable + - 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_test && cargo build - run: cd serde_test && cargo test --features serde/derive,serde/rc - beta: - name: Rust beta - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: dtolnay/rust-toolchain@beta - - run: cd serde && cargo build --features rc - - run: cd test_suite && cargo test - nightly: name: Rust nightly ${{matrix.os == 'windows' && '(windows)' || ''}} runs-on: ${{matrix.os}}-latest diff --git a/serde/Cargo.toml b/serde/Cargo.toml index 6488d903c..9f4f5de98 100644 --- a/serde/Cargo.toml +++ b/serde/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "serde" -version = "1.0.125" # remember to update html_root_url and serde_derive dependency +version = "1.0.126" # 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.125", optional = true, path = "../serde_derive" } +serde_derive = { version = "=1.0.126", 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 5c07ece21..fd473b370 100644 --- a/serde/src/lib.rs +++ b/serde/src/lib.rs @@ -84,7 +84,7 @@ //////////////////////////////////////////////////////////////////////////////// // Serde types in rustdoc of other crates get linked to here. -#![doc(html_root_url = "https://docs.rs/serde/1.0.125")] +#![doc(html_root_url = "https://docs.rs/serde/1.0.126")] // 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 0f6624155..d19254744 100644 --- a/serde_derive/Cargo.toml +++ b/serde_derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "serde_derive" -version = "1.0.125" # remember to update html_root_url +version = "1.0.126" # 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/bound.rs b/serde_derive/src/bound.rs index 0949dfc5d..6d7402cb4 100644 --- a/serde_derive/src/bound.rs +++ b/serde_derive/src/bound.rs @@ -49,7 +49,7 @@ pub fn with_where_predicates_from_fields( let predicates = cont .data .all_fields() - .flat_map(|field| from_field(&field.attrs)) + .filter_map(|field| from_field(&field.attrs)) .flat_map(|predicates| predicates.to_vec()); let mut generics = generics.clone(); @@ -71,7 +71,7 @@ pub fn with_where_predicates_from_variants( let predicates = variants .iter() - .flat_map(|variant| from_variant(&variant.attrs)) + .filter_map(|variant| from_variant(&variant.attrs)) .flat_map(|predicates| predicates.to_vec()); let mut generics = generics.clone(); diff --git a/serde_derive/src/dummy.rs b/serde_derive/src/dummy.rs index 9a4e5f085..29de26012 100644 --- a/serde_derive/src/dummy.rs +++ b/serde_derive/src/dummy.rs @@ -23,7 +23,7 @@ pub fn wrap_in_const( use #path as _serde; }, None => quote! { - #[allow(rust_2018_idioms, clippy::useless_attribute)] + #[allow(unused_extern_crates, clippy::useless_attribute)] extern crate serde as _serde; }, }; diff --git a/serde_derive/src/lib.rs b/serde_derive/src/lib.rs index 84728f123..8daa36e70 100644 --- a/serde_derive/src/lib.rs +++ b/serde_derive/src/lib.rs @@ -13,11 +13,13 @@ //! //! [https://serde.rs/derive.html]: https://serde.rs/derive.html -#![doc(html_root_url = "https://docs.rs/serde_derive/1.0.125")] +#![doc(html_root_url = "https://docs.rs/serde_derive/1.0.126")] #![allow(unknown_lints, bare_trait_objects)] #![deny(clippy::all, clippy::pedantic)] // Ignored clippy lints #![allow( + // clippy false positive: https://github.com/rust-lang/rust-clippy/issues/7054 + clippy::branches_sharing_code, clippy::cognitive_complexity, clippy::enum_variant_names, // clippy bug: https://github.com/rust-lang/rust-clippy/issues/6797 @@ -37,12 +39,13 @@ clippy::checked_conversions, clippy::doc_markdown, clippy::enum_glob_use, - clippy::filter_map, clippy::indexing_slicing, clippy::items_after_statements, clippy::let_underscore_drop, clippy::map_err_ignore, clippy::match_same_arms, + // clippy bug: https://github.com/rust-lang/rust-clippy/issues/6984 + clippy::match_wildcard_for_single_variants, clippy::module_name_repetitions, clippy::must_use_candidate, clippy::option_if_let_else, diff --git a/serde_derive_internals/Cargo.toml b/serde_derive_internals/Cargo.toml index 81c9e20d5..fea1b474e 100644 --- a/serde_derive_internals/Cargo.toml +++ b/serde_derive_internals/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "serde_derive_internals" -version = "0.25.0" # remember to update html_root_url +version = "0.26.0" # remember to update html_root_url authors = ["Erick Tryzelaar ", "David Tolnay "] license = "MIT OR Apache-2.0" description = "AST representation used by Serde derive macros. Unstable." diff --git a/serde_derive_internals/build.rs b/serde_derive_internals/build.rs new file mode 100644 index 000000000..b2a2d04ab --- /dev/null +++ b/serde_derive_internals/build.rs @@ -0,0 +1,12 @@ +use std::path::Path; + +fn main() { + // Sometimes on Windows the git checkout does not correctly wire up the + // symlink from serde_derive_internals/src to serde_derive/src/internals. + // When this happens we'll just build based on relative paths within the git + // repo. + let mod_behind_symlink = Path::new("src/mod.rs"); + if !mod_behind_symlink.exists() { + println!("cargo:rustc-cfg=serde_build_from_git"); + } +} diff --git a/serde_derive_internals/lib.rs b/serde_derive_internals/lib.rs index fe67d1f46..1f8ff187b 100644 --- a/serde_derive_internals/lib.rs +++ b/serde_derive_internals/lib.rs @@ -1,4 +1,4 @@ -#![doc(html_root_url = "https://docs.rs/serde_derive_internals/0.25.0")] +#![doc(html_root_url = "https://docs.rs/serde_derive_internals/0.26.0")] #![allow(unknown_lints, bare_trait_objects)] #![deny(clippy::all, clippy::pedantic)] // Ignored clippy lints @@ -22,6 +22,8 @@ clippy::items_after_statements, clippy::let_underscore_drop, clippy::match_same_arms, + // clippy bug: https://github.com/rust-lang/rust-clippy/issues/6984 + clippy::match_wildcard_for_single_variants, clippy::missing_errors_doc, clippy::module_name_repetitions, clippy::must_use_candidate, @@ -38,7 +40,8 @@ extern crate syn; extern crate proc_macro2; extern crate quote; -#[path = "src/mod.rs"] +#[cfg_attr(serde_build_from_git, path = "../serde_derive/src/internals/mod.rs")] +#[cfg_attr(not(serde_build_from_git), path = "src/mod.rs")] mod internals; pub use internals::*; diff --git a/serde_test/Cargo.toml b/serde_test/Cargo.toml index 68028c79e..0237d1816 100644 --- a/serde_test/Cargo.toml +++ b/serde_test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "serde_test" -version = "1.0.125" # remember to update html_root_url +version = "1.0.126" # 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 a925c916d..c29d31741 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.125")] +#![doc(html_root_url = "https://docs.rs/serde_test/1.0.126")] #![cfg_attr(feature = "cargo-clippy", allow(renamed_and_removed_lints))] #![cfg_attr(feature = "cargo-clippy", deny(clippy, clippy_pedantic))] // Ignored clippy lints @@ -153,6 +153,7 @@ #![cfg_attr( feature = "cargo-clippy", allow( + cloned_instead_of_copied, empty_line_after_outer_attr, missing_docs_in_private_items, missing_panics_doc, diff --git a/test_suite/tests/expand/de_enum.expanded.rs b/test_suite/tests/expand/de_enum.expanded.rs index 0aa879e75..4ea3b8383 100644 --- a/test_suite/tests/expand/de_enum.expanded.rs +++ b/test_suite/tests/expand/de_enum.expanded.rs @@ -10,7 +10,7 @@ enum DeEnum { #[doc(hidden)] #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] const _: () = { - #[allow(rust_2018_idioms, clippy::useless_attribute)] + #[allow(unused_extern_crates, clippy::useless_attribute)] extern crate serde as _serde; #[automatically_derived] impl _serde::Serialize for DeEnum @@ -265,7 +265,7 @@ const _: () = { #[doc(hidden)] #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] const _: () = { - #[allow(rust_2018_idioms, clippy::useless_attribute)] + #[allow(unused_extern_crates, clippy::useless_attribute)] extern crate serde as _serde; #[automatically_derived] impl<'de, B, C, D> _serde::Deserialize<'de> for DeEnum diff --git a/test_suite/tests/expand/default_ty_param.expanded.rs b/test_suite/tests/expand/default_ty_param.expanded.rs index d24ce254b..829e65e8e 100644 --- a/test_suite/tests/expand/default_ty_param.expanded.rs +++ b/test_suite/tests/expand/default_ty_param.expanded.rs @@ -11,7 +11,7 @@ struct DefaultTyParam = i32> { #[doc(hidden)] #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] const _: () = { - #[allow(rust_2018_idioms, clippy::useless_attribute)] + #[allow(unused_extern_crates, clippy::useless_attribute)] extern crate serde as _serde; #[automatically_derived] impl> _serde::Serialize for DefaultTyParam { @@ -49,7 +49,7 @@ const _: () = { #[doc(hidden)] #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] const _: () = { - #[allow(rust_2018_idioms, clippy::useless_attribute)] + #[allow(unused_extern_crates, clippy::useless_attribute)] extern crate serde as _serde; #[automatically_derived] impl<'de, T: AssociatedType> _serde::Deserialize<'de> for DefaultTyParam { diff --git a/test_suite/tests/expand/generic_enum.expanded.rs b/test_suite/tests/expand/generic_enum.expanded.rs index d2d8658d7..a4ad31094 100644 --- a/test_suite/tests/expand/generic_enum.expanded.rs +++ b/test_suite/tests/expand/generic_enum.expanded.rs @@ -8,7 +8,7 @@ pub enum GenericEnum { #[doc(hidden)] #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] const _: () = { - #[allow(rust_2018_idioms, clippy::useless_attribute)] + #[allow(unused_extern_crates, clippy::useless_attribute)] extern crate serde as _serde; #[automatically_derived] impl _serde::Serialize for GenericEnum @@ -114,7 +114,7 @@ const _: () = { #[doc(hidden)] #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] const _: () = { - #[allow(rust_2018_idioms, clippy::useless_attribute)] + #[allow(unused_extern_crates, clippy::useless_attribute)] extern crate serde as _serde; #[automatically_derived] impl<'de, T, U> _serde::Deserialize<'de> for GenericEnum diff --git a/test_suite/tests/expand/generic_struct.expanded.rs b/test_suite/tests/expand/generic_struct.expanded.rs index d57460c3b..bb16dc3b2 100644 --- a/test_suite/tests/expand/generic_struct.expanded.rs +++ b/test_suite/tests/expand/generic_struct.expanded.rs @@ -5,7 +5,7 @@ pub struct GenericStruct { #[doc(hidden)] #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] const _: () = { - #[allow(rust_2018_idioms, clippy::useless_attribute)] + #[allow(unused_extern_crates, clippy::useless_attribute)] extern crate serde as _serde; #[automatically_derived] impl _serde::Serialize for GenericStruct @@ -42,7 +42,7 @@ const _: () = { #[doc(hidden)] #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] const _: () = { - #[allow(rust_2018_idioms, clippy::useless_attribute)] + #[allow(unused_extern_crates, clippy::useless_attribute)] extern crate serde as _serde; #[automatically_derived] impl<'de, T> _serde::Deserialize<'de> for GenericStruct @@ -410,7 +410,7 @@ pub struct GenericNewTypeStruct(T); #[doc(hidden)] #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] const _: () = { - #[allow(rust_2018_idioms, clippy::useless_attribute)] + #[allow(unused_extern_crates, clippy::useless_attribute)] extern crate serde as _serde; #[automatically_derived] impl _serde::Serialize for GenericNewTypeStruct @@ -435,7 +435,7 @@ const _: () = { #[doc(hidden)] #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] const _: () = { - #[allow(rust_2018_idioms, clippy::useless_attribute)] + #[allow(unused_extern_crates, clippy::useless_attribute)] extern crate serde as _serde; #[automatically_derived] impl<'de, T> _serde::Deserialize<'de> for GenericNewTypeStruct diff --git a/test_suite/tests/expand/generic_tuple_struct.expanded.rs b/test_suite/tests/expand/generic_tuple_struct.expanded.rs index f387b6af4..7012f9f40 100644 --- a/test_suite/tests/expand/generic_tuple_struct.expanded.rs +++ b/test_suite/tests/expand/generic_tuple_struct.expanded.rs @@ -3,7 +3,7 @@ pub struct GenericTupleStruct(T, U); #[doc(hidden)] #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] const _: () = { - #[allow(rust_2018_idioms, clippy::useless_attribute)] + #[allow(unused_extern_crates, clippy::useless_attribute)] extern crate serde as _serde; #[automatically_derived] impl<'de, T, U> _serde::Deserialize<'de> for GenericTupleStruct diff --git a/test_suite/tests/expand/lifetimes.expanded.rs b/test_suite/tests/expand/lifetimes.expanded.rs index f8ec1df75..cf2f00811 100644 --- a/test_suite/tests/expand/lifetimes.expanded.rs +++ b/test_suite/tests/expand/lifetimes.expanded.rs @@ -8,7 +8,7 @@ enum Lifetimes<'a> { #[doc(hidden)] #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] const _: () = { - #[allow(rust_2018_idioms, clippy::useless_attribute)] + #[allow(unused_extern_crates, clippy::useless_attribute)] extern crate serde as _serde; #[automatically_derived] impl<'a> _serde::Serialize for Lifetimes<'a> { @@ -95,7 +95,7 @@ const _: () = { #[doc(hidden)] #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] const _: () = { - #[allow(rust_2018_idioms, clippy::useless_attribute)] + #[allow(unused_extern_crates, clippy::useless_attribute)] extern crate serde as _serde; #[automatically_derived] impl<'de, 'a> _serde::Deserialize<'de> for Lifetimes<'a> { diff --git a/test_suite/tests/expand/named_map.expanded.rs b/test_suite/tests/expand/named_map.expanded.rs index 1a621b57f..e30ac34e4 100644 --- a/test_suite/tests/expand/named_map.expanded.rs +++ b/test_suite/tests/expand/named_map.expanded.rs @@ -7,7 +7,7 @@ struct SerNamedMap<'a, 'b, A: 'a, B: 'b, C> { #[doc(hidden)] #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] const _: () = { - #[allow(rust_2018_idioms, clippy::useless_attribute)] + #[allow(unused_extern_crates, clippy::useless_attribute)] extern crate serde as _serde; #[automatically_derived] impl<'a, 'b, A: 'a, B: 'b, C> _serde::Serialize for SerNamedMap<'a, 'b, A, B, C> @@ -63,7 +63,7 @@ struct DeNamedMap { #[doc(hidden)] #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] const _: () = { - #[allow(rust_2018_idioms, clippy::useless_attribute)] + #[allow(unused_extern_crates, clippy::useless_attribute)] extern crate serde as _serde; #[automatically_derived] impl<'de, A, B, C> _serde::Deserialize<'de> for DeNamedMap diff --git a/test_suite/tests/expand/named_tuple.expanded.rs b/test_suite/tests/expand/named_tuple.expanded.rs index 707ca0762..be083f633 100644 --- a/test_suite/tests/expand/named_tuple.expanded.rs +++ b/test_suite/tests/expand/named_tuple.expanded.rs @@ -3,7 +3,7 @@ struct SerNamedTuple<'a, 'b, A: 'a, B: 'b, C>(&'a A, &'b mut B, C); #[doc(hidden)] #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] const _: () = { - #[allow(rust_2018_idioms, clippy::useless_attribute)] + #[allow(unused_extern_crates, clippy::useless_attribute)] extern crate serde as _serde; #[automatically_derived] impl<'a, 'b, A: 'a, B: 'b, C> _serde::Serialize for SerNamedTuple<'a, 'b, A, B, C> @@ -55,7 +55,7 @@ struct DeNamedTuple(A, B, C); #[doc(hidden)] #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] const _: () = { - #[allow(rust_2018_idioms, clippy::useless_attribute)] + #[allow(unused_extern_crates, clippy::useless_attribute)] extern crate serde as _serde; #[automatically_derived] impl<'de, A, B, C> _serde::Deserialize<'de> for DeNamedTuple diff --git a/test_suite/tests/expand/named_unit.expanded.rs b/test_suite/tests/expand/named_unit.expanded.rs index 44329246d..87876b771 100644 --- a/test_suite/tests/expand/named_unit.expanded.rs +++ b/test_suite/tests/expand/named_unit.expanded.rs @@ -3,7 +3,7 @@ struct NamedUnit; #[doc(hidden)] #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] const _: () = { - #[allow(rust_2018_idioms, clippy::useless_attribute)] + #[allow(unused_extern_crates, clippy::useless_attribute)] extern crate serde as _serde; #[automatically_derived] impl _serde::Serialize for NamedUnit { @@ -21,7 +21,7 @@ const _: () = { #[doc(hidden)] #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] const _: () = { - #[allow(rust_2018_idioms, clippy::useless_attribute)] + #[allow(unused_extern_crates, clippy::useless_attribute)] extern crate serde as _serde; #[automatically_derived] impl<'de> _serde::Deserialize<'de> for NamedUnit { diff --git a/test_suite/tests/expand/ser_enum.expanded.rs b/test_suite/tests/expand/ser_enum.expanded.rs index 40b45e07f..b0a83ca3f 100644 --- a/test_suite/tests/expand/ser_enum.expanded.rs +++ b/test_suite/tests/expand/ser_enum.expanded.rs @@ -13,7 +13,7 @@ where #[doc(hidden)] #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] const _: () = { - #[allow(rust_2018_idioms, clippy::useless_attribute)] + #[allow(unused_extern_crates, clippy::useless_attribute)] extern crate serde as _serde; #[automatically_derived] impl<'a, B: 'a, C: 'a, D> _serde::Serialize for SerEnum<'a, B, C, D> diff --git a/test_suite/tests/expand/void.expanded.rs b/test_suite/tests/expand/void.expanded.rs index 65c3d2c60..35e6763d7 100644 --- a/test_suite/tests/expand/void.expanded.rs +++ b/test_suite/tests/expand/void.expanded.rs @@ -3,7 +3,7 @@ enum Void {} #[doc(hidden)] #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] const _: () = { - #[allow(rust_2018_idioms, clippy::useless_attribute)] + #[allow(unused_extern_crates, clippy::useless_attribute)] extern crate serde as _serde; #[automatically_derived] impl _serde::Serialize for Void { @@ -21,7 +21,7 @@ const _: () = { #[doc(hidden)] #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] const _: () = { - #[allow(rust_2018_idioms, clippy::useless_attribute)] + #[allow(unused_extern_crates, clippy::useless_attribute)] extern crate serde as _serde; #[automatically_derived] impl<'de> _serde::Deserialize<'de> for Void { diff --git a/test_suite/tests/test_gen.rs b/test_suite/tests/test_gen.rs index 002885ead..309b164b1 100644 --- a/test_suite/tests/test_gen.rs +++ b/test_suite/tests/test_gen.rs @@ -3,7 +3,6 @@ // types involved. #![deny(warnings)] -#![cfg_attr(feature = "unstable", feature(non_ascii_idents))] #![allow( unknown_lints, mixed_script_confusables, @@ -267,7 +266,6 @@ fn test_gen() { } assert::(); - #[cfg(feature = "unstable")] #[derive(Serialize, Deserialize)] struct NonAsciiIdents { σ: f64, diff --git a/test_suite/tests/test_macros.rs b/test_suite/tests/test_macros.rs index a6f130272..fea59e0e6 100644 --- a/test_suite/tests/test_macros.rs +++ b/test_suite/tests/test_macros.rs @@ -1923,7 +1923,7 @@ fn test_internally_tagged_newtype_variant_containing_unit_struct() { ); } -#[deny(safe_packed_borrows)] +#[deny(unaligned_references)] #[test] fn test_packed_struct_can_derive_serialize() { #[derive(Copy, Clone, Serialize)]