Special case is the tag field first (so the enum variant are known after reading the first entry from map).
General case is the tag field not the first (so we need to buffer entries until we found an entry with tag)
Separate testing each variant kind of enum (unit, newtype, tuple, struct) results
in more specific information if that checks fail
(review this commit with "ignore whitespace changes" option on)
error: collection is never read
--> test_suite/tests/test_gen.rs:723:25
|
723 | #[derive(Serialize, Deserialize)]
| ^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collection_is_never_read
note: the lint level is defined here
--> test_suite/tests/test_gen.rs:23:9
|
23 | #![deny(clippy::collection_is_never_read)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
error: found both `σ` and `o` as identifiers, which look alike
--> test_suite/tests/test_gen.rs:734:13
|
292 | σ: f64,
| - other identifier used here
...
734 | o: T,
| ^ this identifier can be confused with `σ`
|
note: the lint level is defined here
--> test_suite/tests/test_gen.rs:5:9
|
5 | #![deny(warnings)]
| ^^^^^^^^
= note: `#[deny(confusable_idents)]` implied by `#[deny(warnings)]`
error: collection is never read
--> test_suite/tests/test_gen.rs:728:25
|
728 | #[derive(Serialize, Deserialize)]
| ^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collection_is_never_read
= note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
error: collection is never read
--> test_suite/tests/test_gen.rs:722:25
|
722 | #[derive(Serialize, Deserialize)]
| ^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collection_is_never_read
note: the lint level is defined here
--> test_suite/tests/test_gen.rs:22:9
|
22 | #![deny(clippy::collection_is_never_read)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: unexpected `cfg` condition name: `serde_build_from_git`
--> serde_derive_internals/lib.rs:45:12
|
45 | #[cfg_attr(serde_build_from_git, path = "../serde_derive/src/internals/mod.rs")]
| ^^^^^^^^^^^^^^^^^^^^
|
= help: expected names are: `clippy`, `debug_assertions`, `doc`, `docsrs`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, `windows`
= help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(serde_build_from_git)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
= note: `#[warn(unexpected_cfgs)]` on by default
warning: unexpected `cfg` condition name: `serde_build_from_git`
--> serde_derive_internals/lib.rs:46:16
|
46 | #[cfg_attr(not(serde_build_from_git), path = "src/mod.rs")]
| ^^^^^^^^^^^^^^^^^^^^
|
= help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(serde_build_from_git)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `deserialize_in_place`
--> serde_derive_internals/src/attr.rs:276:11
|
276 | #[cfg(feature = "deserialize_in_place")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the condition
|
= note: no expected values for `feature`
= help: consider adding `deserialize_in_place` as a feature in `Cargo.toml`
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `exhaustive`
--> serde_derive_internals/src/attr.rs:1797:31
|
1797 | #![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
| ^^^^^^^^^^
|
= help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(exhaustive)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `exhaustive`
--> serde_derive_internals/src/receiver.rs:110:35
|
110 | #![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
| ^^^^^^^^^^
|
= help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(exhaustive)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `exhaustive`
--> serde_derive_internals/src/receiver.rs:181:47
|
181 | #![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
| ^^^^^^^^^^
|
= help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(exhaustive)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `exhaustive`
--> serde_derive_internals/src/receiver.rs:210:35
|
210 | #![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
| ^^^^^^^^^^
|
= help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(exhaustive)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `exhaustive`
--> serde_derive_internals/src/receiver.rs:231:43
|
231 | #![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
| ^^^^^^^^^^
|
= help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(exhaustive)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `exhaustive`
--> serde_derive/src/lib.rs:62:23
|
62 | #![cfg_attr(all(test, exhaustive), feature(non_exhaustive_omitted_patterns_lint))]
| ^^^^^^^^^^
|
= help: expected names are: `clippy`, `debug_assertions`, `doc`, `docsrs`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, `windows`
= help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(exhaustive)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
= note: `#[warn(unexpected_cfgs)]` on by default
warning: unexpected `cfg` condition name: `exhaustive`
--> serde_derive/src/internals/attr.rs:1797:31
|
1797 | #![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
| ^^^^^^^^^^
|
= help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(exhaustive)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `exhaustive`
--> serde_derive/src/internals/receiver.rs:110:35
|
110 | #![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
| ^^^^^^^^^^
|
= help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(exhaustive)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `exhaustive`
--> serde_derive/src/internals/receiver.rs:181:47
|
181 | #![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
| ^^^^^^^^^^
|
= help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(exhaustive)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `exhaustive`
--> serde_derive/src/internals/receiver.rs:210:35
|
210 | #![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
| ^^^^^^^^^^
|
= help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(exhaustive)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `exhaustive`
--> serde_derive/src/internals/receiver.rs:231:43
|
231 | #![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
| ^^^^^^^^^^
|
= help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(exhaustive)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `exhaustive`
--> serde_derive/src/bound.rs:147:39
|
147 | #![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
| ^^^^^^^^^^
|
= help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(exhaustive)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `exhaustive`
--> serde_derive/src/bound.rs:199:51
|
199 | ... #![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
| ^^^^^^^^^^
|
= help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(exhaustive)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `exhaustive`
--> serde_derive/src/bound.rs:228:39
|
228 | #![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
| ^^^^^^^^^^
|
= help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(exhaustive)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `systemtime_checked_add`
--> test_suite/tests/test_de_error.rs:1527:7
|
1527 | #[cfg(systemtime_checked_add)]
| ^^^^^^^^^^^^^^^^^^^^^^
|
= help: expected names are: `clippy`, `debug_assertions`, `doc`, `docsrs`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, `windows`
= help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(systemtime_checked_add)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
= note: `#[warn(unexpected_cfgs)]` on by default
bef110b92a changed the display for unexpected floats to always append a
".0" if there was no decimal point found in the formatting of the float.
However, this should only be relevant for finite (i.e., not NaN or inf)
values. The change introduced a test failure in the ordered-float
crate due to this:
---- impl_serde::test_fail_on_nan stdout ----
thread 'impl_serde::test_fail_on_nan' panicked at 'assertion failed: `(left == right)`
left: `Error { msg: "invalid value: floating point `NaN.0`, expected float (but not NaN)" }`,
right: `"invalid value: floating point `NaN`, expected float (but not NaN)"`', src/lib.rs:1554:9
stack backtrace:
0: rust_begin_unwind
at /usr/src/rustc-1.70.0/library/std/src/panicking.rs:578:5
1: core::panicking::panic_fmt
at /usr/src/rustc-1.70.0/library/core/src/panicking.rs:67:14
2: core::panicking::assert_failed_inner
3: core::panicking::assert_failed
at /usr/src/rustc-1.70.0/library/core/src/panicking.rs:228:5
4: serde_test::assert::assert_de_tokens_error
at /usr/share/cargo/registry/serde_test-1.0.171/src/assert.rs:228:19
5: ordered_float::impl_serde::test_fail_on_nan
at ./src/lib.rs:1554:9
6: ordered_float::impl_serde::test_fail_on_nan::{{closure}}
at ./src/lib.rs:1553:27
7: core::ops::function::FnOnce::call_once
at /usr/src/rustc-1.70.0/library/core/src/ops/function.rs:250:5
8: core::ops::function::FnOnce::call_once
at /usr/src/rustc-1.70.0/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
The serialization implementation is heavily
inspired by the existing trait implentation for
`std::num::Wrapping<T>`.
The deserializing implementation maps input values
that lie outside of the numerical range of the
output type to the `MIN` or `MAX` value of the
output type, depending on the sign of the input
value. This behaviour follows to the `Saturating`
semantics of the output type.
fix#2708