Commit Graph

3969 Commits

Author SHA1 Message Date
David Tolnay
9f8c579bf5
Merge pull request #2714 from Marcono1234/skipped-field-struct-len
Document that `len` does not include skipped struct fields
2024-03-16 12:49:50 -07:00
Marcono1234
eae7c2d684 Document that len does not include skipped struct fields 2024-03-16 14:40:28 +01:00
David Tolnay
3f43fca90d
Fix warning on no edition set in serde_derive
New warning since nightly-2024-03-03:

    warning: serde_derive/Cargo.toml: no edition set: defaulting to the 2015 edition while 2018 is compatible with `rust-version`
    warning: serde_derive_internals/Cargo.toml: no edition set: defaulting to the 2015 edition while 2018 is compatible with `rust-version`
2024-03-11 20:18:10 -07:00
David Tolnay
76449488ca
Ignore new dead_code warnings in test
Since nightly-2024-03-12.

    warning: struct `PackedC` is never constructed
        --> test_suite/tests/test_macros.rs:2237:12
         |
    2237 |     struct PackedC {
         |            ^^^^^^^
         |
         = note: `#[warn(dead_code)]` on by default

    warning: struct `CPacked` is never constructed
        --> test_suite/tests/test_macros.rs:2243:12
         |
    2243 |     struct CPacked {
         |            ^^^^^^^

    warning: struct `CPacked2` is never constructed
        --> test_suite/tests/test_macros.rs:2249:12
         |
    2249 |     struct CPacked2 {
         |            ^^^^^^^^

    warning: struct `Packed2C` is never constructed
        --> test_suite/tests/test_macros.rs:2255:12
         |
    2255 |     struct Packed2C {
         |            ^^^^^^^^

    error: struct `Packed` is never constructed
       --> test_suite/tests/test_gen.rs:733:12
        |
    733 |     struct Packed {
        |            ^^^^^^
        |
    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: struct `Struct` is never constructed
       --> test_suite/tests/test_gen.rs:764:12
        |
    764 |     struct Struct {
        |            ^^^^^^

    error: function `vec_first_element` is never used
       --> test_suite/tests/test_gen.rs:846:4
        |
    846 | fn vec_first_element<T, S>(vec: &[T], serializer: S) -> StdResult<S::Ok, S::Error>
        |    ^^^^^^^^^^^^^^^^^
2024-03-11 20:10:30 -07:00
David Tolnay
00c4b0cef8
Merge pull request 2560 from Mingun/honest-test 2024-03-03 15:54:47 -08:00
David Tolnay
89139e2c11
Remove ineffective ?Sized bound on weak rc Deserialize impls
These impls have both `T: ?Sized` and `T: Deserialize<'de>`. But
`Deserialize<'de>: Sized`.
2024-02-27 22:52:20 -08:00
David Tolnay
c9cab490f7
Resolve multiple_bound_locations clippy lint
warning: bound is defined in more than one place
      --> serde/src/ser/fmt.rs:77:33
       |
    77 |     fn serialize_newtype_struct<T: ?Sized>(self, _name: &'static str, value: &T) -> fmt::Result
       |                                 ^
    78 |     where
    79 |         T: Serialize,
       |         ^
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations
       = note: `-W clippy::multiple-bound-locations` implied by `-W clippy::all`
       = help: to override `-W clippy::all` add `#[allow(clippy::multiple_bound_locations)]`

    warning: bound is defined in more than one place
      --> serde/src/ser/fmt.rs:92:23
       |
    92 |     fn serialize_some<T: ?Sized>(self, _value: &T) -> fmt::Result
       |                       ^
    93 |     where
    94 |         T: Serialize,
       |         ^
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
       --> serde/src/ser/fmt.rs:103:34
        |
    103 |     fn serialize_newtype_variant<T: ?Sized>(
        |                                  ^
    ...
    111 |         T: Serialize,
        |         ^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
       --> serde/src/ser/fmt.rs:164:20
        |
    164 |     fn collect_str<T: ?Sized>(self, value: &T) -> fmt::Result
        |                    ^
    165 |     where
    166 |         T: Display,
        |         ^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
      --> serde/src/ser/impossible.rs:75:26
       |
    75 |     fn serialize_element<T: ?Sized>(&mut self, value: &T) -> Result<(), Error>
       |                          ^
    76 |     where
    77 |         T: Serialize,
       |         ^
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
      --> serde/src/ser/impossible.rs:95:26
       |
    95 |     fn serialize_element<T: ?Sized>(&mut self, value: &T) -> Result<(), Error>
       |                          ^
    96 |     where
    97 |         T: Serialize,
       |         ^
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
       --> serde/src/ser/impossible.rs:115:24
        |
    115 |     fn serialize_field<T: ?Sized>(&mut self, value: &T) -> Result<(), Error>
        |                        ^
    116 |     where
    117 |         T: Serialize,
        |         ^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
       --> serde/src/ser/impossible.rs:135:24
        |
    135 |     fn serialize_field<T: ?Sized>(&mut self, value: &T) -> Result<(), Error>
        |                        ^
    136 |     where
    137 |         T: Serialize,
        |         ^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
       --> serde/src/ser/impossible.rs:155:22
        |
    155 |     fn serialize_key<T: ?Sized>(&mut self, key: &T) -> Result<(), Error>
        |                      ^
    156 |     where
    157 |         T: Serialize,
        |         ^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
       --> serde/src/ser/impossible.rs:163:24
        |
    163 |     fn serialize_value<T: ?Sized>(&mut self, value: &T) -> Result<(), Error>
        |                        ^
    164 |     where
    165 |         T: Serialize,
        |         ^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
       --> serde/src/ser/impossible.rs:183:24
        |
    183 |     fn serialize_field<T: ?Sized>(&mut self, key: &'static str, value: &T) -> Result<(), Error>
        |                        ^
    184 |     where
    185 |         T: Serialize,
        |         ^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
       --> serde/src/ser/impossible.rs:204:24
        |
    204 |     fn serialize_field<T: ?Sized>(&mut self, key: &'static str, value: &T) -> Result<(), Error>
        |                        ^
    205 |     where
    206 |         T: Serialize,
        |         ^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
       --> serde/src/ser/mod.rs:799:23
        |
    799 |     fn serialize_some<T: ?Sized>(self, value: &T) -> Result<Self::Ok, Self::Error>
        |                       ^
    800 |     where
    801 |         T: Serialize;
        |         ^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
       --> serde/src/ser/mod.rs:894:33
        |
    894 |     fn serialize_newtype_struct<T: ?Sized>(
        |                                 ^
    ...
    900 |         T: Serialize;
        |         ^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
       --> serde/src/ser/mod.rs:928:34
        |
    928 |     fn serialize_newtype_variant<T: ?Sized>(
        |                                  ^
    ...
    936 |         T: Serialize;
        |         ^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
        --> serde/src/ser/mod.rs:1349:20
         |
    1349 |     fn collect_str<T: ?Sized>(self, value: &T) -> Result<Self::Ok, Self::Error>
         |                    ^
    1350 |     where
    1351 |         T: Display,
         |         ^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
        --> serde/src/ser/mod.rs:1496:26
         |
    1496 |     fn serialize_element<T: ?Sized>(&mut self, value: &T) -> Result<(), Self::Error>
         |                          ^
    1497 |     where
    1498 |         T: Serialize;
         |         ^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
        --> serde/src/ser/mod.rs:1596:26
         |
    1596 |     fn serialize_element<T: ?Sized>(&mut self, value: &T) -> Result<(), Self::Error>
         |                          ^
    1597 |     where
    1598 |         T: Serialize;
         |         ^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
        --> serde/src/ser/mod.rs:1641:24
         |
    1641 |     fn serialize_field<T: ?Sized>(&mut self, value: &T) -> Result<(), Self::Error>
         |                        ^
    1642 |     where
    1643 |         T: Serialize;
         |         ^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
        --> serde/src/ser/mod.rs:1699:24
         |
    1699 |     fn serialize_field<T: ?Sized>(&mut self, value: &T) -> Result<(), Self::Error>
         |                        ^
    1700 |     where
    1701 |         T: Serialize;
         |         ^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
        --> serde/src/ser/mod.rs:1770:22
         |
    1770 |     fn serialize_key<T: ?Sized>(&mut self, key: &T) -> Result<(), Self::Error>
         |                      ^
    1771 |     where
    1772 |         T: Serialize;
         |         ^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
        --> serde/src/ser/mod.rs:1780:24
         |
    1780 |     fn serialize_value<T: ?Sized>(&mut self, value: &T) -> Result<(), Self::Error>
         |                        ^
    1781 |     where
    1782 |         T: Serialize;
         |         ^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
        --> serde/src/ser/mod.rs:1801:24
         |
    1801 |     fn serialize_entry<K: ?Sized, V: ?Sized>(
         |                        ^
    ...
    1807 |         K: Serialize,
         |         ^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
        --> serde/src/ser/mod.rs:1801:35
         |
    1801 |     fn serialize_entry<K: ?Sized, V: ?Sized>(
         |                                   ^
    ...
    1808 |         V: Serialize,
         |         ^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
        --> serde/src/ser/mod.rs:1859:24
         |
    1859 |     fn serialize_field<T: ?Sized>(
         |                        ^
    ...
    1865 |         T: Serialize;
         |         ^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
        --> serde/src/ser/mod.rs:1925:24
         |
    1925 |     fn serialize_field<T: ?Sized>(
         |                        ^
    ...
    1931 |         T: Serialize;
         |         ^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
       --> serde/src/private/ser.rs:177:23
        |
    177 |     fn serialize_some<T: ?Sized>(self, _: &T) -> Result<Self::Ok, Self::Error>
        |                       ^
    178 |     where
    179 |         T: Serialize,
        |         ^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
       --> serde/src/private/ser.rs:208:33
        |
    208 |     fn serialize_newtype_struct<T: ?Sized>(
        |                                 ^
    ...
    214 |         T: Serialize,
        |         ^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
       --> serde/src/private/ser.rs:219:34
        |
    219 |     fn serialize_newtype_variant<T: ?Sized>(
        |                                  ^
    ...
    227 |         T: Serialize,
        |         ^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
       --> serde/src/private/ser.rs:367:28
        |
    367 |         fn serialize_field<T: ?Sized>(&mut self, value: &T) -> Result<(), M::Error>
        |                            ^
    368 |         where
    369 |             T: Serialize,
        |             ^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
       --> serde/src/private/ser.rs:407:28
        |
    407 |         fn serialize_field<T: ?Sized>(
        |                            ^
    ...
    413 |             T: Serialize,
        |             ^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
       --> serde/src/private/ser.rs:638:27
        |
    638 |         fn serialize_some<T: ?Sized>(self, value: &T) -> Result<Content, E>
        |                           ^
    639 |         where
    640 |             T: Serialize,
        |             ^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
       --> serde/src/private/ser.rs:662:37
        |
    662 |         fn serialize_newtype_struct<T: ?Sized>(
        |                                     ^
    ...
    668 |             T: Serialize,
        |             ^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
       --> serde/src/private/ser.rs:676:38
        |
    676 |         fn serialize_newtype_variant<T: ?Sized>(
        |                                      ^
    ...
    684 |             T: Serialize,
        |             ^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
       --> serde/src/private/ser.rs:785:30
        |
    785 |         fn serialize_element<T: ?Sized>(&mut self, value: &T) -> Result<(), E>
        |                              ^
    786 |         where
    787 |             T: Serialize,
        |             ^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
       --> serde/src/private/ser.rs:811:30
        |
    811 |         fn serialize_element<T: ?Sized>(&mut self, value: &T) -> Result<(), E>
        |                              ^
    812 |         where
    813 |             T: Serialize,
        |             ^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
       --> serde/src/private/ser.rs:838:28
        |
    838 |         fn serialize_field<T: ?Sized>(&mut self, value: &T) -> Result<(), E>
        |                            ^
    839 |         where
    840 |             T: Serialize,
        |             ^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
       --> serde/src/private/ser.rs:867:28
        |
    867 |         fn serialize_field<T: ?Sized>(&mut self, value: &T) -> Result<(), E>
        |                            ^
    868 |         where
    869 |             T: Serialize,
        |             ^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
       --> serde/src/private/ser.rs:899:26
        |
    899 |         fn serialize_key<T: ?Sized>(&mut self, key: &T) -> Result<(), E>
        |                          ^
    900 |         where
    901 |             T: Serialize,
        |             ^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
       --> serde/src/private/ser.rs:908:28
        |
    908 |         fn serialize_value<T: ?Sized>(&mut self, value: &T) -> Result<(), E>
        |                            ^
    909 |         where
    910 |             T: Serialize,
        |             ^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
       --> serde/src/private/ser.rs:925:28
        |
    925 |         fn serialize_entry<K: ?Sized, V: ?Sized>(&mut self, key: &K, value: &V) -> Result<(), E>
        |                            ^
    926 |         where
    927 |             K: Serialize,
        |             ^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
       --> serde/src/private/ser.rs:925:39
        |
    925 |         fn serialize_entry<K: ?Sized, V: ?Sized>(&mut self, key: &K, value: &V) -> Result<(), E>
        |                                       ^
    ...
    928 |             V: Serialize,
        |             ^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
       --> serde/src/private/ser.rs:950:28
        |
    950 |         fn serialize_field<T: ?Sized>(&mut self, key: &'static str, value: &T) -> Result<(), E>
        |                            ^
    951 |         where
    952 |             T: Serialize,
        |             ^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
       --> serde/src/private/ser.rs:979:28
        |
    979 |         fn serialize_field<T: ?Sized>(&mut self, key: &'static str, value: &T) -> Result<(), E>
        |                            ^
    980 |         where
    981 |             T: Serialize,
        |             ^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
        --> serde/src/private/ser.rs:1091:23
         |
    1091 |     fn serialize_some<T: ?Sized>(self, value: &T) -> Result<Self::Ok, Self::Error>
         |                       ^
    1092 |     where
    1093 |         T: Serialize,
         |         ^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
        --> serde/src/private/ser.rs:1115:33
         |
    1115 |     fn serialize_newtype_struct<T: ?Sized>(
         |                                 ^
    ...
    1121 |         T: Serialize,
         |         ^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
        --> serde/src/private/ser.rs:1126:34
         |
    1126 |     fn serialize_newtype_variant<T: ?Sized>(
         |                                  ^
    ...
    1134 |         T: Serialize,
         |         ^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
        --> serde/src/private/ser.rs:1205:22
         |
    1205 |     fn serialize_key<T: ?Sized>(&mut self, key: &T) -> Result<(), Self::Error>
         |                      ^
    1206 |     where
    1207 |         T: Serialize,
         |         ^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
        --> serde/src/private/ser.rs:1212:24
         |
    1212 |     fn serialize_value<T: ?Sized>(&mut self, value: &T) -> Result<(), Self::Error>
         |                        ^
    1213 |     where
    1214 |         T: Serialize,
         |         ^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
        --> serde/src/private/ser.rs:1219:24
         |
    1219 |     fn serialize_entry<K: ?Sized, V: ?Sized>(
         |                        ^
    ...
    1225 |         K: Serialize,
         |         ^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
        --> serde/src/private/ser.rs:1219:35
         |
    1219 |     fn serialize_entry<K: ?Sized, V: ?Sized>(
         |                                   ^
    ...
    1226 |         V: Serialize,
         |         ^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
        --> serde/src/private/ser.rs:1247:24
         |
    1247 |     fn serialize_field<T: ?Sized>(
         |                        ^
    ...
    1253 |         T: Serialize,
         |         ^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
        --> serde/src/private/ser.rs:1292:24
         |
    1292 |     fn serialize_field<T: ?Sized>(&mut self, value: &T) -> Result<(), Self::Error>
         |                        ^
    1293 |     where
    1294 |         T: Serialize,
         |         ^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations

    warning: bound is defined in more than one place
        --> serde/src/private/ser.rs:1338:24
         |
    1338 |     fn serialize_field<T: ?Sized>(
         |                        ^
    ...
    1344 |         T: Serialize,
         |         ^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations
2024-02-27 22:45:50 -08:00
David Tolnay
5fa711d75d
Release 1.0.197 2024-02-19 16:22:07 -08:00
David Tolnay
f5d8ae423a
Resolve prelude redundant import warnings
warning: the item `Into` is imported redundantly
       --> serde/src/lib.rs:184:47
        |
    184 |     pub use self::core::convert::{self, From, Into};
        |                                               ^^^^
        |
       ::: nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/prelude/mod.rs:115:13
        |
    115 |     pub use super::v1::*;
        |             --------- the item `Into` is already defined here
        |
        = note: `#[warn(unused_imports)]` on by default
2024-02-19 16:16:40 -08:00
David Tolnay
1d54973b92
Merge pull request #2697 from nyurik/format-str
A few minor `write_str` optimizations
2024-02-12 19:49:34 -08:00
Yuri Astrakhan
b8fafefd85 A few minor write_str optimizations and inlining
Apparently `write!` generates more code than `write_str` when used with a simple string, so optimizing it.
2024-02-12 16:12:08 -05:00
David Tolnay
c42ebb8839
Update ui test suite to nightly-2024-02-12 2024-02-11 20:00:23 -08:00
David Tolnay
9e680620b5
Ignore incompatible_msrv clippy lint for conditionally compiled code
warning: current MSRV (Minimum Supported Rust Version) is `1.31.0` but this item is stable since `1.35.0`
       --> serde/src/de/impls.rs:200:39
        |
    200 |                   Ok((v as Self::Value).copysign(sign))
        |                                         ^^^^^^^^^^^^^^
    ...
    374 | / impl_deserialize_num! {
    375 | |     f32, deserialize_f32
    376 | |     num_self!(f32:visit_f32);
    377 | |     num_as_copysign_self!(f64:visit_f64);
    378 | |     num_as_self!(i8:visit_i8 i16:visit_i16 i32:visit_i32 i64:visit_i64);
    379 | |     num_as_self!(u8:visit_u8 u16:visit_u16 u32:visit_u32 u64:visit_u64);
    380 | | }
        | |_- in this macro invocation
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#incompatible_msrv
        = note: `-W clippy::incompatible-msrv` implied by `-W clippy::all`
        = help: to override `-W clippy::all` add `#[allow(clippy::incompatible_msrv)]`
        = note: this warning originates in the macro `num_as_copysign_self` which comes from the expansion of the macro `impl_deserialize_num` (in Nightly builds, run with -Z macro-backtrace for more info)

    warning: current MSRV (Minimum Supported Rust Version) is `1.31.0` but this item is stable since `1.35.0`
       --> serde/src/de/impls.rs:200:39
        |
    200 |                   Ok((v as Self::Value).copysign(sign))
        |                                         ^^^^^^^^^^^^^^
    ...
    382 | / impl_deserialize_num! {
    383 | |     f64, deserialize_f64
    384 | |     num_self!(f64:visit_f64);
    385 | |     num_as_copysign_self!(f32:visit_f32);
    386 | |     num_as_self!(i8:visit_i8 i16:visit_i16 i32:visit_i32 i64:visit_i64);
    387 | |     num_as_self!(u8:visit_u8 u16:visit_u16 u32:visit_u32 u64:visit_u64);
    388 | | }
        | |_- in this macro invocation
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#incompatible_msrv
        = note: this warning originates in the macro `num_as_copysign_self` which comes from the expansion of the macro `impl_deserialize_num` (in Nightly builds, run with -Z macro-backtrace for more info)

    warning: current MSRV (Minimum Supported Rust Version) is `1.31.0` but this item is stable since `1.34.0`
        --> serde/src/de/impls.rs:2308:14
         |
    2308 |             .checked_add(duration)
         |              ^^^^^^^^^^^^^^^^^^^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#incompatible_msrv

    warning: current MSRV (Minimum Supported Rust Version) is `1.31.0` but this item is stable since `1.34.0`
       --> serde/src/ser/impls.rs:606:26
        |
    606 |                       self.get().serialize(serializer)
        |                            ^^^^^
    ...
    623 | / nonzero_integers! {
    624 | |     NonZeroI8,
    625 | |     NonZeroI16,
    626 | |     NonZeroI32,
    ...   |
    629 | |     NonZeroIsize,
    630 | | }
        | |_- in this macro invocation
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#incompatible_msrv
        = note: this warning originates in the macro `nonzero_integers` (in Nightly builds, run with -Z macro-backtrace for more info)

    warning: current MSRV (Minimum Supported Rust Version) is `1.31.0` but this item is stable since `1.34.0`
        --> serde/src/ser/impls.rs:1053:26
         |
    1053 |                       self.load(Ordering::Relaxed).serialize(serializer)
         |                            ^^^^^^^^^^^^^^^^^^^^^^^
    ...
    1061 | / atomic_impl! {
    1062 | |     AtomicBool "8"
    1063 | |     AtomicI8 "8"
    1064 | |     AtomicI16 "16"
    ...    |
    1070 | |     AtomicUsize "ptr"
    1071 | | }
         | |_- in this macro invocation
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#incompatible_msrv
         = note: this warning originates in the macro `atomic_impl` (in Nightly builds, run with -Z macro-backtrace for more info)

    warning: current MSRV (Minimum Supported Rust Version) is `1.31.0` but this item is stable since `1.34.0`
        --> serde/src/ser/impls.rs:1053:26
         |
    1053 |                       self.load(Ordering::Relaxed).serialize(serializer)
         |                            ^^^^^^^^^^^^^^^^^^^^^^^
    ...
    1074 | / atomic_impl! {
    1075 | |     AtomicI64 "64"
    1076 | |     AtomicU64 "64"
    1077 | | }
         | |_- in this macro invocation
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#incompatible_msrv
         = note: this warning originates in the macro `atomic_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
2024-02-09 18:55:58 -08:00
David Tolnay
846f865de2
Ignore dead_code warnings in test
warning: trait `AssertNotSerdeSerialize` is never used
      --> test_suite/tests/test_serde_path.rs:39:7
       |
    39 | trait AssertNotSerdeSerialize {}
       |       ^^^^^^^^^^^^^^^^^^^^^^^
       |
       = note: `#[warn(dead_code)]` on by default

    warning: trait `AssertNotSerdeDeserialize` is never used
      --> test_suite/tests/test_serde_path.rs:43:7
       |
    43 | trait AssertNotSerdeDeserialize<'a> {}
       |       ^^^^^^^^^^^^^^^^^^^^^^^^^

    warning: method `serialize` is never used
      --> test_suite/tests/test_serde_path.rs:31:12
       |
    30 |     pub trait Serialize {
       |               --------- method in this trait
    31 |         fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>;
       |            ^^^^^^^^^

    warning: associated function `deserialize` is never used
      --> test_suite/tests/test_serde_path.rs:35:12
       |
    34 |     pub trait Deserialize<'a>: Sized {
       |               ----------- associated function in this trait
    35 |         fn deserialize<D: Deserializer<'a>>(deserializer: D) -> Result<Self, D::Error>;
       |            ^^^^^^^^^^^
2024-02-07 22:15:42 -08:00
David Tolnay
ede9762a58
Release 1.0.196 2024-01-26 14:00:35 -08:00
David Tolnay
d438c2d67b
Merge pull request #2682 from dtolnay/decimalpoint
Format Unexpected::Float with decimal point
2024-01-26 13:59:58 -08:00
David Tolnay
bef110b92a
Format Unexpected::Float with decimal point 2024-01-26 13:55:13 -08:00
David Tolnay
b971ef11d1
Merge pull request #2681 from dtolnay/workspacedeps
Fix workspace.dependencies default-features future compat warning
2024-01-26 13:41:27 -08:00
David Tolnay
29d9f69399
Fix workspace.dependencies default-features future compat warning
warning: serde_derive_internals/Cargo.toml: `default-features` is
    ignored for syn, since `default-features` was not specified for
    `workspace.dependencies.syn`, this could become a hard error in the
    future
2024-01-26 13:36:03 -08:00
David Tolnay
aecb4083bd
Sort workspace dependencies 2024-01-23 10:08:00 -08:00
David Tolnay
1c675ab3a3
Merge pull request #2678 from rodoufu/workspaceDependencies
Adding workspace dependencies
2024-01-23 10:07:38 -08:00
Rodolfo P A
dd619630a3 Adding workspace dependencies 2024-01-23 12:53:29 +00:00
David Tolnay
111803ab07
Merge pull request #2673 from Sky9x/msrv-badge
Use shields.io's MSRV badges
2024-01-08 20:51:26 -08:00
Sky
0024f74f34
Use shields.io's MSRV badges 2024-01-08 22:22:03 -05:00
David Tolnay
03eec42c33
Release 1.0.195 2024-01-05 18:33:24 -08:00
David Tolnay
196f311ae2
Merge pull request #2671 from dtolnay/deadremote
Fix new dead_code warning in tuple struct and tuple variant remote defs
2024-01-05 18:30:01 -08:00
David Tolnay
38d9e0b209
Revert "Add FIXME to fix dead_code warning when using serde(remote)" 2024-01-05 18:26:24 -08:00
David Tolnay
6502b31316
Fix new dead_code warning in tuple struct and tuple variant remote defs 2024-01-05 18:26:24 -08:00
David Tolnay
6f1a8c3115
Add FIXME to fix dead_code warning when using serde(remote)
warning: field `0` is never read
       --> test_suite/tests/test_remote.rs:143:24
        |
    143 | struct PrimitivePubDef(u8);
        |        --------------- ^^
        |        |
        |        field in this struct
        |
        = note: `#[warn(dead_code)]` on by default
    help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field
        |
    143 | struct PrimitivePubDef(());
        |                        ~~

    warning: field `0` is never read
       --> test_suite/tests/test_remote.rs:162:20
        |
    162 | struct TuplePubDef(u8, #[serde(with = "UnitDef")] remote::Unit);
        |        ----------- ^^
        |        |
        |        field in this struct
        |
    help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field
        |
    162 | struct TuplePubDef((), #[serde(with = "UnitDef")] remote::Unit);
        |                    ~~

    warning: field `0` is never read
       --> test_suite/tests/test_remote.rs:200:13
        |
    200 |     Variant(u8),
        |     ------- ^^
        |     |
        |     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
        |
    200 |     Variant(()),
        |             ~~

    error: field `0` is never read
       --> test_suite/tests/test_gen.rs:390:23
        |
    390 |     struct StrDef<'a>(&'a str);
        |            ------     ^^^^^^^
        |            |
        |            field in this struct
        |
    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)]`
    help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field
        |
    390 |     struct StrDef<'a>(());
        |                       ~~
2024-01-05 18:12:26 -08:00
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