Compare commits

...

29 Commits

Author SHA1 Message Date
David Tolnay f63acb52dc Release 1.0.107 2020-05-08 15:45:36 -07:00
David Tolnay 36a66873cc Merge pull request #1805 from dtolnay/skip
Fix indexing bug when `skip` and `other` are combined
2020-05-08 15:43:51 -07:00
David Tolnay 63809e69c7 Fix indexing bug when skip and other are combined 2020-05-08 15:39:07 -07:00
David Tolnay f44402e224 Add regression test for issue 1804 2020-05-08 15:38:44 -07:00
David Tolnay 099fa25b86 Fix unused matrix component in name of clippy job 2020-05-06 01:53:58 -07:00
David Tolnay c120c4518b Move clippy to ci.yml gated with github.event_name != 'pull_request' 2020-05-05 22:09:35 -07:00
David Tolnay 115c1b4830 Exclude expansion tests from test suite by default
This test isn't high enough signal to have all contributors run it.
2020-05-05 21:52:37 -07:00
David Tolnay 23db3a41e7 Run expansion tests only if rustfmt is present 2020-05-05 21:50:14 -07:00
David Tolnay e2ff603587 Add Actions job to run macrotest 2020-05-05 17:41:35 -07:00
David Tolnay 19a11237b8 Regenerate macrotest *.expanded.rs files
This picks up changes from a135199ab1 and 1b35c9e27e.
2020-05-05 17:23:30 -07:00
David Tolnay 732544aed6 Update to macrotest 1.0 2020-05-05 17:23:30 -07:00
David Tolnay 65dfa607c8 Update to rustversion 1.0 2020-05-05 17:23:30 -07:00
David Tolnay 59104bbc24 Remove AppVeyor configuration 2020-05-05 17:08:09 -07:00
David Tolnay 38ad09aeb7 Add Windows CI in GitHub Actions 2020-05-05 17:08:09 -07:00
David Tolnay 02631cef42 Remove clippy from main CI workflow
We don't run clippy on PRs. It is covered by a separate clippy.yml
workflow.
2020-05-05 17:04:51 -07:00
David Tolnay f369707dc5 Update build status badge to GitHub Actions 2020-05-05 16:43:36 -07:00
David Tolnay e16e924c21 Split test suite to its own Actions job
Since this step takes the longest.
2020-05-05 16:39:36 -07:00
David Tolnay 8b52ddd5b9 Add GitHub Actions workflow to run Clippy 2020-05-05 16:34:27 -07:00
David Tolnay 112f2040ea Remove Travis configuration 2020-05-05 11:33:56 -07:00
David Tolnay cd836eb3ca Try caching Cargo index to speed up 1.13 build
This one build always took several (10+) minutes on:

    Updating registry `https://github.com/rust-lang/crates.io-index`
2020-05-03 17:59:26 -07:00
David Tolnay 2b4355724e Merge pull request #1795 from serde-rs/actions
Enable GitHub Actions
2020-05-03 02:38:48 -07:00
David Tolnay 5534bf4df1 Enable GitHub Actions 2020-05-03 02:23:04 -07:00
David Tolnay 60522937af Remove CI badge from Cargo.toml
Support for badges has been deprecated by crates.io.
2020-05-01 21:11:02 -07:00
David Tolnay 29be721f79 Work around clippy redundant_field_names bug 2020-04-23 11:21:28 -07:00
David Tolnay 0c4ffad9ec Run clippy on latest nightly that has clippy 2020-04-23 10:44:12 -07:00
David Tolnay 03addbae55 Format with rustfmt 2020-03-11 2020-04-19 17:32:11 -07:00
David Tolnay 0bab6be124 Resolve redundant_pattern_matching lint 2020-04-19 17:31:15 -07:00
David Tolnay b6def5300a Resolve redundant_field_names lint in serde_derive 2020-04-05 21:07:52 -07:00
David Tolnay 1b35c9e27e Update serde_derive to tool attrs 2020-04-05 21:00:58 -07:00
34 changed files with 319 additions and 313 deletions
+155
View File
@@ -0,0 +1,155 @@
name: CI
on:
push:
pull_request:
schedule: [cron: "40 1 * * *"]
jobs:
test:
name: Test suite
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@nightly
- run: cd test_suite && cargo test --features unstable
windows:
name: Test suite (windows)
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@nightly
- run: cd test_suite && cargo test --features unstable -- --skip ui --exact
stable:
name: Rust stable
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@stable
- 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
strategy:
fail-fast: false
matrix:
os: [ubuntu, windows]
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@nightly
- run: cd serde && cargo build
- run: cd serde && cargo build --no-default-features
- run: cd serde && cargo build --no-default-features --features alloc
- run: cd serde && cargo build --no-default-features --features rc,alloc
- run: cd serde && cargo test --features derive,rc,unstable
- run: cd test_suite/no_std && cargo build
if: matrix.os != 'windows'
msrv:
name: Rust 1.13.0
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@1.13.0
- name: Get timestamp for cache
id: date
run: echo ::set-output name=yearmo::$(date +%Y%m)
- uses: actions/cache@v1
with:
path: ~/.cargo/registry/index
key: cargo-registry-index-${{steps.date.outputs.yearmo}}
- run: cd serde && cargo build --features rc
- run: cd serde && cargo build --no-default-features
- run: cd serde_test && cargo build
build:
name: Rust ${{matrix.rust}}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
rust: [1.19.0, 1.20.0, 1.21.0, 1.25.0, 1.26.0, 1.34.0]
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{matrix.rust}}
- run: cd serde && cargo build --no-default-features
- run: cd serde && cargo build
more:
name: Rust ${{matrix.rust}}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
rust: [1.27.0, 1.28.0]
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{matrix.rust}}
# 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
alloc:
name: Rust 1.36.0
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@1.36.0
- run: cd serde && cargo build --no-default-features --features alloc
emscripten:
name: Emscripten
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@nightly
- uses: actions/setup-node@v1
with:
node-version: 9
- name: Install cargo-web
run: |
CARGO_WEB_RELEASE=$(curl -L -s -H Accept:application/json https://github.com/koute/cargo-web/releases/latest)
CARGO_WEB_VERSION=$(echo "${CARGO_WEB_RELEASE}" | jq -r .tag_name)
CARGO_WEB_URL="https://github.com/koute/cargo-web/releases/download/${CARGO_WEB_VERSION}/cargo-web-x86_64-unknown-linux-gnu.gz"
mkdir -p ~/.cargo/bin
curl -L "${CARGO_WEB_URL}" | gzip -d > ~/.cargo/bin/cargo-web
chmod +x ~/.cargo/bin/cargo-web
- run: cd test_suite && cargo web test --target=asmjs-unknown-emscripten --nodejs
continue-on-error: true
- run: cd test_suite && cargo web test --target=wasm32-unknown-emscripten --nodejs
continue-on-error: true
clippy:
name: Clippy
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@clippy
# The need for -Aredundant_field_names here is a Clippy bug.
# https://github.com/rust-lang/rust-clippy/issues/5356
- run: cd serde && cargo clippy --features rc,unstable -- -D clippy::all -A clippy::redundant_field_names
- run: cd serde_derive && cargo clippy -- -D clippy::all
- run: cd serde_test && cargo clippy -- -D clippy::all -A clippy::redundant_field_names
- run: cd test_suite && cargo clippy --tests --features unstable -- -D clippy::all -A clippy::redundant_field_names
- run: cd test_suite/no_std && cargo clippy -- -D clippy::all -A clippy::redundant_field_names
-107
View File
@@ -1,107 +0,0 @@
language: rust
matrix:
include:
- rust: stable
script:
- cd "${TRAVIS_BUILD_DIR}/serde"
- cargo build --features rc
- cargo build --no-default-features
- cd "${TRAVIS_BUILD_DIR}/serde_test"
- cargo build
- cargo test --features serde/derive,serde/rc
- rust: beta
script:
- cd "${TRAVIS_BUILD_DIR}/serde"
- cargo build --features rc
- cd "${TRAVIS_BUILD_DIR}/test_suite"
- cargo test
- rust: nightly
script:
- cd "${TRAVIS_BUILD_DIR}/serde"
- cargo build
- cargo build --no-default-features
- cargo build --no-default-features --features alloc
- cargo build --no-default-features --features rc,alloc
- cargo test --features derive,rc,unstable
- cd "${TRAVIS_BUILD_DIR}/test_suite"
- cargo test --features unstable
- cd "${TRAVIS_BUILD_DIR}/test_suite/no_std"
- cargo build
- rust: 1.13.0
script:
- cd "${TRAVIS_BUILD_DIR}/serde"
- cargo build --features rc
- cargo build --no-default-features
- cd "${TRAVIS_BUILD_DIR}/serde_test"
- cargo build
- rust: 1.19.0
- rust: 1.20.0
- rust: 1.21.0
- rust: 1.25.0
- rust: 1.26.0
# Work around failing to parse manifest because editions are unstable.
- rust: 1.27.0
before_script: sed -i /test_suite/d Cargo.toml
- rust: 1.28.0
before_script: sed -i /test_suite/d Cargo.toml
- rust: 1.31.0
script:
- cd "${TRAVIS_BUILD_DIR}/serde_derive"
- cargo build
- rust: 1.34.0
- rust: 1.36.0
script:
- cd "${TRAVIS_BUILD_DIR}/serde"
- cargo build --no-default-features --features alloc
- rust: nightly
name: Clippy
script:
- rustup component add clippy || travis_terminate 0
- cargo clippy -- -D clippy::all
- cd "${TRAVIS_BUILD_DIR}/serde"
- cargo clippy --features rc,unstable -- -D clippy::all
- cd "${TRAVIS_BUILD_DIR}/serde_derive"
- cargo clippy -- -D clippy::all
- cd "${TRAVIS_BUILD_DIR}/serde_test"
- cargo clippy -- -D clippy::all
- cd "${TRAVIS_BUILD_DIR}/test_suite"
- cargo clippy --tests --features unstable -- -D clippy::all
- cd "${TRAVIS_BUILD_DIR}/test_suite/no_std"
- cargo clippy -- -D clippy::all
- rust: nightly
name: Emscripten
script:
- CARGO_WEB_RELEASE=$(curl -L -s -H Accept:application/json https://github.com/koute/cargo-web/releases/latest)
- CARGO_WEB_VERSION=$(echo "${CARGO_WEB_RELEASE}" | jq -r .tag_name)
- CARGO_WEB_URL="https://github.com/koute/cargo-web/releases/download/${CARGO_WEB_VERSION}/cargo-web-x86_64-unknown-linux-gnu.gz"
- nvm install 9
- mkdir -p ~/.cargo/bin
- curl -L "${CARGO_WEB_URL}" | gzip -d > ~/.cargo/bin/cargo-web
- chmod +x ~/.cargo/bin/cargo-web
- cd "${TRAVIS_BUILD_DIR}/test_suite"
- cargo web test --target=asmjs-unknown-emscripten --nodejs
- cargo web test --target=wasm32-unknown-emscripten --nodejs
allow_failures:
- rust: nightly
name: Clippy
- rust: nightly
name: Emscripten
script:
- cd "${TRAVIS_BUILD_DIR}/serde"
- cargo build --no-default-features
- cargo build
+3 -3
View File
@@ -1,7 +1,7 @@
# Serde   [![Build Status]][travis] [![Latest Version]][crates.io] [![serde: rustc 1.13+]][Rust 1.13] [![serde_derive: rustc 1.31+]][Rust 1.31] # Serde   [![Build Status]][actions] [![Latest Version]][crates.io] [![serde: rustc 1.13+]][Rust 1.13] [![serde_derive: rustc 1.31+]][Rust 1.31]
[Build Status]: https://api.travis-ci.org/serde-rs/serde.svg?branch=master [Build Status]: https://img.shields.io/github/workflow/status/serde-rs/serde/CI/master
[travis]: https://travis-ci.org/serde-rs/serde [actions]: https://github.com/serde-rs/serde/actions?query=branch%3Amaster
[Latest Version]: https://img.shields.io/crates/v/serde.svg [Latest Version]: https://img.shields.io/crates/v/serde.svg
[crates.io]: https://crates.io/crates/serde [crates.io]: https://crates.io/crates/serde
[serde: rustc 1.13+]: https://img.shields.io/badge/serde-rustc_1.13+-lightgray.svg [serde: rustc 1.13+]: https://img.shields.io/badge/serde-rustc_1.13+-lightgray.svg
-39
View File
@@ -1,39 +0,0 @@
environment:
matrix:
- APPVEYOR_RUST_CHANNEL: stable
- APPVEYOR_RUST_CHANNEL: nightly
install:
# Install rust, x86_64-pc-windows-msvc host
- curl -sSf -o rustup-init.exe https://win.rustup.rs/
- rustup-init.exe -y --default-host x86_64-pc-windows-msvc --default-toolchain %APPVEYOR_RUST_CHANNEL%
- set PATH=C:\msys64\usr\bin;%PATH%;C:\Users\appveyor\.cargo\bin
- rustc -vV
- cargo -vV
build: false
for:
- matrix:
only:
- APPVEYOR_RUST_CHANNEL: stable
test_script:
- cd %APPVEYOR_BUILD_FOLDER%\serde
- cargo build --features rc
- cargo build --no-default-features
- cd %APPVEYOR_BUILD_FOLDER%\serde_test
- cargo build
- cargo test --features serde/derive,serde/rc
- matrix:
only:
- APPVEYOR_RUST_CHANNEL: nightly
test_script:
- cd %APPVEYOR_BUILD_FOLDER%\serde
- cargo build
- cargo build --no-default-features
- cargo build --no-default-features --features alloc
- cargo build --no-default-features --features rc,alloc
- cargo test --features derive,rc,unstable
- cd %APPVEYOR_BUILD_FOLDER%\test_suite
- cargo test --features unstable
+2 -6
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "serde" name = "serde"
version = "1.0.106" # remember to update html_root_url and serde_derive dependency version = "1.0.107" # remember to update html_root_url and serde_derive dependency
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"] authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
description = "A generic serialization/deserialization framework" description = "A generic serialization/deserialization framework"
@@ -13,12 +13,8 @@ readme = "crates-io.md"
include = ["Cargo.toml", "build.rs", "src/**/*.rs", "crates-io.md", "README.md", "LICENSE-APACHE", "LICENSE-MIT"] include = ["Cargo.toml", "build.rs", "src/**/*.rs", "crates-io.md", "README.md", "LICENSE-APACHE", "LICENSE-MIT"]
build = "build.rs" build = "build.rs"
[badges]
travis-ci = { repository = "serde-rs/serde" }
appveyor = { repository = "serde-rs/serde" }
[dependencies] [dependencies]
serde_derive = { version = "=1.0.106", optional = true, path = "../serde_derive" } serde_derive = { version = "=1.0.107", optional = true, path = "../serde_derive" }
[dev-dependencies] [dev-dependencies]
serde_derive = { version = "1.0", path = "../serde_derive" } serde_derive = { version = "1.0", path = "../serde_derive" }
+6 -3
View File
@@ -90,10 +90,13 @@ macro_rules! visit_integer_method {
{ {
match FromPrimitive::$from_method(v) { match FromPrimitive::$from_method(v) {
Some(v) => Ok(v), Some(v) => Ok(v),
None => Err(Error::invalid_value(Unexpected::$group(v as $group_ty), &self)), None => Err(Error::invalid_value(
Unexpected::$group(v as $group_ty),
&self,
)),
} }
} }
} };
} }
macro_rules! visit_float_method { macro_rules! visit_float_method {
@@ -105,7 +108,7 @@ macro_rules! visit_float_method {
{ {
Ok(v as Self::Value) Ok(v as Self::Value)
} }
} };
} }
macro_rules! impl_deserialize_num { macro_rules! impl_deserialize_num {
+1 -1
View File
@@ -75,7 +75,7 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Serde types in rustdoc of other crates get linked to here. // Serde types in rustdoc of other crates get linked to here.
#![doc(html_root_url = "https://docs.rs/serde/1.0.106")] #![doc(html_root_url = "https://docs.rs/serde/1.0.107")]
// Support using Serde without the standard library! // Support using Serde without the standard library!
#![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(not(feature = "std"), no_std)]
// Unstable functionality only if the user asks for it. For tracking and // Unstable functionality only if the user asks for it. For tracking and
+4 -2
View File
@@ -183,7 +183,9 @@ where
} }
} }
deserializer.deserialize_bytes(CowBytesVisitor).map(From::from) deserializer
.deserialize_bytes(CowBytesVisitor)
.map(From::from)
} }
pub mod size_hint { pub mod size_hint {
@@ -2472,7 +2474,7 @@ mod content {
where where
M: MapAccess<'de>, M: MapAccess<'de>,
{ {
while let Some(_) = try!(access.next_entry::<IgnoredAny, IgnoredAny>()) {} while try!(access.next_entry::<IgnoredAny, IgnoredAny>()).is_some() {}
Ok(()) Ok(())
} }
} }
+1 -5
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "serde_derive" name = "serde_derive"
version = "1.0.106" # remember to update html_root_url version = "1.0.107" # remember to update html_root_url
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"] authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
description = "Macros 1.1 implementation of #[derive(Serialize, Deserialize)]" description = "Macros 1.1 implementation of #[derive(Serialize, Deserialize)]"
@@ -11,10 +11,6 @@ keywords = ["serde", "serialization", "no_std"]
readme = "crates-io.md" readme = "crates-io.md"
include = ["Cargo.toml", "src/**/*.rs", "crates-io.md", "README.md", "LICENSE-APACHE", "LICENSE-MIT"] include = ["Cargo.toml", "src/**/*.rs", "crates-io.md", "README.md", "LICENSE-APACHE", "LICENSE-MIT"]
[badges]
travis-ci = { repository = "serde-rs/serde" }
appveyor = { repository = "serde-rs/serde" }
[features] [features]
default = [] default = []
deserialize_in_place = [] deserialize_in_place = []
+2 -2
View File
@@ -156,7 +156,7 @@ pub fn with_bound(
.collect(); .collect();
let mut visitor = FindTyParams { let mut visitor = FindTyParams {
all_type_params: all_type_params, all_type_params,
relevant_type_params: HashSet::new(), relevant_type_params: HashSet::new(),
associated_type_usage: Vec::new(), associated_type_usage: Vec::new(),
}; };
@@ -271,7 +271,7 @@ pub fn with_lifetime_bound(generics: &syn::Generics, lifetime: &str) -> syn::Gen
.collect(); .collect();
syn::Generics { syn::Generics {
params: params, params,
..generics.clone() ..generics.clone()
} }
} }
+11 -8
View File
@@ -134,11 +134,11 @@ impl Parameters {
let has_getter = cont.data.has_getter(); let has_getter = cont.data.has_getter();
Parameters { Parameters {
local: local, local,
this: this, this,
generics: generics, generics,
borrowed: borrowed, borrowed,
has_getter: has_getter, has_getter,
} }
} }
@@ -1153,10 +1153,13 @@ fn prepare_enum_variant_enum(
variants: &[Variant], variants: &[Variant],
cattrs: &attr::Container, cattrs: &attr::Container,
) -> (TokenStream, Stmts) { ) -> (TokenStream, Stmts) {
let variant_names_idents: Vec<_> = variants let mut deserialized_variants = variants
.iter() .iter()
.enumerate() .enumerate()
.filter(|&(_, variant)| !variant.attrs.skip_deserializing()) .filter(|&(_, variant)| !variant.attrs.skip_deserializing());
let variant_names_idents: Vec<_> = deserialized_variants
.clone()
.map(|(i, variant)| { .map(|(i, variant)| {
( (
variant.attrs.name().deserialize_name(), variant.attrs.name().deserialize_name(),
@@ -1166,7 +1169,7 @@ fn prepare_enum_variant_enum(
}) })
.collect(); .collect();
let other_idx = variants.iter().position(|variant| variant.attrs.other()); let other_idx = deserialized_variants.position(|(_, variant)| variant.attrs.other());
let variants_stmt = { let variants_stmt = {
let variant_names = variant_names_idents.iter().map(|(name, _, _)| name); let variant_names = variant_names_idents.iter().map(|(name, _, _)| name);
+1 -3
View File
@@ -21,9 +21,7 @@ pub fn wrap_in_const(
use #path as _serde; use #path as _serde;
}, },
None => quote! { None => quote! {
#[allow(unknown_lints)] #[allow(rust_2018_idioms, clippy::useless_attribute)]
#[cfg_attr(feature = "cargo-clippy", allow(useless_attribute))]
#[allow(rust_2018_idioms)]
extern crate serde as _serde; extern crate serde as _serde;
}, },
}; };
+5 -5
View File
@@ -110,8 +110,8 @@ impl<'a> Container<'a> {
let mut item = Container { let mut item = Container {
ident: item.ident.clone(), ident: item.ident.clone(),
attrs: attrs, attrs,
data: data, data,
generics: &item.generics, generics: &item.generics,
original: item, original: item,
}; };
@@ -148,9 +148,9 @@ fn enum_from_ast<'a>(
struct_from_ast(cx, &variant.fields, Some(&attrs), container_default); struct_from_ast(cx, &variant.fields, Some(&attrs), container_default);
Variant { Variant {
ident: variant.ident.clone(), ident: variant.ident.clone(),
attrs: attrs, attrs,
style: style, style,
fields: fields, fields,
original: variant, original: variant,
} }
}) })
+10 -13
View File
@@ -32,8 +32,8 @@ struct Attr<'c, T> {
impl<'c, T> Attr<'c, T> { impl<'c, T> Attr<'c, T> {
fn none(cx: &'c Ctxt, name: Symbol) -> Self { fn none(cx: &'c Ctxt, name: Symbol) -> Self {
Attr { Attr {
cx: cx, cx,
name: name, name,
tokens: TokenStream::new(), tokens: TokenStream::new(),
value: None, value: None,
} }
@@ -101,8 +101,8 @@ struct VecAttr<'c, T> {
impl<'c, T> VecAttr<'c, T> { impl<'c, T> VecAttr<'c, T> {
fn none(cx: &'c Ctxt, name: Symbol) -> Self { fn none(cx: &'c Ctxt, name: Symbol) -> Self {
VecAttr { VecAttr {
cx: cx, cx,
name: name, name,
first_dup_tokens: TokenStream::new(), first_dup_tokens: TokenStream::new(),
values: Vec::new(), values: Vec::new(),
} }
@@ -176,7 +176,7 @@ impl Name {
serialize_renamed: ser_renamed, serialize_renamed: ser_renamed,
deserialize: de_name.unwrap_or(source_name), deserialize: de_name.unwrap_or(source_name),
deserialize_renamed: de_renamed, deserialize_renamed: de_renamed,
deserialize_aliases: deserialize_aliases, deserialize_aliases,
} }
} }
@@ -716,7 +716,7 @@ fn decide_tag(
} }
} }
} }
TagType::Internal { tag: tag } TagType::Internal { tag }
} }
(Some((untagged_tokens, _)), Some((tag_tokens, _)), None) => { (Some((untagged_tokens, _)), Some((tag_tokens, _)), None) => {
cx.error_spanned_by( cx.error_spanned_by(
@@ -747,10 +747,7 @@ fn decide_tag(
); );
TagType::External TagType::External
} }
(None, Some((_, tag)), Some((_, content))) => TagType::Adjacent { (None, Some((_, tag)), Some((_, content))) => TagType::Adjacent { tag, content },
tag: tag,
content: content,
},
(Some((untagged_tokens, _)), Some((tag_tokens, _)), Some((content_tokens, _))) => { (Some((untagged_tokens, _)), Some((tag_tokens, _)), Some((content_tokens, _))) => {
cx.error_spanned_by( cx.error_spanned_by(
untagged_tokens, untagged_tokens,
@@ -1383,7 +1380,7 @@ impl Field {
let expr = syn::ExprPath { let expr = syn::ExprPath {
attrs: Vec::new(), attrs: Vec::new(),
qself: None, qself: None,
path: path, path,
}; };
deserialize_with.set_if_none(expr); deserialize_with.set_if_none(expr);
} else if is_cow(&field.ty, is_slice_u8) { } else if is_cow(&field.ty, is_slice_u8) {
@@ -1400,7 +1397,7 @@ impl Field {
let expr = syn::ExprPath { let expr = syn::ExprPath {
attrs: Vec::new(), attrs: Vec::new(),
qself: None, qself: None,
path: path, path,
}; };
deserialize_with.set_if_none(expr); deserialize_with.set_if_none(expr);
} }
@@ -1420,7 +1417,7 @@ impl Field {
deserialize_with: deserialize_with.get(), deserialize_with: deserialize_with.get(),
ser_bound: ser_bound.get(), ser_bound: ser_bound.get(),
de_bound: de_bound.get(), de_bound: de_bound.get(),
borrowed_lifetimes: borrowed_lifetimes, borrowed_lifetimes,
getter: getter.get(), getter: getter.get(),
flatten: flatten.get(), flatten: flatten.get(),
transparent: false, transparent: false,
+28 -36
View File
@@ -13,46 +13,38 @@
//! //!
//! [https://serde.rs/derive.html]: https://serde.rs/derive.html //! [https://serde.rs/derive.html]: https://serde.rs/derive.html
#![doc(html_root_url = "https://docs.rs/serde_derive/1.0.106")] #![doc(html_root_url = "https://docs.rs/serde_derive/1.0.107")]
#![allow(unknown_lints, bare_trait_objects)] #![allow(unknown_lints, bare_trait_objects)]
#![cfg_attr(feature = "cargo-clippy", allow(renamed_and_removed_lints))] #![deny(clippy::all, clippy::pedantic)]
#![cfg_attr(feature = "cargo-clippy", deny(clippy, clippy_pedantic))]
// Ignored clippy lints // Ignored clippy lints
#![cfg_attr( #![allow(
feature = "cargo-clippy", clippy::cognitive_complexity,
allow( clippy::enum_variant_names,
cognitive_complexity, clippy::needless_pass_by_value,
enum_variant_names, clippy::too_many_arguments,
needless_pass_by_value, clippy::trivially_copy_pass_by_ref,
redundant_field_names, clippy::used_underscore_binding,
too_many_arguments, clippy::wildcard_in_or_patterns
trivially_copy_pass_by_ref,
used_underscore_binding,
wildcard_in_or_patterns,
)
)] )]
// Ignored clippy_pedantic lints // Ignored clippy_pedantic lints
#![cfg_attr( #![allow(
feature = "cargo-clippy", clippy::cast_possible_truncation,
allow( clippy::checked_conversions,
cast_possible_truncation, clippy::doc_markdown,
checked_conversions, clippy::enum_glob_use,
doc_markdown, clippy::filter_map,
enum_glob_use, clippy::indexing_slicing,
filter_map, clippy::items_after_statements,
indexing_slicing, clippy::match_same_arms,
items_after_statements, clippy::module_name_repetitions,
match_same_arms, clippy::must_use_candidate,
module_name_repetitions, clippy::similar_names,
must_use_candidate, clippy::single_match_else,
similar_names, clippy::struct_excessive_bools,
single_match_else, clippy::too_many_lines,
struct_excessive_bools, clippy::unseparated_literal_suffix,
too_many_lines, clippy::use_self,
unseparated_literal_suffix, clippy::wildcard_imports
use_self,
wildcard_imports,
)
)] )]
// The `quote!` macro requires deep recursion. // The `quote!` macro requires deep recursion.
#![recursion_limit = "512"] #![recursion_limit = "512"]
+10 -13
View File
@@ -106,10 +106,10 @@ impl Parameters {
let generics = build_generics(cont); let generics = build_generics(cont);
Parameters { Parameters {
self_var: self_var, self_var,
this: this, this,
generics: generics, generics,
is_remote: is_remote, is_remote,
} }
} }
@@ -538,17 +538,17 @@ fn serialize_externally_tagged_variant(
} }
Style::Tuple => serialize_tuple_variant( Style::Tuple => serialize_tuple_variant(
TupleVariant::ExternallyTagged { TupleVariant::ExternallyTagged {
type_name: type_name, type_name,
variant_index: variant_index, variant_index,
variant_name: variant_name, variant_name,
}, },
params, params,
&variant.fields, &variant.fields,
), ),
Style::Struct => serialize_struct_variant( Style::Struct => serialize_struct_variant(
StructVariant::ExternallyTagged { StructVariant::ExternallyTagged {
variant_index: variant_index, variant_index,
variant_name: variant_name, variant_name,
}, },
params, params,
&variant.fields, &variant.fields,
@@ -614,10 +614,7 @@ fn serialize_internally_tagged_variant(
} }
} }
Style::Struct => serialize_struct_variant( Style::Struct => serialize_struct_variant(
StructVariant::InternallyTagged { StructVariant::InternallyTagged { tag, variant_name },
tag: tag,
variant_name: variant_name,
},
params, params,
&variant.fields, &variant.fields,
&type_name, &type_name,
-4
View File
@@ -18,9 +18,5 @@ proc-macro2 = "1.0"
quote = "1.0" quote = "1.0"
syn = { version = "1.0", default-features = false, features = ["derive", "parsing", "printing", "clone-impls"] } syn = { version = "1.0", default-features = false, features = ["derive", "parsing", "printing", "clone-impls"] }
[badges]
travis-ci = { repository = "serde-rs/serde" }
appveyor = { repository = "serde-rs/serde" }
[package.metadata.docs.rs] [package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"] targets = ["x86_64-unknown-linux-gnu"]
+1 -5
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "serde_test" name = "serde_test"
version = "1.0.106" # remember to update html_root_url version = "1.0.107" # remember to update html_root_url
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"] authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
description = "Token De/Serializer for testing De/Serialize implementations" description = "Token De/Serializer for testing De/Serialize implementations"
@@ -18,9 +18,5 @@ serde = { version = "1.0.60", path = "../serde" }
serde = { version = "1.0", path = "../serde" } serde = { version = "1.0", path = "../serde" }
serde_derive = { version = "1.0", path = "../serde_derive" } serde_derive = { version = "1.0", path = "../serde_derive" }
[badges]
travis-ci = { repository = "serde-rs/serde" }
appveyor = { repository = "serde-rs/serde" }
[package.metadata.docs.rs] [package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"] targets = ["x86_64-unknown-linux-gnu"]
+1 -1
View File
@@ -144,7 +144,7 @@
//! # } //! # }
//! ``` //! ```
#![doc(html_root_url = "https://docs.rs/serde_test/1.0.106")] #![doc(html_root_url = "https://docs.rs/serde_test/1.0.107")]
#![cfg_attr(feature = "cargo-clippy", allow(renamed_and_removed_lints))] #![cfg_attr(feature = "cargo-clippy", allow(renamed_and_removed_lints))]
#![cfg_attr(feature = "cargo-clippy", deny(clippy, clippy_pedantic))] #![cfg_attr(feature = "cargo-clippy", deny(clippy, clippy_pedantic))]
// Ignored clippy lints // Ignored clippy lints
+6 -2
View File
@@ -7,16 +7,20 @@ publish = false
build = "build.rs" build = "build.rs"
[features] [features]
expandtest = []
unstable = ["serde/unstable"] unstable = ["serde/unstable"]
[dependencies] [dependencies]
serde = { path = "../serde" } serde = { path = "../serde" }
[build-dependencies]
toolchain_find = "0.1"
[dev-dependencies] [dev-dependencies]
fnv = "1.0" fnv = "1.0"
rustversion = "0.1" macrotest = "=1.0.0"
rustversion = "1.0"
serde = { path = "../serde", features = ["rc", "derive"] } serde = { path = "../serde", features = ["rc", "derive"] }
serde_derive = { path = "../serde_derive", features = ["deserialize_in_place"] } serde_derive = { path = "../serde_derive", features = ["deserialize_in_place"] }
serde_test = { path = "../serde_test" } serde_test = { path = "../serde_test" }
trybuild = "1.0" trybuild = "1.0"
macrotest = "0.1"
+16 -9
View File
@@ -1,13 +1,13 @@
use std::process::{Command, ExitStatus, Stdio}; use std::process::{Command, ExitStatus, Stdio};
#[cfg(not(windows))] fn has_cargo_expand() -> bool {
const CARGO_EXPAND: &str = "cargo-expand"; let cargo_expand = if cfg!(windows) {
"cargo-expand.exe"
} else {
"cargo-expand"
};
#[cfg(windows)] Command::new(cargo_expand)
const CARGO_EXPAND: &str = "cargo-expand.exe";
fn main() {
if Command::new(CARGO_EXPAND)
.arg("--version") .arg("--version")
.stdin(Stdio::null()) .stdin(Stdio::null())
.stdout(Stdio::null()) .stdout(Stdio::null())
@@ -16,7 +16,14 @@ fn main() {
.as_ref() .as_ref()
.map(ExitStatus::success) .map(ExitStatus::success)
.unwrap_or(false) .unwrap_or(false)
{ }
println!("cargo:rustc-cfg=cargo_expand");
fn has_rustfmt() -> bool {
toolchain_find::find_installed_component("rustfmt").is_some()
}
fn main() {
if cfg!(feature = "expandtest") && has_cargo_expand() && has_rustfmt() {
println!("cargo:rustc-cfg=expandtest");
} }
} }
+4 -4
View File
@@ -7,10 +7,10 @@ enum DeEnum<B, C, D> {
_Seq2(i8, B, C, D), _Seq2(i8, B, C, D),
_Map2 { a: i8, b: B, c: C, d: D }, _Map2 { a: i8, b: B, c: C, d: D },
} }
#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
const _IMPL_SERIALIZE_FOR_DeEnum: () = { const _IMPL_SERIALIZE_FOR_DeEnum: () = {
#[allow(unknown_lints)] #[allow(rust_2018_idioms, clippy::useless_attribute)]
#[allow(rust_2018_idioms)]
extern crate serde as _serde; extern crate serde as _serde;
#[automatically_derived] #[automatically_derived]
impl<B, C, D> _serde::Serialize for DeEnum<B, C, D> impl<B, C, D> _serde::Serialize for DeEnum<B, C, D>
@@ -259,10 +259,10 @@ const _IMPL_SERIALIZE_FOR_DeEnum: () = {
} }
} }
}; };
#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
const _IMPL_DESERIALIZE_FOR_DeEnum: () = { const _IMPL_DESERIALIZE_FOR_DeEnum: () = {
#[allow(unknown_lints)] #[allow(rust_2018_idioms, clippy::useless_attribute)]
#[allow(rust_2018_idioms)]
extern crate serde as _serde; extern crate serde as _serde;
#[automatically_derived] #[automatically_derived]
impl<'de, B, C, D> _serde::Deserialize<'de> for DeEnum<B, C, D> impl<'de, B, C, D> _serde::Deserialize<'de> for DeEnum<B, C, D>
@@ -8,10 +8,10 @@ impl AssociatedType for i32 {
struct DefaultTyParam<T: AssociatedType<X = i32> = i32> { struct DefaultTyParam<T: AssociatedType<X = i32> = i32> {
phantom: PhantomData<T>, phantom: PhantomData<T>,
} }
#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
const _IMPL_SERIALIZE_FOR_DefaultTyParam: () = { const _IMPL_SERIALIZE_FOR_DefaultTyParam: () = {
#[allow(unknown_lints)] #[allow(rust_2018_idioms, clippy::useless_attribute)]
#[allow(rust_2018_idioms)]
extern crate serde as _serde; extern crate serde as _serde;
#[automatically_derived] #[automatically_derived]
impl<T: AssociatedType<X = i32>> _serde::Serialize for DefaultTyParam<T> { impl<T: AssociatedType<X = i32>> _serde::Serialize for DefaultTyParam<T> {
@@ -43,10 +43,10 @@ const _IMPL_SERIALIZE_FOR_DefaultTyParam: () = {
} }
} }
}; };
#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
const _IMPL_DESERIALIZE_FOR_DefaultTyParam: () = { const _IMPL_DESERIALIZE_FOR_DefaultTyParam: () = {
#[allow(unknown_lints)] #[allow(rust_2018_idioms, clippy::useless_attribute)]
#[allow(rust_2018_idioms)]
extern crate serde as _serde; extern crate serde as _serde;
#[automatically_derived] #[automatically_derived]
impl<'de, T: AssociatedType<X = i32>> _serde::Deserialize<'de> for DefaultTyParam<T> { impl<'de, T: AssociatedType<X = i32>> _serde::Deserialize<'de> for DefaultTyParam<T> {
@@ -5,10 +5,10 @@ pub enum GenericEnum<T, U> {
Seq(T, U), Seq(T, U),
Map { x: T, y: U }, Map { x: T, y: U },
} }
#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
const _IMPL_SERIALIZE_FOR_GenericEnum: () = { const _IMPL_SERIALIZE_FOR_GenericEnum: () = {
#[allow(unknown_lints)] #[allow(rust_2018_idioms, clippy::useless_attribute)]
#[allow(rust_2018_idioms)]
extern crate serde as _serde; extern crate serde as _serde;
#[automatically_derived] #[automatically_derived]
impl<T, U> _serde::Serialize for GenericEnum<T, U> impl<T, U> _serde::Serialize for GenericEnum<T, U>
@@ -108,10 +108,10 @@ const _IMPL_SERIALIZE_FOR_GenericEnum: () = {
} }
} }
}; };
#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
const _IMPL_DESERIALIZE_FOR_GenericEnum: () = { const _IMPL_DESERIALIZE_FOR_GenericEnum: () = {
#[allow(unknown_lints)] #[allow(rust_2018_idioms, clippy::useless_attribute)]
#[allow(rust_2018_idioms)]
extern crate serde as _serde; extern crate serde as _serde;
#[automatically_derived] #[automatically_derived]
impl<'de, T, U> _serde::Deserialize<'de> for GenericEnum<T, U> impl<'de, T, U> _serde::Deserialize<'de> for GenericEnum<T, U>
@@ -2,10 +2,10 @@ use serde::{Deserialize, Serialize};
pub struct GenericStruct<T> { pub struct GenericStruct<T> {
x: T, x: T,
} }
#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
const _IMPL_SERIALIZE_FOR_GenericStruct: () = { const _IMPL_SERIALIZE_FOR_GenericStruct: () = {
#[allow(unknown_lints)] #[allow(rust_2018_idioms, clippy::useless_attribute)]
#[allow(rust_2018_idioms)]
extern crate serde as _serde; extern crate serde as _serde;
#[automatically_derived] #[automatically_derived]
impl<T> _serde::Serialize for GenericStruct<T> impl<T> _serde::Serialize for GenericStruct<T>
@@ -36,10 +36,10 @@ const _IMPL_SERIALIZE_FOR_GenericStruct: () = {
} }
} }
}; };
#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
const _IMPL_DESERIALIZE_FOR_GenericStruct: () = { const _IMPL_DESERIALIZE_FOR_GenericStruct: () = {
#[allow(unknown_lints)] #[allow(rust_2018_idioms, clippy::useless_attribute)]
#[allow(rust_2018_idioms)]
extern crate serde as _serde; extern crate serde as _serde;
#[automatically_derived] #[automatically_derived]
impl<'de, T> _serde::Deserialize<'de> for GenericStruct<T> impl<'de, T> _serde::Deserialize<'de> for GenericStruct<T>
@@ -398,10 +398,10 @@ const _IMPL_DESERIALIZE_FOR_GenericStruct: () = {
} }
}; };
pub struct GenericNewTypeStruct<T>(T); pub struct GenericNewTypeStruct<T>(T);
#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
const _IMPL_SERIALIZE_FOR_GenericNewTypeStruct: () = { const _IMPL_SERIALIZE_FOR_GenericNewTypeStruct: () = {
#[allow(unknown_lints)] #[allow(rust_2018_idioms, clippy::useless_attribute)]
#[allow(rust_2018_idioms)]
extern crate serde as _serde; extern crate serde as _serde;
#[automatically_derived] #[automatically_derived]
impl<T> _serde::Serialize for GenericNewTypeStruct<T> impl<T> _serde::Serialize for GenericNewTypeStruct<T>
@@ -420,10 +420,10 @@ const _IMPL_SERIALIZE_FOR_GenericNewTypeStruct: () = {
} }
} }
}; };
#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
const _IMPL_DESERIALIZE_FOR_GenericNewTypeStruct: () = { const _IMPL_DESERIALIZE_FOR_GenericNewTypeStruct: () = {
#[allow(unknown_lints)] #[allow(rust_2018_idioms, clippy::useless_attribute)]
#[allow(rust_2018_idioms)]
extern crate serde as _serde; extern crate serde as _serde;
#[automatically_derived] #[automatically_derived]
impl<'de, T> _serde::Deserialize<'de> for GenericNewTypeStruct<T> impl<'de, T> _serde::Deserialize<'de> for GenericNewTypeStruct<T>
@@ -1,9 +1,9 @@
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
pub struct GenericTupleStruct<T, U>(T, U); pub struct GenericTupleStruct<T, U>(T, U);
#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
const _IMPL_DESERIALIZE_FOR_GenericTupleStruct: () = { const _IMPL_DESERIALIZE_FOR_GenericTupleStruct: () = {
#[allow(unknown_lints)] #[allow(rust_2018_idioms, clippy::useless_attribute)]
#[allow(rust_2018_idioms)]
extern crate serde as _serde; extern crate serde as _serde;
#[automatically_derived] #[automatically_derived]
impl<'de, T, U> _serde::Deserialize<'de> for GenericTupleStruct<T, U> impl<'de, T, U> _serde::Deserialize<'de> for GenericTupleStruct<T, U>
@@ -5,10 +5,10 @@ enum Lifetimes<'a> {
LifetimeMap { a: &'a i32 }, LifetimeMap { a: &'a i32 },
NoLifetimeMap { a: i32 }, NoLifetimeMap { a: i32 },
} }
#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
const _IMPL_SERIALIZE_FOR_Lifetimes: () = { const _IMPL_SERIALIZE_FOR_Lifetimes: () = {
#[allow(unknown_lints)] #[allow(rust_2018_idioms, clippy::useless_attribute)]
#[allow(rust_2018_idioms)]
extern crate serde as _serde; extern crate serde as _serde;
#[automatically_derived] #[automatically_derived]
impl<'a> _serde::Serialize for Lifetimes<'a> { impl<'a> _serde::Serialize for Lifetimes<'a> {
@@ -89,10 +89,10 @@ const _IMPL_SERIALIZE_FOR_Lifetimes: () = {
} }
} }
}; };
#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
const _IMPL_DESERIALIZE_FOR_Lifetimes: () = { const _IMPL_DESERIALIZE_FOR_Lifetimes: () = {
#[allow(unknown_lints)] #[allow(rust_2018_idioms, clippy::useless_attribute)]
#[allow(rust_2018_idioms)]
extern crate serde as _serde; extern crate serde as _serde;
#[automatically_derived] #[automatically_derived]
impl<'de, 'a> _serde::Deserialize<'de> for Lifetimes<'a> { impl<'de, 'a> _serde::Deserialize<'de> for Lifetimes<'a> {
@@ -4,10 +4,10 @@ struct SerNamedMap<'a, 'b, A: 'a, B: 'b, C> {
b: &'b mut B, b: &'b mut B,
c: C, c: C,
} }
#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
const _IMPL_SERIALIZE_FOR_SerNamedMap: () = { const _IMPL_SERIALIZE_FOR_SerNamedMap: () = {
#[allow(unknown_lints)] #[allow(rust_2018_idioms, clippy::useless_attribute)]
#[allow(rust_2018_idioms)]
extern crate serde as _serde; extern crate serde as _serde;
#[automatically_derived] #[automatically_derived]
impl<'a, 'b, A: 'a, B: 'b, C> _serde::Serialize for SerNamedMap<'a, 'b, A, B, C> impl<'a, 'b, A: 'a, B: 'b, C> _serde::Serialize for SerNamedMap<'a, 'b, A, B, C>
@@ -57,10 +57,10 @@ struct DeNamedMap<A, B, C> {
b: B, b: B,
c: C, c: C,
} }
#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
const _IMPL_DESERIALIZE_FOR_DeNamedMap: () = { const _IMPL_DESERIALIZE_FOR_DeNamedMap: () = {
#[allow(unknown_lints)] #[allow(rust_2018_idioms, clippy::useless_attribute)]
#[allow(rust_2018_idioms)]
extern crate serde as _serde; extern crate serde as _serde;
#[automatically_derived] #[automatically_derived]
impl<'de, A, B, C> _serde::Deserialize<'de> for DeNamedMap<A, B, C> impl<'de, A, B, C> _serde::Deserialize<'de> for DeNamedMap<A, B, C>
@@ -1,9 +1,9 @@
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
struct SerNamedTuple<'a, 'b, A: 'a, B: 'b, C>(&'a A, &'b mut B, C); 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)] #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
const _IMPL_SERIALIZE_FOR_SerNamedTuple: () = { const _IMPL_SERIALIZE_FOR_SerNamedTuple: () = {
#[allow(unknown_lints)] #[allow(rust_2018_idioms, clippy::useless_attribute)]
#[allow(rust_2018_idioms)]
extern crate serde as _serde; extern crate serde as _serde;
#[automatically_derived] #[automatically_derived]
impl<'a, 'b, A: 'a, B: 'b, C> _serde::Serialize for SerNamedTuple<'a, 'b, A, B, C> impl<'a, 'b, A: 'a, B: 'b, C> _serde::Serialize for SerNamedTuple<'a, 'b, A, B, C>
@@ -49,10 +49,10 @@ const _IMPL_SERIALIZE_FOR_SerNamedTuple: () = {
} }
}; };
struct DeNamedTuple<A, B, C>(A, B, C); struct DeNamedTuple<A, B, C>(A, B, C);
#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
const _IMPL_DESERIALIZE_FOR_DeNamedTuple: () = { const _IMPL_DESERIALIZE_FOR_DeNamedTuple: () = {
#[allow(unknown_lints)] #[allow(rust_2018_idioms, clippy::useless_attribute)]
#[allow(rust_2018_idioms)]
extern crate serde as _serde; extern crate serde as _serde;
#[automatically_derived] #[automatically_derived]
impl<'de, A, B, C> _serde::Deserialize<'de> for DeNamedTuple<A, B, C> impl<'de, A, B, C> _serde::Deserialize<'de> for DeNamedTuple<A, B, C>
@@ -1,9 +1,9 @@
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
struct NamedUnit; struct NamedUnit;
#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
const _IMPL_SERIALIZE_FOR_NamedUnit: () = { const _IMPL_SERIALIZE_FOR_NamedUnit: () = {
#[allow(unknown_lints)] #[allow(rust_2018_idioms, clippy::useless_attribute)]
#[allow(rust_2018_idioms)]
extern crate serde as _serde; extern crate serde as _serde;
#[automatically_derived] #[automatically_derived]
impl _serde::Serialize for NamedUnit { impl _serde::Serialize for NamedUnit {
@@ -15,10 +15,10 @@ const _IMPL_SERIALIZE_FOR_NamedUnit: () = {
} }
} }
}; };
#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
const _IMPL_DESERIALIZE_FOR_NamedUnit: () = { const _IMPL_DESERIALIZE_FOR_NamedUnit: () = {
#[allow(unknown_lints)] #[allow(rust_2018_idioms, clippy::useless_attribute)]
#[allow(rust_2018_idioms)]
extern crate serde as _serde; extern crate serde as _serde;
#[automatically_derived] #[automatically_derived]
impl<'de> _serde::Deserialize<'de> for NamedUnit { impl<'de> _serde::Deserialize<'de> for NamedUnit {
+2 -2
View File
@@ -10,10 +10,10 @@ where
_Seq2(i8, B, &'a C, &'a mut D), _Seq2(i8, B, &'a C, &'a mut D),
_Map2 { a: i8, b: B, c: &'a C, d: &'a mut D }, _Map2 { a: i8, b: B, c: &'a C, d: &'a mut D },
} }
#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
const _IMPL_SERIALIZE_FOR_SerEnum: () = { const _IMPL_SERIALIZE_FOR_SerEnum: () = {
#[allow(unknown_lints)] #[allow(rust_2018_idioms, clippy::useless_attribute)]
#[allow(rust_2018_idioms)]
extern crate serde as _serde; extern crate serde as _serde;
#[automatically_derived] #[automatically_derived]
impl<'a, B: 'a, C: 'a, D> _serde::Serialize for SerEnum<'a, B, C, D> impl<'a, B: 'a, C: 'a, D> _serde::Serialize for SerEnum<'a, B, C, D>
+4 -4
View File
@@ -1,9 +1,9 @@
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
enum Void {} enum Void {}
#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
const _IMPL_SERIALIZE_FOR_Void: () = { const _IMPL_SERIALIZE_FOR_Void: () = {
#[allow(unknown_lints)] #[allow(rust_2018_idioms, clippy::useless_attribute)]
#[allow(rust_2018_idioms)]
extern crate serde as _serde; extern crate serde as _serde;
#[automatically_derived] #[automatically_derived]
impl _serde::Serialize for Void { impl _serde::Serialize for Void {
@@ -15,10 +15,10 @@ const _IMPL_SERIALIZE_FOR_Void: () = {
} }
} }
}; };
#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
const _IMPL_DESERIALIZE_FOR_Void: () = { const _IMPL_DESERIALIZE_FOR_Void: () = {
#[allow(unknown_lints)] #[allow(rust_2018_idioms, clippy::useless_attribute)]
#[allow(rust_2018_idioms)]
extern crate serde as _serde; extern crate serde as _serde;
#[automatically_derived] #[automatically_derived]
impl<'de> _serde::Deserialize<'de> for Void { impl<'de> _serde::Deserialize<'de> for Void {
+1 -1
View File
@@ -1,5 +1,5 @@
#[cfg_attr(target_os = "emscripten", ignore)] #[cfg_attr(target_os = "emscripten", ignore)]
#[cfg_attr(not(cargo_expand), ignore)] #[cfg_attr(not(expandtest), ignore)]
#[rustversion::attr(not(nightly), ignore)] #[rustversion::attr(not(nightly), ignore)]
#[test] #[test]
fn expandtest() { fn expandtest() {
+11 -1
View File
@@ -265,7 +265,7 @@ fn test_gen() {
#[cfg(feature = "unstable")] #[cfg(feature = "unstable")]
#[derive(Serialize, Deserialize)] #[derive(Serialize, Deserialize)]
struct NonAsciiIdents { struct NonAsciiIdents {
σ: f64, σ: f64,
} }
#[derive(Serialize, Deserialize)] #[derive(Serialize, Deserialize)]
@@ -691,6 +691,16 @@ fn test_gen() {
#[serde(flatten, skip_deserializing)] #[serde(flatten, skip_deserializing)]
flat: T, flat: T,
} }
// https://github.com/serde-rs/serde/issues/1804
#[derive(Serialize, Deserialize)]
enum Message {
#[serde(skip)]
#[allow(dead_code)]
String(String),
#[serde(other)]
Unknown,
}
} }
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////