error: it is more concise to loop over references to containers instead of using explicit iteration methods
--> serde/src/private/de.rs:2761:22
|
2761 | for entry in self.0.iter_mut() {
| ^^^^^^^^^^^^^^^^^ help: to write this more concisely, try: `&mut *self.0`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_iter_loop
= note: `-D clippy::explicit-iter-loop` implied by `-D clippy::pedantic`
error: it is more concise to loop over references to containers instead of using explicit iteration methods
--> serde_derive/src/internals/check.rs:202:20
|
202 | for variant in variants.iter() {
| ^^^^^^^^^^^^^^^ help: to write this more concisely, try: `variants`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_iter_loop
= note: `-D clippy::explicit-iter-loop` implied by `-D clippy::pedantic`
error: it is more concise to loop over references to containers instead of using explicit iteration methods
--> serde_derive/src/bound.rs:262:28
|
262 | for variant in variants.iter() {
| ^^^^^^^^^^^^^^^ help: to write this more concisely, try: `variants`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_iter_loop
Previously if someone wrote an enum containing:
- `A` (untagged)
- `B` (tagged)
- `C` (tagged)
- `D` (untagged)
- `E` (tagged)
- `F` (untagged)
serde_derive would produce errors referring to B and E only, saying
you're supposed to put untagged variants at the end. The choice of B and
E for this error doesn't make a lot of sense because in order to resolve
the issue, the user must either:
- move A and D down
or:
- move B, C, and E up.
This commit changes the error to appear on A and D instead.
error: consider adding a `;` to the last statement for consistent formatting
--> serde_derive/src/internals/ast.rs:161:13
|
161 | seen_untagged = variant.attrs.untagged()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `seen_untagged = variant.attrs.untagged();`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
= note: `-D clippy::semicolon-if-nothing-returned` implied by `-D clippy::pedantic`
error: consider adding a `;` to the last statement for consistent formatting
--> serde_derive/src/internals/ast.rs:159:17
|
159 | ... cx.error_spanned_by(&variant.ident, "all variants with the #[serde(untagged)] attribute must be placed at the end of the enum")
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `cx.error_spanned_by(&variant.ident, "all variants with the #[serde(untagged)] attribute must be placed at the end of the enum");`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
This count should mean the number of fields expected in the serialized form,
so if some fields are skipped, they shouldn't be counted
Methods affected:
- Deserializer::deserialize_tuple
- Deserializer::deserialize_tuple_struct
- VariantAccess::tuple_variant
Fixes these being treated as "tests" by `cargo test` in serde_derive:
running 3 tests
test src/internals/check.rs - internals::check::check_remote_generic (line 23) ... FAILED
test src/internals/check.rs - internals::check::check_remote_generic (line 29) ... FAILED
test src/lib.rs - (line 3) ... ok
failures:
---- src/internals/check.rs - internals::check::check_remote_generic (line 23) stdout ----
error: unknown start of token: \u{2026}
--> src/internals/check.rs:25:20
|
4 | struct Generic<T> {…}
| ^
error: cannot find attribute `serde` in this scope
--> src/internals/check.rs:24:3
|
3 | #[serde(remote = "Generic")]
| ^^^^^
|
= note: `serde` is in scope, but it is a crate, not an attribute
error[E0392]: parameter `T` is never used
--> src/internals/check.rs:25:16
|
4 | struct Generic<T> {…}
| ^ unused parameter
|
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
= help: if you intended `T` to be a const parameter, use `const T: usize` instead
---- src/internals/check.rs - internals::check::check_remote_generic (line 29) stdout ----
error: unknown start of token: \u{2026}
--> src/internals/check.rs:31:21
|
4 | struct ConcreteDef {…}
| ^
error: cannot find attribute `serde` in this scope
--> src/internals/check.rs:30:3
|
3 | #[serde(remote = "Generic<T>")]
| ^^^^^
|
= note: `serde` is in scope, but it is a crate, not an attribute
This works just fine if we make syn parse "where " as a syn::WhereClause.
The serde(bound = "") attribute is definitely not common enough that it
would warrant a micro-optimization.