Commit Graph

4040 Commits

Author SHA1 Message Date
David Tolnay
d883c94cc9
Work around dead_code warning in tests
error: field `0` is never read
       --> test_suite/tests/test_gen.rs:690:33
        |
    690 |         Single(#[serde(borrow)] RelObject<'a>),
        |         ------                  ^^^^^^^^^^^^^
        |         |
        |         field in this variant
        |
    help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field
        |
    690 |         Single(#[serde(borrow)] ()),
        |                                 ~~

    error: field `0` is never read
       --> test_suite/tests/test_gen.rs:691:31
        |
    691 |         Many(#[serde(borrow)] Vec<RelObject<'a>>),
        |         ----                  ^^^^^^^^^^^^^^^^^^
        |         |
        |         field in this variant
        |
    help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field
        |
    691 |         Many(#[serde(borrow)] ()),
        |                               ~~
2024-01-05 18:11:07 -08:00
David Tolnay
961fa59a74
Merge pull request #2670 from serde-rs/exhaustive
Pick up changes to non_exhaustive_omitted_patterns lint
2024-01-03 18:42:59 -08:00
David Tolnay
8bc71def55
Fill in omitted patterns for GenericArguments match
error: some variants are not matched explicitly
        --> serde_derive/src/internals/attr.rs:1823:31
         |
    1823 |                         match arg {
         |                               ^^^ patterns `&GenericArgument::Const(_)`, `&GenericArgument::AssocConst(_)` and `&GenericArgument::Constraint(_)` not covered
         |
         = help: ensure that all variants are matched explicitly by adding the suggested match arms
         = note: the matched value is of type `&GenericArgument` and the `non_exhaustive_omitted_patterns` attribute was found
    note: the lint level is defined here
        --> serde_derive/src/internals/attr.rs:1797:49
         |
    1797 |         #![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
         |                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-01-03 18:38:58 -08:00
David Tolnay
7c65a9dc0e
Pick up changes to non_exhaustive_omitted_patterns lint
warning: the lint level must be set on the whole match
        --> serde_derive/src/internals/attr.rs:1855:9
         |
    1854 |         #[cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
         |                                                ------------------------------- remove this attribute
    1855 |         _ => {}
         |         ^
         |
         = help: it no longer has any effect to set the lint level on an individual match arm
    help: set the lint level on the whole match
         |
    1796 +     #[deny(non_exhaustive_omitted_patterns)]
    1797 |     match ty {
         |

    warning: the lint level must be set on the whole match
       --> serde_derive/src/internals/receiver.rs:151:13
        |
    150 |             #[cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
        |                                                    ------------------------------- remove this attribute
    151 |             _ => {}
        |             ^
        |
        = help: it no longer has any effect to set the lint level on an individual match arm
    help: set the lint level on the whole match
        |
    109 +         #[deny(non_exhaustive_omitted_patterns)]
    110 |         match ty {
        |

    warning: the lint level must be set on the whole match
       --> serde_derive/src/internals/receiver.rs:188:25
        |
    187 |                         #[cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
        |                                                                ------------------------------- remove this attribute
    188 |                         _ => {}
        |                         ^
        |
        = help: it no longer has any effect to set the lint level on an individual match arm
    help: set the lint level on the whole match
        |
    180 +                     #[deny(non_exhaustive_omitted_patterns)]
    181 |                     match arg {
        |

    warning: the lint level must be set on the whole match
       --> serde_derive/src/internals/receiver.rs:213:13
        |
    212 |             #[cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
        |                                                    ------------------------------- remove this attribute
    213 |             _ => {}
        |             ^
        |
        = help: it no longer has any effect to set the lint level on an individual match arm
    help: set the lint level on the whole match
        |
    209 +         #[deny(non_exhaustive_omitted_patterns)]
    210 |         match bound {
        |

    warning: the lint level must be set on the whole match
       --> serde_derive/src/internals/receiver.rs:239:21
        |
    238 |                     #[cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
        |                                                            ------------------------------- remove this attribute
    239 |                     _ => {}
        |                     ^
        |
        = help: it no longer has any effect to set the lint level on an individual match arm
    help: set the lint level on the whole match
        |
    230 +                 #[deny(non_exhaustive_omitted_patterns)]
    231 |                 match predicate {
        |

    warning: the lint level must be set on the whole match
       --> serde_derive/src/bound.rs:185:17
        |
    184 |                 #[cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
        |                                                        ------------------------------- remove this attribute
    185 |                 _ => {}
        |                 ^
        |
        = help: it no longer has any effect to set the lint level on an individual match arm
    help: set the lint level on the whole match
        |
    146 +             #[deny(non_exhaustive_omitted_patterns)]
    147 |             match ty {
        |

    warning: the lint level must be set on the whole match
       --> serde_derive/src/bound.rs:209:29
        |
    207 | ...                       deny(non_exhaustive_omitted_patterns)
        |                                ------------------------------- remove this attribute
    208 | ...                   )]
    209 | ...                   _ => {}
        |                       ^
        |
        = help: it no longer has any effect to set the lint level on an individual match arm
    help: set the lint level on the whole match
        |
    198 +                         #[deny(non_exhaustive_omitted_patterns)]
    199 |                         match arg {
        |

    warning: the lint level must be set on the whole match
       --> serde_derive/src/bound.rs:234:17
        |
    233 |                 #[cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
        |                                                        ------------------------------- remove this attribute
    234 |                 _ => {}
        |                 ^
        |
        = help: it no longer has any effect to set the lint level on an individual match arm
    help: set the lint level on the whole match
        |
    230 +             #[deny(non_exhaustive_omitted_patterns)]
    231 |             match bound {
        |
2024-01-03 18:38:58 -08:00
David Tolnay
d2d977a6c6
Release 1.0.194 2024-01-01 23:07:27 -08:00
David Tolnay
a9a6ee9d7f
Pull in proc-macro2 sccache fix 2024-01-01 23:03:34 -08:00
David Tolnay
28c5d215c1
Merge pull request #2669 from dtolnay/optionifletelse
Remove option_if_let_else clippy suppression
2023-12-30 14:49:23 -08:00
David Tolnay
3d6a789562
Remove option_if_let_else clippy suppression 2023-12-30 14:46:51 -08:00
David Tolnay
a0e68698e3
Work around doc_link_with_quotes pedantic clippy lint
warning: possible intra-doc link using quotes instead of backticks
      --> serde/src/de/mod.rs:67:41
       |
    67 | //!    - Rc\<T\>&emsp;*(if* features = ["rc"] *is enabled)*
       |                                         ^^^^
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_link_with_quotes
       = note: `-W clippy::doc-link-with-quotes` implied by `-W clippy::pedantic`
       = help: to override `-W clippy::pedantic` add `#[allow(clippy::doc_link_with_quotes)]`

    warning: possible intra-doc link using quotes instead of backticks
      --> serde/src/de/mod.rs:68:42
       |
    68 | //!    - Arc\<T\>&emsp;*(if* features = ["rc"] *is enabled)*
       |                                          ^^^^
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_link_with_quotes

    warning: possible intra-doc link using quotes instead of backticks
      --> serde/src/ser/mod.rs:64:41
       |
    64 | //!    - Rc\<T\>&emsp;*(if* features = ["rc"] *is enabled)*
       |                                         ^^^^
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_link_with_quotes

    warning: possible intra-doc link using quotes instead of backticks
      --> serde/src/ser/mod.rs:65:42
       |
    65 | //!    - Arc\<T\>&emsp;*(if* features = ["rc"] *is enabled)*
       |                                          ^^^^
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_link_with_quotes
2023-12-02 18:25:35 -08:00
David Tolnay
44613c7d01
Release 1.0.193 2023-11-20 17:34:20 -08:00
David Tolnay
c706281df3
Merge pull request #2655 from dtolnay/rangestartend
Add RangeFrom and RangeTo tests
2023-11-20 17:33:42 -08:00
David Tolnay
65d75b8fe3
Add RangeFrom and RangeTo tests 2023-11-20 17:28:38 -08:00
David Tolnay
332b0cba40
Merge pull request #2654 from dtolnay/rangestartend
Fix more RangeFrom / RangeEnd mixups
2023-11-20 17:27:31 -08:00
David Tolnay
8c4af41296
Fix more RangeFrom / RangeEnd mixups 2023-11-20 17:21:59 -08:00
David Tolnay
24a78f071b
Merge pull request #2653 from emilbonnek/fix/range-to-from-de-mixup
Fix Range{From,To} deserialize mixup
2023-11-20 17:20:04 -08:00
Emil Bonne Kristiansen
c91c33436d
Fix Range{From,To} deserialize mixup 2023-11-21 02:13:18 +01:00
David Tolnay
2083f43a28
Update ui test suite to nightly-2023-11-19 2023-11-18 18:13:57 -08:00
David Tolnay
4676abdc9e
Release 1.0.192 2023-11-06 18:49:17 -08:00
David Tolnay
35700eb23e
Merge pull request #2646 from robsdedude/fix/2643/allow-tag-field-in-untagged
Allow internal tag field in untagged variant
2023-11-06 18:48:46 -08:00
David Tolnay
59892e7b58
Release 1.0.191 2023-11-06 11:30:27 -08:00
David Tolnay
97dd07a7d1
Merge pull request #2647 from dtolnay/doccfg
Render `doc(cfg(...))` on feature gated APIs in docs.rs
2023-11-06 11:29:38 -08:00
David Tolnay
c8bc97c81b
Document "rc" and "unstable" features on docs.rs 2023-11-06 11:22:25 -08:00
David Tolnay
9dacfbbd69
Fill in more doc(cfg) attributes 2023-11-06 11:20:29 -08:00
David Tolnay
05c2509d07
Relocate cfg attrs into deref_impl 2023-11-06 11:15:27 -08:00
David Tolnay
64f949b37b
Relocate cfg attrs into parse_ip_impl and parse_socket_impl 2023-11-06 11:15:08 -08:00
David Tolnay
3f339de36a
Relocate cfg attrs into seq_impl and map_impl 2023-11-06 11:15:08 -08:00
David Tolnay
215c2b71ef
Relocate cfg attrs into forwarded_impl macro
This will allow adding #[doc(cfg(feature = "..."))] attributes to the
impl in an upcoming commit.
2023-11-06 08:55:14 -08:00
David Tolnay
ce8fef7e0b
Show that derives are specific to feature="derive" in documentation 2023-11-06 08:55:14 -08:00
David Tolnay
0726b2c479
Enable feature(doc_cfg) during docs.rs documentation build 2023-11-06 08:55:14 -08:00
Robsdedude
589549d7e6 Allow internal tag field in untagged variant 2023-11-06 12:14:49 +01:00
David Tolnay
edb1a586d8
Release 1.0.190 2023-10-25 20:05:13 -07:00
David Tolnay
11c2917040
Merge pull request #2637 from dtolnay/nansign
Ensure f32 deserialized from f64 and vice versa preserve NaN sign
2023-10-25 20:03:05 -07:00
David Tolnay
6ba9c12ff6
Float copysign does not exist in libcore yet 2023-10-25 19:55:14 -07:00
David Tolnay
d2fcc346b9
Ensure f32 deserialized from f64 and vice versa preserve NaN sign 2023-10-25 19:45:53 -07:00
David Tolnay
a091a07aa2
Add float NaN tests 2023-10-25 19:45:53 -07:00
David Tolnay
bb4135cae8
Fix unused imports
warning: unused imports: `cmp`, `mem`, `slice`
       --> serde/src/lib.rs:171:26
        |
    171 |     pub use self::core::{cmp, iter, mem, num, ptr, slice, str};
        |                          ^^^        ^^^            ^^^^^
        |
        = note: `#[warn(unused_imports)]` on by default
2023-10-24 22:32:42 -07:00
David Tolnay
8de84b7ca3
Resolve get_first clippy lint
warning: accessing first element with `variant.fields.get(0)`
        --> serde_derive/src/de.rs:1843:27
         |
    1843 |             let default = variant.fields.get(0).map(|field| {
         |                           ^^^^^^^^^^^^^^^^^^^^^ help: try: `variant.fields.first()`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#get_first
         = note: `-W clippy::get-first` implied by `-W clippy::all`
         = help: to override `-W clippy::all` add `#[allow(clippy::get_first)]`

    warning: accessing first element with `variant.fields.get(0)`
        --> serde_derive/src/de.rs:1888:27
         |
    1888 |             let default = variant.fields.get(0).map(|field| {
         |                           ^^^^^^^^^^^^^^^^^^^^^ help: try: `variant.fields.first()`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#get_first
2023-10-21 22:01:10 -07:00
David Tolnay
9cdf332029
Remove 'remember to update' reminder from Cargo.toml 2023-10-17 21:05:31 -07:00
David Tolnay
e94fc65f01
Release 1.0.189 2023-10-12 19:20:43 -07:00
David Tolnay
b908487476
Remove double nesting of first_attempt
`expr` is of type serde_derive::fragment::Expr, which can be
interpolated directly in any expression position. It does not
need to be nested in another set of braces.
2023-10-12 19:18:42 -07:00
David Tolnay
2a7c7faeb4
Merge pull request #2613 from ahl/fix-untagged-plus-simple
"cannot infer type" from Deserialize derive macro with simple variants and untagged variants
2023-10-12 19:15:32 -07:00
David Tolnay
e302e15eea
Merge pull request #2625 from marcospb19/add-csv-to-the-list
Add CSV to the formats list
2023-10-09 19:23:12 -07:00
João Marcos P. Bezerra
1cbea892cf Add CSV to the formats list 2023-10-09 22:59:56 -03:00
David Tolnay
37a32857a2
Update ui test suite to nightly-2023-10-06 2023-10-05 23:24:34 -04:00
David Tolnay
8c4aad3a59
Clean up unneeded raw strings in test 2023-09-26 19:09:30 -07:00
David Tolnay
1774794b19
Resolve needless_raw_string_hashes clippy lint in test
warning: unnecessary hashes around raw string literal
        --> test_suite/tests/test_annotations.rs:2722:9
         |
    2722 |         r#"invalid type: unit value, expected variant identifier"#,
         |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_raw_string_hashes
         = note: `-W clippy::needless-raw-string-hashes` implied by `-W clippy::all`
         = help: to override `-W clippy::all` add `#[allow(clippy::needless_raw_string_hashes)]`
    help: remove all the hashes around the literal
         |
    2722 -         r#"invalid type: unit value, expected variant identifier"#,
    2722 +         r"invalid type: unit value, expected variant identifier",
         |

    warning: unnecessary hashes around raw string literal
        --> test_suite/tests/test_annotations.rs:2743:9
         |
    2743 |         r#"invalid type: unit value, expected variant identifier"#,
         |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_raw_string_hashes
    help: remove all the hashes around the literal
         |
    2743 -         r#"invalid type: unit value, expected variant identifier"#,
    2743 +         r"invalid type: unit value, expected variant identifier",
         |

    warning: unnecessary hashes around raw string literal
        --> test_suite/tests/test_annotations.rs:2769:9
         |
    2769 |         r#"invalid type: unit value, expected variant of enum Enum"#,
         |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_raw_string_hashes
    help: remove all the hashes around the literal
         |
    2769 -         r#"invalid type: unit value, expected variant of enum Enum"#,
    2769 +         r"invalid type: unit value, expected variant of enum Enum",
         |

    warning: unnecessary hashes around raw string literal
        --> test_suite/tests/test_annotations.rs:2782:63
         |
    2782 |     assert_de_tokens_error::<Enum>(&[Token::Str("Untagged")], r#"something strange..."#);
         |                                                               ^^^^^^^^^^^^^^^^^^^^^^^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_raw_string_hashes
    help: remove all the hashes around the literal
         |
    2782 -     assert_de_tokens_error::<Enum>(&[Token::Str("Untagged")], r#"something strange..."#);
    2782 +     assert_de_tokens_error::<Enum>(&[Token::Str("Untagged")], r"something strange...");
         |

    warning: unnecessary hashes around raw string literal
        --> test_suite/tests/test_annotations.rs:2803:9
         |
    2803 |         r#"invalid type: unit value, expected something strange..."#,
         |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_raw_string_hashes
    help: remove all the hashes around the literal
         |
    2803 -         r#"invalid type: unit value, expected something strange..."#,
    2803 +         r"invalid type: unit value, expected something strange...",
         |

    warning: unnecessary hashes around raw string literal
        --> test_suite/tests/test_annotations.rs:2812:9
         |
    2812 |         r#"invalid type: map, expected something strange..."#,
         |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_raw_string_hashes
    help: remove all the hashes around the literal
         |
    2812 -         r#"invalid type: map, expected something strange..."#,
    2812 +         r"invalid type: map, expected something strange...",
         |

    warning: unnecessary hashes around raw string literal
        --> test_suite/tests/test_annotations.rs:2817:9
         |
    2817 |         r#"invalid type: unit value, expected something strange..."#,
         |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_raw_string_hashes
    help: remove all the hashes around the literal
         |
    2817 -         r#"invalid type: unit value, expected something strange..."#,
    2817 +         r"invalid type: unit value, expected something strange...",
         |

    warning: unnecessary hashes around raw string literal
        --> test_suite/tests/test_annotations.rs:2828:9
         |
    2828 |         r#"invalid type: map, expected something strange..."#,
         |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_raw_string_hashes
    help: remove all the hashes around the literal
         |
    2828 -         r#"invalid type: map, expected something strange..."#,
    2828 +         r"invalid type: map, expected something strange...",
         |
2023-09-26 19:05:18 -07:00
David Tolnay
1af23f1f2d
Test docs.rs documentation build in CI 2023-09-24 10:53:44 -07:00
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