Adam H. Leventhal
94fbc3d388
fix clippy
2023-09-07 22:17:22 -07:00
Adam H. Leventhal
8da2058e2a
fix deserialization of untagged variants within internally or adjacently
...
tagged enums
2023-09-07 17:19:27 -07:00
Adam H. Leventhal
09993a904a
Fix for "cannot infer type" from Deserialize derive macro with simple
...
variants and untagged variants
2023-09-06 15:33:28 -07:00
Adam H. Leventhal
5d1403461c
add failing test
2023-09-06 15:31:16 -07:00
Uzair Aftab
df4ad5884d
Fix: Use &[T] instead of &Vec<T>
2023-08-21 09:44:03 +02:00
David Tolnay
870925d503
Add repro of issue 2591
...
error[E0507]: cannot move out of `*__self` which is behind a shared reference
--> test_suite/tests/test_remote.rs:210:10
|
210 | #[derive(Serialize, Deserialize)]
| ^^^^^^^^^
| |
| data moved here
| move occurs because `unrecognized` has type `ErrorKind`, which does not implement the `Copy` trait
|
= note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider borrowing here
|
210 | #[derive(&Serialize, Deserialize)]
| +
2023-08-20 21:36:30 -07:00
David Tolnay
cb490ec16d
Add test of remote enum with non_exhaustive
2023-08-13 21:14:12 -07:00
David Tolnay
bd7b0e257e
Touch up PR 2553
2023-08-05 22:13:09 -07:00
David Tolnay
73931692b2
Merge pull request #2553 from Mingun/default-on-tuples
...
Allow `#[serde(default)]` on tuple structs
2023-08-05 22:12:10 -07:00
David Tolnay
431636af0d
Merge pull request #2458 from Mingun/identifier
...
Keep aliases always sorted and include aliases in expecting message for field/variant_identifier
2023-08-05 16:39:14 -07:00
Mingun
5c33931422
Allow #[serde(default)] on tuple structs
2023-08-03 22:32:34 +05:00
David Tolnay
ef4f860384
Improve "expecting" message of adjacently tagged enum variant
2023-08-01 22:49:44 -07:00
Baptiste de Montangon
957ef206d1
Revisit of the representation of adjacently tagged enums tag
2023-07-31 20:53:02 +02:00
David Tolnay
e7df53701c
Resolve doc_markdown clippy lint from PR 2448
...
warning: item in documentation is missing backticks
--> test_suite/tests/test_annotations.rs:2870:25
|
2870 | /// Reaches crate::private::de::content::VariantDeserializer::tuple_variant
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
= note: `-W clippy::doc-markdown` implied by `-W clippy::pedantic`
help: try
|
2870 | /// Reaches `crate::private::de::content::VariantDeserializer::tuple_variant`
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
warning: item in documentation is missing backticks
--> test_suite/tests/test_annotations.rs:2871:17
|
2871 | /// Content::Seq case
| ^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
help: try
|
2871 | /// `Content::Seq` case
| ~~~~~~~~~~~~~~
warning: item in documentation is missing backticks
--> test_suite/tests/test_annotations.rs:2872:21
|
2872 | /// via FlatMapDeserializer::deserialize_enum
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
help: try
|
2872 | /// via `FlatMapDeserializer::deserialize_enum`
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
warning: item in documentation is missing backticks
--> test_suite/tests/test_annotations.rs:2894:25
|
2894 | /// Reaches crate::private::de::content::VariantDeserializer::struct_variant
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
help: try
|
2894 | /// Reaches `crate::private::de::content::VariantDeserializer::struct_variant`
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
warning: item in documentation is missing backticks
--> test_suite/tests/test_annotations.rs:2895:17
|
2895 | /// Content::Seq case
| ^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
help: try
|
2895 | /// `Content::Seq` case
| ~~~~~~~~~~~~~~
warning: item in documentation is missing backticks
--> test_suite/tests/test_annotations.rs:2896:21
|
2896 | /// via FlatMapDeserializer::deserialize_enum
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
help: try
|
2896 | /// via `FlatMapDeserializer::deserialize_enum`
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
warning: item in documentation is missing backticks
--> test_suite/tests/test_annotations.rs:2921:25
|
2921 | /// Reaches crate::private::de::content::VariantDeserializer::struct_variant
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
help: try
|
2921 | /// Reaches `crate::private::de::content::VariantDeserializer::struct_variant`
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
warning: item in documentation is missing backticks
--> test_suite/tests/test_annotations.rs:2922:17
|
2922 | /// Content::Map case
| ^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
help: try
|
2922 | /// `Content::Map` case
| ~~~~~~~~~~~~~~
warning: item in documentation is missing backticks
--> test_suite/tests/test_annotations.rs:2923:21
|
2923 | /// via FlatMapDeserializer::deserialize_enum
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
help: try
|
2923 | /// via `FlatMapDeserializer::deserialize_enum`
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2023-07-30 16:15:29 -07:00
David Tolnay
427c839b3d
Merge pull request #2448 from Mingun/ser-flatten-enums
...
Implement serialization of tuple variants of flatten enums
2023-07-30 16:02:37 -07:00
Jonas Platte
31a0e73489
Update error span for attribute / data kind mismatches
2023-07-27 10:47:45 +02:00
David Tolnay
e74925bc43
Merge pull request #1695 from jplatte/rename_all_fields
...
Add #[serde(rename_all_fields = "foo")] attribute
2023-07-27 00:45:45 -07:00
Jonas Platte
2f9bf4d3eb
Add #[serde(rename_all_fields = "foo")] attribute
2023-07-27 09:19:42 +02:00
David Tolnay
b0f7b00e1f
Resolve manual_string_new pedantic clippy lint
...
warning: empty String is being created manually
--> test_suite/tests/test_annotations.rs:2280:29
|
2280 | let data = Data::C { t: "".to_string() };
| ^^^^^^^^^^^^^^ help: consider using: `String::new()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_string_new
= note: `-W clippy::manual-string-new` implied by `-W clippy::pedantic`
2023-07-26 13:46:28 -07:00
David Tolnay
7255e192d8
Delete unused statement from PR 2266 test
2023-07-26 13:45:49 -07:00
David Tolnay
2102e1aa42
Format PR 2266 tests with rustfmt
2023-07-26 13:41:56 -07:00
David Tolnay
b789286bc3
Merge pull request #2266 from flisky/master
...
fix: don't check skipped variant with internal tag
2023-07-26 13:36:33 -07:00
David Tolnay
dd9913675d
Ungroup imports
2023-07-25 23:06:34 -07:00
Mingun
1efb8b6a53
Add tests for aliases
...
failures (2):
field_identifier::unknown
variant_identifier::unknown
2023-07-23 15:23:36 +05:00
Mingun
bc1960b106
Add tests for unknown field / variant
2023-07-23 15:23:33 +05:00
Mingun
967023b755
Group field_identifier and variant_identifier tests in sub-modules
...
(review this commit with "ignore whitespace changes" option on)
2023-07-23 15:21:22 +05:00
Mingun
bb51e68f16
Keep aliases sorted
2023-07-23 15:21:21 +05:00
David Tolnay
100ddada2f
Suppress dead_code on fields only accessed by deserialize_in_place
...
error: field `option` is never read
--> test_suite/tests/test_gen.rs:666:9
|
665 | struct ImplicitlyBorrowedOption<'a> {
| ------------------------ field in this struct
666 | option: std::option::Option<&'a str>,
| ^^^^^^
|
note: the lint level is defined here
--> test_suite/tests/test_gen.rs:5:9
|
5 | #![deny(warnings)]
| ^^^^^^^^
= note: `#[deny(dead_code)]` implied by `#[deny(warnings)]`
error: fields `ty` and `id` are never read
--> test_suite/tests/test_gen.rs:696:9
|
695 | struct RelObject<'a> {
| --------- fields in this struct
696 | ty: &'a str,
| ^^
697 | id: String,
| ^^
error: field `field` is never read
--> test_suite/tests/test_gen.rs:740:17
|
739 | struct MacroRules<'a> {
| ---------- field in this struct
740 | field: $field,
| ^^^^^
...
745 | deriving!(&'a str);
| ------------------ in this macro invocation
|
= note: this error originates in the macro `deriving` (in Nightly builds, run with -Z macro-backtrace for more info)
error: field `f` is never read
--> test_suite/tests/test_gen.rs:756:9
|
754 | struct BorrowLifetimeInsideMacro<'a> {
| ------------------------- field in this struct
755 | #[serde(borrow = "'a")]
756 | f: mac!(Cow<'a, str>),
| ^
warning: fields `question` and `answer` are never read
--> test_suite/tests/test_annotations.rs:2969:9
|
2968 | struct Struct {
| ------ fields in this struct
2969 | question: String,
| ^^^^^^^^
2970 | answer: u32,
| ^^^^^^
|
= note: `#[warn(dead_code)]` on by default
2023-07-19 09:12:35 -07:00
David Tolnay
2ef1cd4b35
Import macros exclusively through serde_derive in test suite
...
This makes it easier to execute tests against the precompiled serde_derive.
2023-07-19 09:08:05 -07:00
Mingun
4513a9e6a7
Move test_flatten_enum_newtype into new group of flatten tests - flatten::enum_::externally_tagged::newtype
2023-07-11 22:00:38 +05:00
Mingun
993966600e
Implement tests for crate::private::de::content::VariantDeserializer
...
failures (1):
flatten::enum_::externally_tagged::tuple
2023-07-11 21:59:22 +05:00
Mingun
5b96cf1bde
Use traditional order for enum variants (Unit, Newtype, Tuple, Struct) and names for tag and content fields
2023-07-11 21:58:43 +05:00
Mingun
f3d50e5209
Use FromIterator to fill HashMap
2023-07-11 21:58:14 +05:00
Mingun
ab21d4d017
Merge assert_de_tokens and assert_ser_tokens into assert_tokens
2023-07-11 21:57:49 +05:00
Mingun
f7c5d93e6a
Pull up types from function into module, unify style
2023-07-11 21:57:22 +05:00
Mingun
52a7d40e6e
Rename test types so their names reflects, what's tested
2023-07-11 21:56:53 +05:00
Mingun
348bc6b257
Move flatten enum tests to a dedicated module
...
(review with "ignore whitespace" option on and editor that shows line moves,
for example, TortoiseGitMerge)
2023-07-11 21:56:22 +05:00
David Tolnay
662fc3861c
Add test of const-generic unit struct where-clause edge case
...
Closes #2501 .
2023-07-09 18:01:43 -07:00
Baptiste de Montangon
89c8d85de9
allow Deserialize derive to handle generic unit structs
2023-07-10 01:31:40 +02:00
David Tolnay
117ef22142
Add ui test with suffixed string literals in attribute
2023-07-09 11:09:38 -07:00
David Tolnay
e4a4389177
Delete excessive tests of adjacently tagged non-string keys
2023-07-08 18:23:31 -07:00
David Tolnay
7aa0453c3b
Merge pull request 2475 from Baptistemontan/master
2023-07-08 18:07:16 -07:00
David Tolnay
3686277e14
Merge pull request #2436 from Mingun/flatten-ignored-any
...
Allow to flatten `IgnoredAny`
2023-07-06 16:35:10 -07:00
David Tolnay
fa0312ac45
More formatting of doc tests and example code
2023-07-06 15:56:47 -07:00
David Tolnay
015e39776f
No need for single-element vec for chaining one element
2023-07-02 21:11:09 -07:00
David Tolnay
6a9a21f178
Resolve useless_conversion clippy lint in test
...
error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
--> test_suite/tests/test_de.rs:202:12
|
202 | .chain(vec![Token::MapEnd].into_iter())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `vec![Token::MapEnd]`
|
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
--> /home/david/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:522:12
|
522 | U: IntoIterator<Item = Self::Item>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
= note: `-D clippy::useless-conversion` implied by `-D clippy::all`
2023-07-02 21:10:06 -07:00
Baptiste de Montangon
c604bdbfe4
Clarified tokens that represents tag and content for integer identifiers
2023-06-12 17:17:15 +02:00
Baptiste de Montangon
9fef892f6d
fixed difference in error message for adjacently tagged enums
2023-06-12 16:02:19 +02:00
Baptiste de Montangon
b1c7db47b8
Adjancently tagged enum field is determined with visit_identifier instead of only visit_str
2023-06-12 15:27:28 +02:00
David Tolnay
8a4dfa7231
Merge pull request #2466 from Mingun/fix-de-count-of-field
...
Fix incorrect count of fields passed to tuple deserialization methods
2023-06-07 22:13:08 -07:00