3238 Commits

Author SHA1 Message Date
David Tolnay
cd6697b0e4
Merge pull request #1955 from TheJokr/patch-1
Add 128-bit integer support to de::IgnoredAny
2021-01-18 22:54:43 -08:00
Leo Blöcher
c162d51866
Add 128-bit integer support to de::IgnoredAny
This fixes the errors that occur when IgnoredAny is deserialized
from anything containing a 128-bit integer somewhere. As IgnoredAny
is used in serde_derive to skip ignored fields in structs, these
errors currently prevent parsing of structs with an ignored field
containing a 128-bit integer in the serialization.
2021-01-19 02:32:26 +01:00
David Tolnay
78a9dbc57e
Merge pull request #1948 from Marwes/from_str
refactor: Merge multiple FromStr visitors to a single FromStrVisitor
2021-01-12 13:12:54 -08:00
David Tolnay
391d3ababf
Touch up PR 1948 2021-01-12 13:08:50 -08:00
Markus Westerlind
99d9151ce9 refactor: Merge multiple FromStr visitors to a single FromStrVisitor
Only refactors, doesn't actually expose this visitor
2021-01-12 11:32:16 +01:00
David Tolnay
4c89cf89fd
Release 1.0.119 2021-01-11 12:13:57 -08:00
David Tolnay
b0c99ed761
Restore compatibility with rustc 1.13.0
error[E0432]: unresolved import `private:🇩🇪:size_hint`
      --> src/de/value.rs:28:5
       |
    28 | use private:🇩🇪:size_hint;
       |     ^^^^^^^^^^^^^^^^^^^^^^ Maybe a missing `extern crate private`?
2021-01-08 20:01:30 -08:00
David Tolnay
dd1f4b483e
Make it clearer that the private implementation details are private
Both of these modules are doc(hidden) and commented "Not public API",
but incorrect downstream code sometimes still references them. Naming
the module __private will make it more likely to be noticed in code
review.
2021-01-08 19:55:31 -08:00
David Tolnay
91bfa8f947
Refresh expandtest files with most recent rustfmt 2021-01-08 19:54:21 -08:00
David Tolnay
8847800ce2
Ignore from_over_into clippy lint in test suite 2021-01-03 19:05:43 -08:00
David Tolnay
3c9fa1ccdf
Switch to short form for serde.rs link in rustdoc
Fixes a rustdoc warning:

    warning: unneeded long form for URL
      --> serde/src/lib.rs:12:27
       |
    12 | //! See the Serde website [https://serde.rs/] for additional documentation and
       |                           ^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<https://serde.rs/>`
       |
       = note: `#[warn(non_autolinks)]` on by default
2020-12-21 10:35:28 -08:00
David Tolnay
3c29a8857f
Merge pull request #1936 from bryanburgers/add-serde-dynamo
Add serde_dynamo to the list of data formats
2020-12-21 10:33:45 -08:00
Bryan Burgers
a5da27e16d Add serde_dynamo to the list of data formats 2020-12-21 10:51:56 -06:00
David Tolnay
e797431268
Release 1.0.118 2020-12-05 13:45:47 -08:00
David Tolnay
4a335f8933
Merge pull request #1926 from attente/core-num-wrapping
Allow serializing of Wrapping without std
2020-12-05 13:43:20 -08:00
David Tolnay
84721920fd
Resolve clippy items_after_statements lint
error: adding items after statements is confusing, since items exist from the start of the scope
        --> serde/src/de/impls.rs:1876:9
         |
    1876 | /         impl<'de> Deserialize<'de> for Field {
    1877 | |             fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
    1878 | |             where
    1879 | |                 D: Deserializer<'de>,
    ...    |
    1917 | |             }
    1918 | |         }
         | |_________^
         |
    note: the lint level is defined here
        --> serde/src/lib.rs:95:52
         |
    95   | #![cfg_attr(feature = "cargo-clippy", deny(clippy, clippy_pedantic))]
         |                                                    ^^^^^^^^^^^^^^^
         = note: `#[deny(clippy::items_after_statements)]` implied by `#[deny(clippy::pedantic)]`
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#items_after_statements

    error: adding items after statements is confusing, since items exist from the start of the scope
        --> serde/src/de/impls.rs:1920:9
         |
    1920 |         struct DurationVisitor;
         |         ^^^^^^^^^^^^^^^^^^^^^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#items_after_statements

    error: adding items after statements is confusing, since items exist from the start of the scope
        --> serde/src/de/impls.rs:1922:9
         |
    1922 | /         impl<'de> Visitor<'de> for DurationVisitor {
    1923 | |             type Value = Duration;
    1924 | |
    1925 | |             fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
    ...    |
    1979 | |             }
    1980 | |         }
         | |_________^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#items_after_statements

    error: adding items after statements is confusing, since items exist from the start of the scope
        --> serde/src/de/impls.rs:1982:9
         |
    1982 |         const FIELDS: &'static [&'static str] = &["secs", "nanos"];
         |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#items_after_statements

    error: adding items after statements is confusing, since items exist from the start of the scope
        --> serde/src/de/impls.rs:2001:9
         |
    2001 | /         impl<'de> Deserialize<'de> for Field {
    2002 | |             fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
    2003 | |             where
    2004 | |                 D: Deserializer<'de>,
    ...    |
    2042 | |             }
    2043 | |         }
         | |_________^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#items_after_statements

    error: adding items after statements is confusing, since items exist from the start of the scope
        --> serde/src/de/impls.rs:2045:9
         |
    2045 |         struct DurationVisitor;
         |         ^^^^^^^^^^^^^^^^^^^^^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#items_after_statements

    error: adding items after statements is confusing, since items exist from the start of the scope
        --> serde/src/de/impls.rs:2047:9
         |
    2047 | /         impl<'de> Visitor<'de> for DurationVisitor {
    2048 | |             type Value = Duration;
    2049 | |
    2050 | |             fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
    ...    |
    2108 | |             }
    2109 | |         }
         | |_________^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#items_after_statements

    error: adding items after statements is confusing, since items exist from the start of the scope
        --> serde/src/de/impls.rs:2111:9
         |
    2111 |         const FIELDS: &'static [&'static str] = &["secs_since_epoch", "nanos_since_epoch"];
         |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#items_after_statements
2020-11-28 19:08:41 -08:00
David Tolnay
192c7819ee
Format with rustfmt 1.4.25-beta 2020-11-28 19:06:37 -08:00
William Hua
ede40bdfaa Allow serializing of Wrapping without std 2020-11-24 00:56:10 -05:00
David Tolnay
e3d871ff7b
Opt in to experimental trybuild diffs 2020-10-31 13:28:19 -07:00
Mingun
5cbc8439ea Show correct location in error messages by tracking caller of utility assert_tokens functions 2020-10-28 09:11:54 +05:00
David Tolnay
0e1c4093c8
Suppress new result_unit_err clippy lint 2020-10-27 19:20:45 -07:00
David Tolnay
0d5b6c180c
Resolve ptr_eq clippy lint
error: use `std::ptr::eq` when comparing raw pointers
       --> serde_derive/src/de.rs:362:12
        |
    362 |         if field as *const Field == transparent_field as *const Field {
        |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::eq(field, transparent_field)`
        |
    note: the lint level is defined here
       --> serde_derive/src/lib.rs:18:9
        |
    18  | #![deny(clippy::all, clippy::pedantic)]
        |         ^^^^^^^^^^^
        = note: `#[deny(clippy::ptr_eq)]` implied by `#[deny(clippy::all)]`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_eq
2020-10-27 19:18:29 -07:00
Mingun
97c350a95e Forward Readable|Compact next_entry_seed to underlying next_entry_seed instead of usage of default implementation
Difference is noticeable for deserializers that rely on call of next_entry_seed
(for example, current quick-xml supports only next_entry_seed)
2020-10-28 01:05:27 +05:00
Mingun
920a77ad61 Fix incorrect messages in serialized tokens assertions
Serializer contains expected tokens, called methods provide actual tokens
2020-10-28 01:05:27 +05:00
Taiki Endo
a227a87865 Collect lifetimes inside macro invocations 2020-10-24 05:29:47 +09:00
Mingun
7a7a182ab6 Allow borrow for field identifiers 2020-10-23 19:03:18 +05:00
Mingun
9e1f573f88 Use forward_deserializer macro for define StrDeserializer for IdentifierDeserializer 2020-10-23 19:03:18 +05:00
Mingun
094f63b86a Introduce a forward_deserializer macro.
It helps to create deserializers that can stop time: save the value and then use visitor to get it later!
2020-10-23 19:03:14 +05:00
Mingun
42fa79455e Make BytesDeserializer public 2020-10-23 12:13:57 +05:00
Mingun
104ad9a7dd Allow to define custom expectation message for type with #[serde(expecting = "...")]
Closes #1883
2020-10-23 01:23:01 +05:00
Mingun
23c14e5f33 Allow to run assert_de_tokens_error on token sequence that is not expected by enum deserializer
Before that fix following code panics, because `Token::Unit` was unexpected by test deserializer:
```
#[derive(Deserialize)]
enum E { ... }

assert_de_tokens_error::<E>(&[Token::Unit], "...");
```
2020-10-22 23:50:48 +05:00
Mingun
e80571751d Allow borrowed and owned strings and bytes and u8, u16, u64 for variant keys in serde_test 2020-10-22 20:43:14 +05:00
Mingun
0737474640 Allow field identifiers be any numbers if #[serde(other)] is used
Thus behavior synchronized between string/bytes identifiers and numeric identifiers
2020-10-22 16:35:28 +05:00
Mingun
34de1e00c8 Implement IdentifierDeserializer for u64 instead of u32 because all identifiers deserialized with visit_u64 2020-10-22 16:35:28 +05:00
Mingun
f6eb34a830 Assert that numeric field identifiers correctly deserialized (now failing) 2020-10-22 16:35:28 +05:00
David Tolnay
8084258a3e
Update ui tests to nightly-2020-10-20 2020-10-20 19:17:50 -07:00
David Tolnay
fc3f104c4a
Release 1.0.117 2020-10-15 09:49:03 -07:00
David Tolnay
4bec9ffd0f
Merge pull request #1906 from Mingun/fix-misprint
Fix misprint in the error message
2020-10-11 12:13:03 -07:00
Mingun
e6d2322e68 Fix misprint in the error message 2020-10-12 00:03:21 +05:00
David Tolnay
2b504099e4
Include room for SocketAddrV6 to serialize scope id
https://github.com/rust-lang/rust/pull/77426
2020-10-05 04:02:05 -07:00
Mingun
db3074a40f Implement IntoDeserializer for Cow<[u8]> 2020-10-04 13:38:31 +05:00
Mingun
2e821eab4b Make impl IntoDeserializer for &[u8] public 2020-10-03 16:43:31 +05:00
David Tolnay
be7d0e7eb2
Ignore map_err_ignore Clippy pedantic lint 2020-09-25 21:55:59 -04:00
David Tolnay
b539cb45d7
Release 1.0.116 2020-09-11 11:56:19 -07:00
David Tolnay
a5490e20e1
Merge pull request #1888 from joshtriplett/fix-enum-deserialization-u64
Fix hand-written enum variant deserializations to allow u64 discriminant
2020-09-11 11:55:35 -07:00
Josh Triplett
45c45e87bf Fix hand-written enum variant deserializations to allow u64 discriminant
Automatically generated enum variant deserializers allowed any integer
type as the discriminant, but the hand-written ones for specific enum
types such as Result or IpAddr only allowed types up to u32. This broke
some non-human-readable deserializers for these enums, with
deserializers that emit any integer type as a u64. Switch the visit_u32
methods to visit_u64 methods to allow discriminants to have any size up
to a u64.
2020-09-10 23:24:33 -07:00
David Tolnay
2e76f7013f
Update code of conduct link 2020-09-05 13:09:37 -07:00
David Tolnay
d35de19120
Merge pull request #1885 from dtolnay/qs
Replace serde_urlencoded link with serde_qs
2020-09-05 10:35:12 -07:00
David Tolnay
e5b3507145
Replace serde_urlencoded link with serde_qs 2020-09-05 10:26:36 -07:00
David Tolnay
7ea7c2ceb9
Merge pull request #1882 from dtolnay/bincode
Rename TyOverby/bincode to servo/bincode
2020-08-28 15:43:00 -07:00