Compare commits

...

43 Commits

Author SHA1 Message Date
David Tolnay ea2789df0f Release 1.0.108 2020-05-09 17:53:23 -07:00
David Tolnay b7cfe33101 Add example usage to Formatter Serializer impl 2020-05-09 17:48:27 -07:00
David Tolnay 1b8ebf6b64 Add 128-bit integer support for Formatter 2020-05-09 17:48:27 -07:00
David Tolnay 35ad468780 Allow serializing newtype struct to Formatter
Serialize_newtype_struct is typically expected to just pass through the
wrapped value.
2020-05-09 17:48:27 -07:00
David Tolnay 850a29beb1 Directly display to the Formatter
This allows formatter flags to take effect.
2020-05-09 17:48:26 -07:00
David Tolnay 16bf9871cd Remove serialize_unit from Formatter's impl 2020-05-09 17:48:26 -07:00
David Tolnay 6182eceed1 Move the Formatter Serializer to a module
Let's keep impls.rs for Serialize impls, which there are enough of
already.
2020-05-09 17:48:26 -07:00
David Tolnay 99bc52f685 Support no-default-features mode in Formatter's impl 2020-05-09 17:48:26 -07:00
Jethro Beekman 726ff5ed31 impl Serializer for &mut fmt::Formatter 2020-05-09 17:48:13 -07:00
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
David Tolnay d1564525ad Release 1.0.106 2020-04-03 14:26:42 -07:00
David Tolnay 645f672a55 Merge pull request #1768 from robo9k/dummy-const-hidden-doc
Hide generated dummy const in rustdoc
2020-04-03 14:25:50 -07:00
robo9k a135199ab1 Hide generated dummy const in rustdoc 2020-04-03 22:21:38 +02:00
David Tolnay 2a9971a69d Merge pull request #1764 from serde-rs/collect
Simplify default Serializer::collect_str implementation
2020-03-27 23:10:06 -07:00
David Tolnay e2ada0efef Simplify default Serializer::collect_str implementation 2020-03-27 22:55:25 -07:00
36 changed files with 496 additions and 317 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
[travis]: https://travis-ci.org/serde-rs/serde
[Build Status]: https://img.shields.io/github/workflow/status/serde-rs/serde/CI/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.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]
name = "serde"
version = "1.0.105" # remember to update html_root_url and serde_derive dependency
version = "1.0.108" # remember to update html_root_url and serde_derive dependency
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
license = "MIT OR Apache-2.0"
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"]
build = "build.rs"
[badges]
travis-ci = { repository = "serde-rs/serde" }
appveyor = { repository = "serde-rs/serde" }
[dependencies]
serde_derive = { version = "=1.0.105", optional = true, path = "../serde_derive" }
serde_derive = { version = "=1.0.108", optional = true, path = "../serde_derive" }
[dev-dependencies]
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) {
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 {
@@ -105,7 +108,7 @@ macro_rules! visit_float_method {
{
Ok(v as Self::Value)
}
}
};
}
macro_rules! impl_deserialize_num {
+1 -1
View File
@@ -75,7 +75,7 @@
////////////////////////////////////////////////////////////////////////////////
// Serde types in rustdoc of other crates get linked to here.
#![doc(html_root_url = "https://docs.rs/serde/1.0.105")]
#![doc(html_root_url = "https://docs.rs/serde/1.0.108")]
// 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
+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 {
@@ -2472,7 +2474,7 @@ mod content {
where
M: MapAccess<'de>,
{
while let Some(_) = try!(access.next_entry::<IgnoredAny, IgnoredAny>()) {}
while try!(access.next_entry::<IgnoredAny, IgnoredAny>()).is_some() {}
Ok(())
}
}
+174
View File
@@ -0,0 +1,174 @@
use lib::*;
use ser::{Error, Impossible, Serialize, Serializer};
impl Error for fmt::Error {
fn custom<T: Display>(_msg: T) -> Self {
fmt::Error
}
}
macro_rules! fmt_primitives {
($($f:ident: $t:ty,)*) => {
$(
fn $f(self, v: $t) -> fmt::Result {
Display::fmt(&v, self)
}
)*
};
}
/// ```edition2018
/// use serde::Serialize;
/// use std::fmt::{self, Display};
///
/// #[derive(Serialize)]
/// #[serde(rename_all = "kebab-case")]
/// pub enum MessageType {
/// StartRequest,
/// EndRequest,
/// }
///
/// impl Display for MessageType {
/// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
/// self.serialize(f)
/// }
/// }
/// ```
impl<'a, 'b> Serializer for &'a mut fmt::Formatter<'b> {
type Ok = ();
type Error = fmt::Error;
type SerializeSeq = Impossible<(), fmt::Error>;
type SerializeTuple = Impossible<(), fmt::Error>;
type SerializeTupleStruct = Impossible<(), fmt::Error>;
type SerializeTupleVariant = Impossible<(), fmt::Error>;
type SerializeMap = Impossible<(), fmt::Error>;
type SerializeStruct = Impossible<(), fmt::Error>;
type SerializeStructVariant = Impossible<(), fmt::Error>;
fmt_primitives! {
serialize_bool: bool,
serialize_i8: i8,
serialize_i16: i16,
serialize_i32: i32,
serialize_i64: i64,
serialize_u8: u8,
serialize_u16: u16,
serialize_u32: u32,
serialize_u64: u64,
serialize_f32: f32,
serialize_f64: f64,
serialize_char: char,
serialize_str: &str,
serialize_unit_struct: &'static str,
}
serde_if_integer128! {
fmt_primitives! {
serialize_i128: i128,
serialize_u128: u128,
}
}
fn serialize_unit_variant(
self,
_name: &'static str,
_variant_index: u32,
variant: &'static str,
) -> fmt::Result {
Display::fmt(variant, self)
}
fn serialize_newtype_struct<T: ?Sized>(self, _name: &'static str, value: &T) -> fmt::Result
where
T: Serialize,
{
Serialize::serialize(value, self)
}
fn serialize_bytes(self, _v: &[u8]) -> fmt::Result {
Err(fmt::Error)
}
fn serialize_none(self) -> fmt::Result {
Err(fmt::Error)
}
fn serialize_some<T: ?Sized>(self, _value: &T) -> fmt::Result
where
T: Serialize,
{
Err(fmt::Error)
}
fn serialize_unit(self) -> fmt::Result {
Err(fmt::Error)
}
fn serialize_newtype_variant<T: ?Sized>(
self,
_name: &'static str,
_variant_index: u32,
_variant: &'static str,
_value: &T,
) -> fmt::Result
where
T: Serialize,
{
Err(fmt::Error)
}
fn serialize_seq(self, _len: Option<usize>) -> Result<Self::SerializeSeq, fmt::Error> {
Err(fmt::Error)
}
fn serialize_tuple(self, _len: usize) -> Result<Self::SerializeTuple, fmt::Error> {
Err(fmt::Error)
}
fn serialize_tuple_struct(
self,
_name: &'static str,
_len: usize,
) -> Result<Self::SerializeTupleStruct, fmt::Error> {
Err(fmt::Error)
}
fn serialize_tuple_variant(
self,
_name: &'static str,
_variant_index: u32,
_variant: &'static str,
_len: usize,
) -> Result<Self::SerializeTupleVariant, fmt::Error> {
Err(fmt::Error)
}
fn serialize_map(self, _len: Option<usize>) -> Result<Self::SerializeMap, fmt::Error> {
Err(fmt::Error)
}
fn serialize_struct(
self,
_name: &'static str,
_len: usize,
) -> Result<Self::SerializeStruct, fmt::Error> {
Err(fmt::Error)
}
fn serialize_struct_variant(
self,
_name: &'static str,
_variant_index: u32,
_variant: &'static str,
_len: usize,
) -> Result<Self::SerializeStructVariant, fmt::Error> {
Err(fmt::Error)
}
fn collect_str<T: ?Sized>(self, value: &T) -> fmt::Result
where
T: Display,
{
Display::fmt(value, self)
}
}
+2 -4
View File
@@ -109,6 +109,7 @@
use lib::*;
mod fmt;
mod impls;
mod impossible;
@@ -1359,10 +1360,7 @@ pub trait Serializer: Sized {
where
T: Display,
{
use lib::fmt::Write;
let mut string = String::new();
write!(string, "{}", value).unwrap();
self.serialize_str(&string)
self.serialize_str(&value.to_string())
}
/// Serialize a string produced by an implementation of `Display`.
+1 -5
View File
@@ -1,6 +1,6 @@
[package]
name = "serde_derive"
version = "1.0.105" # remember to update html_root_url
version = "1.0.108" # remember to update html_root_url
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
license = "MIT OR Apache-2.0"
description = "Macros 1.1 implementation of #[derive(Serialize, Deserialize)]"
@@ -11,10 +11,6 @@ keywords = ["serde", "serialization", "no_std"]
readme = "crates-io.md"
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]
default = []
deserialize_in_place = []
+2 -2
View File
@@ -156,7 +156,7 @@ pub fn with_bound(
.collect();
let mut visitor = FindTyParams {
all_type_params: all_type_params,
all_type_params,
relevant_type_params: HashSet::new(),
associated_type_usage: Vec::new(),
};
@@ -271,7 +271,7 @@ pub fn with_lifetime_bound(generics: &syn::Generics, lifetime: &str) -> syn::Gen
.collect();
syn::Generics {
params: params,
params,
..generics.clone()
}
}
+11 -8
View File
@@ -134,11 +134,11 @@ impl Parameters {
let has_getter = cont.data.has_getter();
Parameters {
local: local,
this: this,
generics: generics,
borrowed: borrowed,
has_getter: has_getter,
local,
this,
generics,
borrowed,
has_getter,
}
}
@@ -1153,10 +1153,13 @@ fn prepare_enum_variant_enum(
variants: &[Variant],
cattrs: &attr::Container,
) -> (TokenStream, Stmts) {
let variant_names_idents: Vec<_> = variants
let mut deserialized_variants = variants
.iter()
.enumerate()
.filter(|&(_, variant)| !variant.attrs.skip_deserializing())
.filter(|&(_, variant)| !variant.attrs.skip_deserializing());
let variant_names_idents: Vec<_> = deserialized_variants
.clone()
.map(|(i, variant)| {
(
variant.attrs.name().deserialize_name(),
@@ -1166,7 +1169,7 @@ fn prepare_enum_variant_enum(
})
.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 variant_names = variant_names_idents.iter().map(|(name, _, _)| name);
+2 -3
View File
@@ -21,14 +21,13 @@ pub fn wrap_in_const(
use #path as _serde;
},
None => quote! {
#[allow(unknown_lints)]
#[cfg_attr(feature = "cargo-clippy", allow(useless_attribute))]
#[allow(rust_2018_idioms)]
#[allow(rust_2018_idioms, clippy::useless_attribute)]
extern crate serde as _serde;
},
};
quote! {
#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
const #dummy_const: () = {
#use_serde
+5 -5
View File
@@ -110,8 +110,8 @@ impl<'a> Container<'a> {
let mut item = Container {
ident: item.ident.clone(),
attrs: attrs,
data: data,
attrs,
data,
generics: &item.generics,
original: item,
};
@@ -148,9 +148,9 @@ fn enum_from_ast<'a>(
struct_from_ast(cx, &variant.fields, Some(&attrs), container_default);
Variant {
ident: variant.ident.clone(),
attrs: attrs,
style: style,
fields: fields,
attrs,
style,
fields,
original: variant,
}
})
+10 -13
View File
@@ -32,8 +32,8 @@ struct Attr<'c, T> {
impl<'c, T> Attr<'c, T> {
fn none(cx: &'c Ctxt, name: Symbol) -> Self {
Attr {
cx: cx,
name: name,
cx,
name,
tokens: TokenStream::new(),
value: None,
}
@@ -101,8 +101,8 @@ struct VecAttr<'c, T> {
impl<'c, T> VecAttr<'c, T> {
fn none(cx: &'c Ctxt, name: Symbol) -> Self {
VecAttr {
cx: cx,
name: name,
cx,
name,
first_dup_tokens: TokenStream::new(),
values: Vec::new(),
}
@@ -176,7 +176,7 @@ impl Name {
serialize_renamed: ser_renamed,
deserialize: de_name.unwrap_or(source_name),
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) => {
cx.error_spanned_by(
@@ -747,10 +747,7 @@ fn decide_tag(
);
TagType::External
}
(None, Some((_, tag)), Some((_, content))) => TagType::Adjacent {
tag: tag,
content: content,
},
(None, Some((_, tag)), Some((_, content))) => TagType::Adjacent { tag, content },
(Some((untagged_tokens, _)), Some((tag_tokens, _)), Some((content_tokens, _))) => {
cx.error_spanned_by(
untagged_tokens,
@@ -1383,7 +1380,7 @@ impl Field {
let expr = syn::ExprPath {
attrs: Vec::new(),
qself: None,
path: path,
path,
};
deserialize_with.set_if_none(expr);
} else if is_cow(&field.ty, is_slice_u8) {
@@ -1400,7 +1397,7 @@ impl Field {
let expr = syn::ExprPath {
attrs: Vec::new(),
qself: None,
path: path,
path,
};
deserialize_with.set_if_none(expr);
}
@@ -1420,7 +1417,7 @@ impl Field {
deserialize_with: deserialize_with.get(),
ser_bound: ser_bound.get(),
de_bound: de_bound.get(),
borrowed_lifetimes: borrowed_lifetimes,
borrowed_lifetimes,
getter: getter.get(),
flatten: flatten.get(),
transparent: false,
+28 -36
View File
@@ -13,46 +13,38 @@
//!
//! [https://serde.rs/derive.html]: https://serde.rs/derive.html
#![doc(html_root_url = "https://docs.rs/serde_derive/1.0.105")]
#![doc(html_root_url = "https://docs.rs/serde_derive/1.0.108")]
#![allow(unknown_lints, bare_trait_objects)]
#![cfg_attr(feature = "cargo-clippy", allow(renamed_and_removed_lints))]
#![cfg_attr(feature = "cargo-clippy", deny(clippy, clippy_pedantic))]
#![deny(clippy::all, clippy::pedantic)]
// Ignored clippy lints
#![cfg_attr(
feature = "cargo-clippy",
allow(
cognitive_complexity,
enum_variant_names,
needless_pass_by_value,
redundant_field_names,
too_many_arguments,
trivially_copy_pass_by_ref,
used_underscore_binding,
wildcard_in_or_patterns,
)
#![allow(
clippy::cognitive_complexity,
clippy::enum_variant_names,
clippy::needless_pass_by_value,
clippy::too_many_arguments,
clippy::trivially_copy_pass_by_ref,
clippy::used_underscore_binding,
clippy::wildcard_in_or_patterns
)]
// Ignored clippy_pedantic lints
#![cfg_attr(
feature = "cargo-clippy",
allow(
cast_possible_truncation,
checked_conversions,
doc_markdown,
enum_glob_use,
filter_map,
indexing_slicing,
items_after_statements,
match_same_arms,
module_name_repetitions,
must_use_candidate,
similar_names,
single_match_else,
struct_excessive_bools,
too_many_lines,
unseparated_literal_suffix,
use_self,
wildcard_imports,
)
#![allow(
clippy::cast_possible_truncation,
clippy::checked_conversions,
clippy::doc_markdown,
clippy::enum_glob_use,
clippy::filter_map,
clippy::indexing_slicing,
clippy::items_after_statements,
clippy::match_same_arms,
clippy::module_name_repetitions,
clippy::must_use_candidate,
clippy::similar_names,
clippy::single_match_else,
clippy::struct_excessive_bools,
clippy::too_many_lines,
clippy::unseparated_literal_suffix,
clippy::use_self,
clippy::wildcard_imports
)]
// The `quote!` macro requires deep recursion.
#![recursion_limit = "512"]
+10 -13
View File
@@ -106,10 +106,10 @@ impl Parameters {
let generics = build_generics(cont);
Parameters {
self_var: self_var,
this: this,
generics: generics,
is_remote: is_remote,
self_var,
this,
generics,
is_remote,
}
}
@@ -538,17 +538,17 @@ fn serialize_externally_tagged_variant(
}
Style::Tuple => serialize_tuple_variant(
TupleVariant::ExternallyTagged {
type_name: type_name,
variant_index: variant_index,
variant_name: variant_name,
type_name,
variant_index,
variant_name,
},
params,
&variant.fields,
),
Style::Struct => serialize_struct_variant(
StructVariant::ExternallyTagged {
variant_index: variant_index,
variant_name: variant_name,
variant_index,
variant_name,
},
params,
&variant.fields,
@@ -614,10 +614,7 @@ fn serialize_internally_tagged_variant(
}
}
Style::Struct => serialize_struct_variant(
StructVariant::InternallyTagged {
tag: tag,
variant_name: variant_name,
},
StructVariant::InternallyTagged { tag, variant_name },
params,
&variant.fields,
&type_name,
-4
View File
@@ -18,9 +18,5 @@ proc-macro2 = "1.0"
quote = "1.0"
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]
targets = ["x86_64-unknown-linux-gnu"]
+1 -5
View File
@@ -1,6 +1,6 @@
[package]
name = "serde_test"
version = "1.0.105" # remember to update html_root_url
version = "1.0.108" # remember to update html_root_url
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
license = "MIT OR Apache-2.0"
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_derive = { version = "1.0", path = "../serde_derive" }
[badges]
travis-ci = { repository = "serde-rs/serde" }
appveyor = { repository = "serde-rs/serde" }
[package.metadata.docs.rs]
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.105")]
#![doc(html_root_url = "https://docs.rs/serde_test/1.0.108")]
#![cfg_attr(feature = "cargo-clippy", allow(renamed_and_removed_lints))]
#![cfg_attr(feature = "cargo-clippy", deny(clippy, clippy_pedantic))]
// Ignored clippy lints
+6 -2
View File
@@ -7,16 +7,20 @@ publish = false
build = "build.rs"
[features]
expandtest = []
unstable = ["serde/unstable"]
[dependencies]
serde = { path = "../serde" }
[build-dependencies]
toolchain_find = "0.1"
[dev-dependencies]
fnv = "1.0"
rustversion = "0.1"
macrotest = "=1.0.0"
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"
macrotest = "0.1"
+16 -9
View File
@@ -1,13 +1,13 @@
use std::process::{Command, ExitStatus, Stdio};
#[cfg(not(windows))]
const CARGO_EXPAND: &str = "cargo-expand";
fn has_cargo_expand() -> bool {
let cargo_expand = if cfg!(windows) {
"cargo-expand.exe"
} else {
"cargo-expand"
};
#[cfg(windows)]
const CARGO_EXPAND: &str = "cargo-expand.exe";
fn main() {
if Command::new(CARGO_EXPAND)
Command::new(cargo_expand)
.arg("--version")
.stdin(Stdio::null())
.stdout(Stdio::null())
@@ -16,7 +16,14 @@ fn main() {
.as_ref()
.map(ExitStatus::success)
.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),
_Map2 { a: i8, b: B, c: C, d: D },
}
#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
const _IMPL_SERIALIZE_FOR_DeEnum: () = {
#[allow(unknown_lints)]
#[allow(rust_2018_idioms)]
#[allow(rust_2018_idioms, clippy::useless_attribute)]
extern crate serde as _serde;
#[automatically_derived]
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)]
const _IMPL_DESERIALIZE_FOR_DeEnum: () = {
#[allow(unknown_lints)]
#[allow(rust_2018_idioms)]
#[allow(rust_2018_idioms, clippy::useless_attribute)]
extern crate serde as _serde;
#[automatically_derived]
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> {
phantom: PhantomData<T>,
}
#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
const _IMPL_SERIALIZE_FOR_DefaultTyParam: () = {
#[allow(unknown_lints)]
#[allow(rust_2018_idioms)]
#[allow(rust_2018_idioms, clippy::useless_attribute)]
extern crate serde as _serde;
#[automatically_derived]
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)]
const _IMPL_DESERIALIZE_FOR_DefaultTyParam: () = {
#[allow(unknown_lints)]
#[allow(rust_2018_idioms)]
#[allow(rust_2018_idioms, clippy::useless_attribute)]
extern crate serde as _serde;
#[automatically_derived]
impl<'de, T: AssociatedType<X = i32>> _serde::Deserialize<'de> for DefaultTyParam<T> {
@@ -5,10 +5,10 @@ pub enum GenericEnum<T, U> {
Seq(T, U),
Map { x: T, y: U },
}
#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
const _IMPL_SERIALIZE_FOR_GenericEnum: () = {
#[allow(unknown_lints)]
#[allow(rust_2018_idioms)]
#[allow(rust_2018_idioms, clippy::useless_attribute)]
extern crate serde as _serde;
#[automatically_derived]
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)]
const _IMPL_DESERIALIZE_FOR_GenericEnum: () = {
#[allow(unknown_lints)]
#[allow(rust_2018_idioms)]
#[allow(rust_2018_idioms, clippy::useless_attribute)]
extern crate serde as _serde;
#[automatically_derived]
impl<'de, T, U> _serde::Deserialize<'de> for GenericEnum<T, U>
@@ -2,10 +2,10 @@ use serde::{Deserialize, Serialize};
pub struct GenericStruct<T> {
x: T,
}
#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
const _IMPL_SERIALIZE_FOR_GenericStruct: () = {
#[allow(unknown_lints)]
#[allow(rust_2018_idioms)]
#[allow(rust_2018_idioms, clippy::useless_attribute)]
extern crate serde as _serde;
#[automatically_derived]
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)]
const _IMPL_DESERIALIZE_FOR_GenericStruct: () = {
#[allow(unknown_lints)]
#[allow(rust_2018_idioms)]
#[allow(rust_2018_idioms, clippy::useless_attribute)]
extern crate serde as _serde;
#[automatically_derived]
impl<'de, T> _serde::Deserialize<'de> for GenericStruct<T>
@@ -398,10 +398,10 @@ const _IMPL_DESERIALIZE_FOR_GenericStruct: () = {
}
};
pub struct GenericNewTypeStruct<T>(T);
#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
const _IMPL_SERIALIZE_FOR_GenericNewTypeStruct: () = {
#[allow(unknown_lints)]
#[allow(rust_2018_idioms)]
#[allow(rust_2018_idioms, clippy::useless_attribute)]
extern crate serde as _serde;
#[automatically_derived]
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)]
const _IMPL_DESERIALIZE_FOR_GenericNewTypeStruct: () = {
#[allow(unknown_lints)]
#[allow(rust_2018_idioms)]
#[allow(rust_2018_idioms, clippy::useless_attribute)]
extern crate serde as _serde;
#[automatically_derived]
impl<'de, T> _serde::Deserialize<'de> for GenericNewTypeStruct<T>
@@ -1,9 +1,9 @@
use serde::{Deserialize, Serialize};
pub struct GenericTupleStruct<T, U>(T, U);
#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
const _IMPL_DESERIALIZE_FOR_GenericTupleStruct: () = {
#[allow(unknown_lints)]
#[allow(rust_2018_idioms)]
#[allow(rust_2018_idioms, clippy::useless_attribute)]
extern crate serde as _serde;
#[automatically_derived]
impl<'de, T, U> _serde::Deserialize<'de> for GenericTupleStruct<T, U>
@@ -5,10 +5,10 @@ enum Lifetimes<'a> {
LifetimeMap { a: &'a i32 },
NoLifetimeMap { a: i32 },
}
#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
const _IMPL_SERIALIZE_FOR_Lifetimes: () = {
#[allow(unknown_lints)]
#[allow(rust_2018_idioms)]
#[allow(rust_2018_idioms, clippy::useless_attribute)]
extern crate serde as _serde;
#[automatically_derived]
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)]
const _IMPL_DESERIALIZE_FOR_Lifetimes: () = {
#[allow(unknown_lints)]
#[allow(rust_2018_idioms)]
#[allow(rust_2018_idioms, clippy::useless_attribute)]
extern crate serde as _serde;
#[automatically_derived]
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,
c: C,
}
#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
const _IMPL_SERIALIZE_FOR_SerNamedMap: () = {
#[allow(unknown_lints)]
#[allow(rust_2018_idioms)]
#[allow(rust_2018_idioms, 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>
@@ -57,10 +57,10 @@ struct DeNamedMap<A, B, C> {
b: B,
c: C,
}
#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
const _IMPL_DESERIALIZE_FOR_DeNamedMap: () = {
#[allow(unknown_lints)]
#[allow(rust_2018_idioms)]
#[allow(rust_2018_idioms, clippy::useless_attribute)]
extern crate serde as _serde;
#[automatically_derived]
impl<'de, A, B, C> _serde::Deserialize<'de> for DeNamedMap<A, B, C>
@@ -1,9 +1,9 @@
use serde::{Deserialize, Serialize};
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 _IMPL_SERIALIZE_FOR_SerNamedTuple: () = {
#[allow(unknown_lints)]
#[allow(rust_2018_idioms)]
#[allow(rust_2018_idioms, 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>
@@ -49,10 +49,10 @@ const _IMPL_SERIALIZE_FOR_SerNamedTuple: () = {
}
};
struct DeNamedTuple<A, B, C>(A, B, C);
#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
const _IMPL_DESERIALIZE_FOR_DeNamedTuple: () = {
#[allow(unknown_lints)]
#[allow(rust_2018_idioms)]
#[allow(rust_2018_idioms, clippy::useless_attribute)]
extern crate serde as _serde;
#[automatically_derived]
impl<'de, A, B, C> _serde::Deserialize<'de> for DeNamedTuple<A, B, C>
@@ -1,9 +1,9 @@
use serde::{Deserialize, Serialize};
struct NamedUnit;
#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
const _IMPL_SERIALIZE_FOR_NamedUnit: () = {
#[allow(unknown_lints)]
#[allow(rust_2018_idioms)]
#[allow(rust_2018_idioms, clippy::useless_attribute)]
extern crate serde as _serde;
#[automatically_derived]
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)]
const _IMPL_DESERIALIZE_FOR_NamedUnit: () = {
#[allow(unknown_lints)]
#[allow(rust_2018_idioms)]
#[allow(rust_2018_idioms, clippy::useless_attribute)]
extern crate serde as _serde;
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for NamedUnit {
+2 -2
View File
@@ -10,10 +10,10 @@ where
_Seq2(i8, B, &'a C, &'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)]
const _IMPL_SERIALIZE_FOR_SerEnum: () = {
#[allow(unknown_lints)]
#[allow(rust_2018_idioms)]
#[allow(rust_2018_idioms, 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>
+4 -4
View File
@@ -1,9 +1,9 @@
use serde::{Deserialize, Serialize};
enum Void {}
#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
const _IMPL_SERIALIZE_FOR_Void: () = {
#[allow(unknown_lints)]
#[allow(rust_2018_idioms)]
#[allow(rust_2018_idioms, clippy::useless_attribute)]
extern crate serde as _serde;
#[automatically_derived]
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)]
const _IMPL_DESERIALIZE_FOR_Void: () = {
#[allow(unknown_lints)]
#[allow(rust_2018_idioms)]
#[allow(rust_2018_idioms, clippy::useless_attribute)]
extern crate serde as _serde;
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for Void {
+1 -1
View File
@@ -1,5 +1,5 @@
#[cfg_attr(target_os = "emscripten", ignore)]
#[cfg_attr(not(cargo_expand), ignore)]
#[cfg_attr(not(expandtest), ignore)]
#[rustversion::attr(not(nightly), ignore)]
#[test]
fn expandtest() {
+11 -1
View File
@@ -265,7 +265,7 @@ fn test_gen() {
#[cfg(feature = "unstable")]
#[derive(Serialize, Deserialize)]
struct NonAsciiIdents {
σ: f64,
σ: f64,
}
#[derive(Serialize, Deserialize)]
@@ -691,6 +691,16 @@ fn test_gen() {
#[serde(flatten, skip_deserializing)]
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,
}
}
//////////////////////////////////////////////////////////////////////////