Commit Graph

3671 Commits

Author SHA1 Message Date
David Tolnay
1f57084365
Merge pull request #2148 from serde-rs/deserializecontent
Optimize deserialization of recursive buffered types
2022-01-01 13:16:02 -08:00
David Tolnay
56bd369422
Optimize deserialization of recursive buffered types 2022-01-01 13:01:38 -08:00
David Tolnay
ff259ec66b
Detect warnings in CI 2022-01-01 11:52:55 -08:00
David Tolnay
6c54aafeb9
Document the atomic ordering in the Serialize impl 2021-12-23 11:44:31 -08:00
David Tolnay
5d41404e67
No need for the SeqCst load in test suite 2021-12-23 11:42:41 -08:00
David Tolnay
1eccb3c350
Resolve unnecessary_to_owned clippy lint in test suite
error: unnecessary use of `to_vec`
       --> test_suite/tests/test_de.rs:251:12
        |
    251 |     .chain(ignorable_tokens.to_vec().into_iter())
        |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `ignorable_tokens.iter().copied()`
        |
        = note: `-D clippy::unnecessary-to-owned` implied by `-D clippy::all`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_to_owned
2021-12-17 18:25:04 -08:00
David Tolnay
77ae1c3bf7
Release 1.0.132 2021-12-16 11:06:42 -08:00
David Tolnay
b85e28166c
Update path to rustc target spec files 2021-12-16 11:05:58 -08:00
David Tolnay
0508cb50fc
Merge pull request #2141 from Avimitin/risc-v
Enable atomic64 on riscv64 arch
2021-12-16 11:05:14 -08:00
Avimitin
84fdc7df69
Enable atomic64 on riscv64 arch
Signed-off-by: Avimitin <avimitin@gmail.com>
2021-12-14 20:30:28 +08:00
David Tolnay
ab1ca04b2e
Release 1.0.131 2021-12-08 18:47:15 -08:00
David Tolnay
fb2fe409c8
Touch up PR 2116 2021-12-08 18:44:41 -08:00
David Tolnay
549fac7235
Merge pull request #2116 from tyranron/fix-unused-results
Fix `unused_results` complaining rustc lint in codegen for adjacently tagged enum
2021-12-08 18:43:31 -08:00
David Tolnay
c375d8b19b
Merge pull request #2124 from dtolnay/cbor
Change cbor link to new repo
2021-11-26 14:48:40 -08:00
David Tolnay
6cf507f808
Change cbor link to new repo 2021-11-26 14:43:09 -08:00
David Tolnay
c3c1641c06
Remove workaround for redundant_field_names Clippy bug 2021-11-04 20:23:25 -07:00
David Tolnay
1fcda0ebdb
Enable pedantic lints on test suite in CI 2021-11-04 20:21:48 -07:00
David Tolnay
8f16ac0a94
Move deny(clippy) to command line arguments in the CI job 2021-11-04 20:09:35 -07:00
David Tolnay
737f78c315
Ignore enum_variant_names Clippy lint in test suite
error: all variants have the same prefix: `Serialize`
        --> test_suite/tests/test_macros.rs:1741:5
         |
    1741 | /     enum E {
    1742 | |         #[serde(rename_all = "camelCase")]
    1743 | |         Serialize {
    1744 | |             serialize: bool,
    ...    |
    1756 | |         },
    1757 | |     }
         | |_____^
         |
         = note: `-D clippy::enum-variant-names` implied by `-D clippy::all`
         = help: remove the prefixes and use full paths to the variants instead of glob imports
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#enum_variant_names
2021-11-04 20:06:02 -07:00
David Tolnay
4a97386cb9
Clippy if_then_panic lint has been renamed to manual_assert 2021-11-04 19:57:14 -07:00
tyranron
5b32217877
Fix unused_results complaining rustc lint in codegen for adjacently tagged enum 2021-10-29 14:13:26 +03:00
David Tolnay
5b140361a3
Merge pull request #2102 from atouchet/url
Update URL
2021-10-14 16:33:22 -07:00
Alex Touchet
678351eac7
Update URL 2021-10-14 16:27:49 -07:00
David Tolnay
999c261d11
Ui test changes for trybuild 1.0.49 2021-10-08 02:46:15 -04:00
David Tolnay
efbe574209
Update ui test files 2021-10-07 00:56:29 -04:00
David Tolnay
33b2677384
Suppress broken semicolon_if_nothing_returned lint
https://github.com/rust-lang/rust-clippy/issues/7768

    error: consider adding a `;` to the last statement for consistent formatting
       --> serde/src/de/impls.rs:849:1
        |
    849 | / seq_impl!(
    850 | |     BinaryHeap<T: Ord>,
    851 | |     seq,
    852 | |     BinaryHeap::clear,
    ...   |
    855 | |     BinaryHeap::push
    856 | | );
        | |__^
        |
    note: the lint level is defined here
       --> serde/src/lib.rs:97:52
        |
    97  | #![cfg_attr(feature = "cargo-clippy", deny(clippy, clippy_pedantic))]
        |                                                    ^^^^^^^^^^^^^^^
        = note: `#[deny(clippy::semicolon_if_nothing_returned)]` implied by `#[deny(clippy::pedantic)]`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
    help: add a `;` here
        |
    849 + seq_impl!(
    850 +     BinaryHeap<T: Ord>,
    851 +     seq,
    852 +     BinaryHeap::clear,
    853 +     BinaryHeap::with_capacity(size_hint::cautious(seq.size_hint())),
    854 +     BinaryHeap::reserve,
      ...

    error: consider adding a `;` to the last statement for consistent formatting
       --> serde/src/de/impls.rs:859:1
        |
    859 | / seq_impl!(
    860 | |     BTreeSet<T: Eq + Ord>,
    861 | |     seq,
    862 | |     BTreeSet::clear,
    ...   |
    865 | |     BTreeSet::insert
    866 | | );
        | |__^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
    help: add a `;` here
        |
    859 + seq_impl!(
    860 +     BTreeSet<T: Eq + Ord>,
    861 +     seq,
    862 +     BTreeSet::clear,
    863 +     BTreeSet::new(),
    864 +     nop_reserve,
      ...

    error: consider adding a `;` to the last statement for consistent formatting
       --> serde/src/de/impls.rs:869:1
        |
    869 | / seq_impl!(
    870 | |     LinkedList<T>,
    871 | |     seq,
    872 | |     LinkedList::clear,
    ...   |
    875 | |     LinkedList::push_back
    876 | | );
        | |__^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
    help: add a `;` here
        |
    869 + seq_impl!(
    870 +     LinkedList<T>,
    871 +     seq,
    872 +     LinkedList::clear,
    873 +     LinkedList::new(),
    874 +     nop_reserve,
      ...

    error: consider adding a `;` to the last statement for consistent formatting
       --> serde/src/de/impls.rs:879:1
        |
    879 | / seq_impl!(
    880 | |     HashSet<T: Eq + Hash, S: BuildHasher + Default>,
    881 | |     seq,
    882 | |     HashSet::clear,
    883 | |     HashSet::with_capacity_and_hasher(size_hint::cautious(seq.size_hint()), S::default()),
    884 | |     HashSet::reserve,
    885 | |     HashSet::insert);
        | |_____________________^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
    help: add a `;` here
        |
    879 + seq_impl!(
    880 +     HashSet<T: Eq + Hash, S: BuildHasher + Default>,
    881 +     seq,
    882 +     HashSet::clear,
    883 +     HashSet::with_capacity_and_hasher(size_hint::cautious(seq.size_hint()), S::default()),
    884 +     HashSet::reserve,
      ...

    error: consider adding a `;` to the last statement for consistent formatting
       --> serde/src/de/impls.rs:888:1
        |
    888 | / seq_impl!(
    889 | |     VecDeque<T>,
    890 | |     seq,
    891 | |     VecDeque::clear,
    ...   |
    894 | |     VecDeque::push_back
    895 | | );
        | |__^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
    help: add a `;` here
        |
    888 + seq_impl!(
    889 +     VecDeque<T>,
    890 +     seq,
    891 +     VecDeque::clear,
    892 +     VecDeque::with_capacity(size_hint::cautious(seq.size_hint())),
    893 +     VecDeque::reserve,
      ...

    error: consider adding a `;` to the last statement for consistent formatting
        --> serde/src/de/impls.rs:1300:1
         |
    1300 | / map_impl!(
    1301 | |     BTreeMap<K: Ord, V>,
    1302 | |     map,
    1303 | |     BTreeMap::new());
         | |_____________________^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
    help: add a `;` here
         |
    1300 + map_impl!(
    1301 +     BTreeMap<K: Ord, V>,
    1302 +     map,
    1303 +     BTreeMap::new());;
         |

    error: consider adding a `;` to the last statement for consistent formatting
        --> serde/src/de/impls.rs:1306:1
         |
    1306 | / map_impl!(
    1307 | |     HashMap<K: Eq + Hash, V, S: BuildHasher + Default>,
    1308 | |     map,
    1309 | |     HashMap::with_capacity_and_hasher(size_hint::cautious(map.size_hint()), S::default()));
         | |___________________________________________________________________________________________^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
    help: add a `;` here
         |
    1306 + map_impl!(
    1307 +     HashMap<K: Eq + Hash, V, S: BuildHasher + Default>,
    1308 +     map,
    1309 +     HashMap::with_capacity_and_hasher(size_hint::cautious(map.size_hint()), S::default()));;
         |
2021-10-04 23:57:05 -04:00
David Tolnay
01ded9f405
Declare minimum Rust version in Cargo metadata 2021-10-02 02:43:22 -04:00
David Tolnay
fc827ecec2
Resolve redundant_closure_for_method_calls clippy lints
error: redundant closure
      --> serde_derive/src/bound.rs:53:19
       |
    53 |         .flat_map(|predicates| predicates.to_vec());
       |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `[T]::to_vec`
       |
    note: the lint level is defined here
      --> serde_derive/src/lib.rs:18:22
       |
    18 | #![deny(clippy::all, clippy::pedantic)]
       |                      ^^^^^^^^^^^^^^^^
       = note: `#[deny(clippy::redundant_closure_for_method_calls)]` implied by `#[deny(clippy::pedantic)]`
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_for_method_calls

    error: redundant closure
      --> serde_derive/src/bound.rs:75:19
       |
    75 |         .flat_map(|predicates| predicates.to_vec());
       |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `[T]::to_vec`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_for_method_calls
2021-09-30 00:31:49 -04:00
David Tolnay
5c785eee58
Ignore if_then_panic clippy lint
error: only a `panic!` in `if`-then statement
      --> serde_derive/src/internals/ctxt.rs:58:9
       |
    58 | /         if !thread::panicking() && self.errors.borrow().is_some() {
    59 | |             panic!("forgot to check for errors");
    60 | |         }
       | |_________^ help: try: `assert!(!!thread::panicking() && self.errors.borrow().is_some(), "forgot to check for errors");`
       |
    note: the lint level is defined here
      --> serde_derive/src/lib.rs:18:9
       |
    18 | #![deny(clippy::all, clippy::pedantic)]
       |         ^^^^^^^^^^^
       = note: `#[deny(clippy::if_then_panic)]` implied by `#[deny(clippy::all)]`
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_then_panic

    error: only a `panic!` in `if`-then statement
       --> serde_test/src/assert.rs:73:5
        |
    73  | /     if ser.remaining() > 0 {
    74  | |         panic!("{} remaining tokens", ser.remaining());
    75  | |     }
        | |_____^ help: try: `assert!(!ser.remaining() > 0, "{} remaining tokens", ser.remaining());`
        |
    note: the lint level is defined here
       --> serde_test/src/lib.rs:149:44
        |
    149 | #![cfg_attr(feature = "cargo-clippy", deny(clippy, clippy_pedantic))]
        |                                            ^^^^^^
        = note: `#[deny(clippy::if_then_panic)]` implied by `#[deny(clippy::all)]`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_then_panic

    error: only a `panic!` in `if`-then statement
       --> serde_test/src/assert.rs:126:5
        |
    126 | /     if ser.remaining() > 0 {
    127 | |         panic!("{} remaining tokens", ser.remaining());
    128 | |     }
        | |_____^ help: try: `assert!(!ser.remaining() > 0, "{} remaining tokens", ser.remaining());`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_then_panic

    error: only a `panic!` in `if`-then statement
       --> serde_test/src/assert.rs:166:5
        |
    166 | /     if de.remaining() > 0 {
    167 | |         panic!("{} remaining tokens", de.remaining());
    168 | |     }
        | |_____^ help: try: `assert!(!de.remaining() > 0, "{} remaining tokens", de.remaining());`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_then_panic

    error: only a `panic!` in `if`-then statement
       --> serde_test/src/assert.rs:180:5
        |
    180 | /     if de.remaining() > 0 {
    181 | |         panic!("{} remaining tokens", de.remaining());
    182 | |     }
        | |_____^ help: try: `assert!(!de.remaining() > 0, "{} remaining tokens", de.remaining());`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_then_panic

    error: only a `panic!` in `if`-then statement
       --> serde_test/src/assert.rs:220:5
        |
    220 | /     if de.remaining() > 0 {
    221 | |         panic!("{} remaining tokens", de.remaining());
    222 | |     }
        | |_____^ help: try: `assert!(!de.remaining() > 0, "{} remaining tokens", de.remaining());`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_then_panic

    error: only a `panic!` in `if`-then statement
        --> test_suite/tests/test_de.rs:1349:9
         |
    1349 | /         if de.remaining() > 0 {
    1350 | |             panic!("{} remaining tokens", de.remaining());
    1351 | |         }
         | |_________^ help: try: `assert!(!de.remaining() > 0, "{} remaining tokens", de.remaining());`
         |
         = note: `-D clippy::if-then-panic` implied by `-D clippy::all`
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_then_panic
2021-09-30 00:31:49 -04:00
David Tolnay
819db93a3d
Format with rustfmt 2021-09-29 2021-09-30 00:31:49 -04:00
David Tolnay
a6690ea2fe
Update ui test suite to nightly-2021-09-14 2021-09-14 19:13:54 -07:00
David Tolnay
65e1a50749
Release 1.0.130 2021-08-28 11:31:38 -07:00
David Tolnay
87d41b59fd
Merge pull request #2081 from dtolnay/accessunsized
Enable unsized Map/SeqAccess types to use the impl for &mut
2021-08-28 11:11:57 -07:00
David Tolnay
3f120fb355
Enable unsized Map/SeqAccess types to use the impl for &mut 2021-08-28 10:59:51 -07:00
David Tolnay
2b92c80cc1
Release 1.0.129 2021-08-23 15:01:24 -07:00
David Tolnay
c1c0ede452
Merge pull request #2080 from dtolnay/packeddrop
Support packed remote struct without destructuring
2021-08-23 15:00:50 -07:00
David Tolnay
4a66c5f33d
Support packed remote struct without destructuring 2021-08-23 14:38:33 -07:00
David Tolnay
714c8a5586
Add test of packed struct that cannot be destructured
Currently fails:

    error[E0509]: cannot move out of type `RemotePackedNonCopyDef`, which implements the `Drop` trait
       --> test_suite/tests/test_gen.rs:876:10
        |
    876 | #[derive(Deserialize)]
        |          ^^^^^^^^^^^
        |          |
        |          cannot move out of here
        |          data moved here
        |          move occurs because `__v1` has type `std::string::String`, which does not implement the `Copy` trait
        |
        = note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
2021-08-23 14:38:33 -07:00
David Tolnay
dc0c0dcba1
Merge pull request #2079 from dtolnay/packedremote
Fix unaligned reference warnings on packed remote def
2021-08-23 14:38:21 -07:00
David Tolnay
54102ee7d0
Avoid generating ref patterns for fields of packed remote struct 2021-08-23 10:18:28 -07:00
David Tolnay
14accf7518
Add test of remote with a packed struct
Currently fails to build:

    error: reference to packed field is unaligned
       --> test_suite/tests/test_gen.rs:858:10
        |
    858 | #[derive(Serialize, Deserialize)]
        |          ^^^^^^^^^
        |
    note: the lint level is defined here
       --> test_suite/tests/test_gen.rs:5:9
        |
    5   | #![deny(warnings)]
        |         ^^^^^^^^
        = note: `#[deny(unaligned_references)]` implied by `#[deny(warnings)]`
        = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
        = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
        = note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: reference to packed field is unaligned
       --> test_suite/tests/test_gen.rs:858:21
        |
    858 | #[derive(Serialize, Deserialize)]
        |                     ^^^^^^^^^^^
        |
        = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
        = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
        = note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
2021-08-23 10:18:05 -07:00
David Tolnay
55fdbea20b
Merge pull request #2077 from dtolnay/tryfold
Use try_fold in default implementation of collect_seq, collect_map
2021-08-21 14:08:20 -07:00
David Tolnay
75d8902371
Use try_fold in default implementation of collect_seq, collect_map 2021-08-21 14:00:51 -07:00
David Tolnay
9451ea8df1
Format PR 1992 with rustfmt 2021-08-21 12:49:58 -07:00
David Tolnay
c1ce03b3dd
Merge pull request 1992 from Mingun/unnecessary-deserialize-with 2021-08-21 12:49:39 -07:00
David Tolnay
a587eb8953
Release 1.0.128 2021-08-21 10:39:32 -07:00
Oli Scherer
990f7eb6c1
Merge pull request #2076 from Manishearth/emscripten-i128
Enable 128-bit integers on emscripten post Rust 1.40
2021-08-21 19:19:30 +02:00
Manish Goregaokar
082e18f9a1 Rust supports i128/u128 on emscripten post Rust 1.40 2021-08-20 21:57:06 -07:00
David Tolnay
f309485787
Ignore buggy collapsible_match clippy lint
https://github.com/rust-lang/rust-clippy/issues/7575
2021-08-16 19:32:10 -07:00
David Tolnay
e2f85681fe
Release 1.0.127 2021-07-30 20:59:13 -07:00