Commit Graph

3829 Commits

Author SHA1 Message Date
Tage Johansson
90d28fc314 Serialize and deserialize a tagged newtype variant over unit () as if it was a unit variant. 2022-10-21 00:27:46 +02:00
David Tolnay
55cf0ac51a
Merge pull request #2297 from serde-rs/output
Switch from set-output to $GITHUB_OUTPUT
2022-10-13 09:47:29 -07:00
David Tolnay
07696c1674
Switch from set-output to $GITHUB_OUTPUT 2022-10-13 09:38:56 -07:00
David Tolnay
f803b290f3
Ignore uninlined_format_args pedantic clippy lint false positive
Clippy's suggested fix is not valid in 2018 edition. The
serde_test_suite crate can't be updated to 2021 edition yet because CI
of the serde crate on old toolchains needs to be able to parse all
manifests in the workspace, even if serde_test_suite is not being
compiled in those builds.

    error: variables can be used directly in the `format!` string
        --> test_suite/tests/test_de.rs:2260:23
         |
    2260 |             Err(e) => panic!("tokens failed to deserialize: {}", e),
         |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
         = note: `-D clippy::uninlined-format-args` implied by `-D clippy::pedantic`
    help: change this to
         |
    2260 -             Err(e) => panic!("tokens failed to deserialize: {}", e),
    2260 +             Err(e) => panic!("tokens failed to deserialize: {e}"),
         |

    warning: unused variable: `e`
        --> test_suite/tests/test_de.rs:2260:17
         |
    2260 |             Err(e) => panic!("tokens failed to deserialize: {e}"),
         |                 ^ help: if this is intentional, prefix it with an underscore: `_e`
         |
         = note: `#[warn(unused_variables)]` on by default

    warning: panic message contains an unused formatting placeholder
        --> test_suite/tests/test_de.rs:2260:61
         |
    2260 |             Err(e) => panic!("tokens failed to deserialize: {e}"),
         |                                                             ^^^
         |
         = note: this message is not used as a format string when given without arguments, but will be in Rust 2021
         = note: `#[warn(non_fmt_panics)]` on by default
    help: add the missing argument
         |
    2260 |             Err(e) => panic!("tokens failed to deserialize: {e}", ...),
         |                                                                 +++++
    help: or add a "{}" format string to use the message literally
         |
    2260 |             Err(e) => panic!("{}", "tokens failed to deserialize: {e}"),
         |                              +++++
2022-10-07 21:46:25 -07:00
David Tolnay
d96e181150
Resolve uninlined_format_args pedantic clippy lint in test suite
error: variables can be used directly in the `format!` string
        --> test_suite/tests/test_annotations.rs:1238:30
         |
    1238 |     serializer.serialize_str(format!("{};{:?}", f1, f2).as_str())
         |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
         = note: `-D clippy::uninlined-format-args` implied by `-D clippy::pedantic`
    help: change this to
         |
    1238 -     serializer.serialize_str(format!("{};{:?}", f1, f2).as_str())
    1238 +     serializer.serialize_str(format!("{f1};{f2:?}").as_str())
         |
2022-10-07 21:45:03 -07:00
David Tolnay
3ffb86fc70
Ui test changes for trybuild 1.0.66 2022-10-04 22:28:38 -07:00
David Tolnay
649a72a587
Merge pull request 2284 from benediktwerner/patch-1 2022-09-22 23:35:24 -07:00
Benedikt Werner
b2676348eb
Fix "deserialize" -> "deserialize_any" in Deserializer documentation 2022-09-23 08:29:25 +02:00
David Tolnay
8c036ee5a3
Release 1.0.145 2022-09-22 10:50:08 -07:00
David Tolnay
d99009f3c6
Merge pull request #2282 from ChayimFriedman2/sized-mutex-refcell-rwlock
Serialize unsized `RefCell`, `Mutex` and `RwLock`
2022-09-22 10:48:54 -07:00
Chayim Refael Friedman
be3c37eb8b Serialize unsized RefCell, Mutex and RwLock 2022-09-22 09:57:55 +03:00
David Tolnay
f0346ae054
Merge pull request #2281 from dtolnay/try
Redefine `try` macro to omit From::from error conversion
2022-09-21 22:15:10 -07:00
David Tolnay
fa6ce42056
Redefine 'try' macro to omit From::from error conversion 2022-09-21 22:01:15 -07:00
David Tolnay
a9320db6f9
Consistently avoid '?' throughout serde crate
This makes it easy to redefine a 'try' macro to compare compile-time
between `$expr?` and `match $expr { Ok=>v, Err=>return }`.
2022-09-21 21:34:04 -07:00
David Tolnay
d208762c81
Command-line ignore let_underscore_drop clippy lint
For whatever reason, the #![cfg_attr(feature = "cargo-clippy", allow(let_underscore_drop))]
attributes already in the code stopped working in the most recent nightly (2022-09-03).
Likely in connection with https://github.com/rust-lang/rust/pull/97739 ?

    error: non-binding `let` on a type that implements `Drop`
       --> serde/src/de/mod.rs:958:13
        |
    958 |             let _ = visitor;
        |             ^^^^^^^^^^^^^^^^
        |
        = note: `-D clippy::let-underscore-drop` implied by `-D clippy::pedantic`
        = help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_drop

    error: non-binding `let` on a type that implements `Drop`
       --> serde/src/de/mod.rs:992:13
        |
    992 |             let _ = visitor;
        |             ^^^^^^^^^^^^^^^^
        |
        = help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_drop

    error: non-binding `let` on a type that implements `Drop`
        --> serde/src/de/mod.rs:1616:9
         |
    1616 |         let _ = deserializer;
         |         ^^^^^^^^^^^^^^^^^^^^^
         |
         = help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_drop

    error: non-binding `let` on a type that implements `Drop`
        --> serde/src/de/mod.rs:1640:9
         |
    1640 |         let _ = deserializer;
         |         ^^^^^^^^^^^^^^^^^^^^^
         |
         = help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_drop

    error: non-binding `let` on a type that implements `Drop`
        --> serde/src/de/mod.rs:1651:9
         |
    1651 |         let _ = seq;
         |         ^^^^^^^^^^^^
         |
         = help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_drop

    error: non-binding `let` on a type that implements `Drop`
        --> serde/src/de/mod.rs:1662:9
         |
    1662 |         let _ = map;
         |         ^^^^^^^^^^^^
         |
         = help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_drop

    error: non-binding `let` on a type that implements `Drop`
        --> serde/src/de/mod.rs:1673:9
         |
    1673 |         let _ = data;
         |         ^^^^^^^^^^^^^
         |
         = help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_drop

    error: non-binding `let` on a type that implements `Drop`
        --> serde/src/private/de.rs:1440:13
         |
    1440 |             let _ = visitor;
         |             ^^^^^^^^^^^^^^^^
         |
         = help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_drop

    error: non-binding `let` on a type that implements `Drop`
        --> serde/src/private/de.rs:2163:13
         |
    2163 |             let _ = visitor;
         |             ^^^^^^^^^^^^^^^^
         |
         = help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_drop
2022-09-02 21:16:27 -07:00
David Tolnay
5386897d24
Merge pull request #2273 from sashashura/patch-1
GitHub Workflows security hardening
2022-09-02 15:01:40 -07:00
Alex
68eb59df0c
Update ci.yml
Signed-off-by: sashashura <93376818+sashashura@users.noreply.github.com>
2022-09-02 16:43:23 +01:00
David Tolnay
a7f4551669
Add dev-dependencies keyword for serde_test 2022-08-30 22:52:10 -07:00
Yin Jifeng
983347484e fix: don't check skipped variant with internal tag 2022-08-23 20:19:34 +08:00
David Tolnay
f52d134c14
Release 1.0.144 2022-08-20 20:24:28 -07:00
David Tolnay
6660676b0d
Merge pull request #2263 from taiki-e/ordering
Relax orderings of Serialize impl for atomic types to match the latest stable
2022-08-20 20:22:34 -07:00
Taiki Endo
1d42d3571a Relax orderings of Serialize impl for atomic types to match the latest stable 2022-08-20 22:27:22 +09:00
David Tolnay
ebd06eebdb
Link to apache-avro crate's published docs 2022-08-12 21:34:41 -07:00
David Tolnay
f1985823a3
Merge pull request #2258 from Mottl/patch-1
Fixes link to Apache Avro in documentation
2022-08-12 21:33:43 -07:00
Dmitry Mottl
60e4092b8e
Fixes link to Apache Avro in documentation 2022-08-12 18:52:26 +04:00
David Tolnay
3d0251666e
Release 1.0.143 2022-08-08 19:12:43 -07:00
David Tolnay
7770da4929
Merge pull request #2253 from taiki-e/test-cfg
Invert build.rs cfgs in serde_test
2022-08-08 19:08:35 -07:00
Taiki Endo
a5fd85a9ef Invert build.rs cfgs in serde_test 2022-08-04 20:20:31 +09:00
David Tolnay
abb2a8494d
Release 1.0.142 2022-08-03 07:09:15 -07:00
David Tolnay
a31d0be191
Update keywords in crates.io metadata 2022-08-02 10:38:57 -07:00
David Tolnay
d786e750d7
Release 1.0.141 2022-08-01 08:50:46 -07:00
David Tolnay
10e4839f83
Move Postcard link up to Bincode spot
Bincode has been in prerelease limbo for nearly a year and the readme
does not mention anything related to Serde, so it is not serving as a
good first link to a Serde binary format.
2022-08-01 08:49:45 -07:00
David Tolnay
85e72653c8
Add categories to crates.io metadata 2022-08-01 00:06:49 -07:00
David Tolnay
c9cc8a8924
Add authors to Cargo.toml 2022-07-31 19:25:47 -07:00
David Tolnay
a925ce4119
Sort package entries in Cargo.toml 2022-07-31 19:19:07 -07:00
David Tolnay
c5f6338ce2
Release 1.0.140 2022-07-20 09:26:28 -07:00
David Tolnay
5185487d73
Merge pull request #2251 from taiki-e/derive-cfg
Invert build.rs cfgs in serde_derive
2022-07-20 09:25:14 -07:00
Taiki Endo
efaafd4458 Invert build.rs cfgs in serde_derive 2022-07-21 01:15:37 +09:00
David Tolnay
a0eb83a5d4
Resolve invalid_utf8_in_unchecked clippy lint in ancient test code
error: non UTF-8 literal in `std::str::from_utf8_unchecked`
       --> test_suite/tests/test_ser.rs:803:25
        |
    803 |     let path = unsafe { str::from_utf8_unchecked(b"Hello \xF0\x90\x80World") };
        |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
        = note: `-D clippy::invalid-utf8-in-unchecked` implied by `-D clippy::all`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#invalid_utf8_in_unchecked
2022-07-18 21:29:39 -07:00
David Tolnay
7cc6f7fbb0
Ignore new_without_default clippy lint
error: you should consider adding a `Default` implementation for `UnitDeserializer<E>`
       --> serde/src/de/value.rs:144:5
        |
    144 | /     pub fn new() -> Self {
    145 | |         UnitDeserializer {
    146 | |             marker: PhantomData,
    147 | |         }
    148 | |     }
        | |_____^
        |
        = note: `-D clippy::new-without-default` implied by `-D clippy::all`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
    help: try adding this
        |
    142 + impl<E> Default for UnitDeserializer<E> {
    143 +     fn default() -> Self {
    144 +         Self::new()
    145 +     }
    146 + }
        |
2022-07-11 21:19:58 -07:00
David Tolnay
44b9496c91
Release 1.0.139 2022-07-10 21:51:21 -07:00
David Tolnay
7e1486d0da
Merge pull request #2246 from dtolnay/valuedenew
Add constructor function for all IntoDeserializer impls
2022-07-10 21:50:24 -07:00
David Tolnay
8170ffef2e
Add constructor function for all IntoDeserializer impls 2022-07-10 21:42:03 -07:00
David Tolnay
4b622f6bbf
Release 1.0.138 2022-07-01 20:09:56 -07:00
David Tolnay
0ee71c70af
Ignore explicit_auto_deref clippy lint
error: deref which would be done by auto-deref
        --> serde/src/de/impls.rs:2014:59
         |
    2014 | ...                   Err(Error::unknown_field(&*value, FIELDS))
         |                                                 ^^^^^^ help: try this: `value`
         |
         = note: `-D clippy::explicit-auto-deref` implied by `-D clippy::all`
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref

    error: deref which would be done by auto-deref
        --> serde/src/de/impls.rs:2354:55
         |
    2354 | ...                   Err(Error::unknown_field(&*value, FIELDS))
         |                                                 ^^^^^^ help: try this: `value`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref
2022-07-01 19:41:14 -07:00
David Tolnay
6c098e497e
Merge pull request #2240 from Kixunil/patch-1
Call `reserve()` in `DeserializeSeed` example
2022-06-30 09:39:25 -07:00
Martin Habovštiak
41ffa6df7e
Call reserve() in DeserializeSeed example
This suggests calling `reserve()` in example code so that people who ~blindly copy it get faster code.
2022-06-30 18:28:52 +02:00
David Tolnay
845b900fd5
Exclude deliberately pinned prettyplease crate from cargo outdated 2022-06-22 21:07:57 -07:00
David Tolnay
7891ae7184
Merge pull request #2228 from serde-rs/expandtest
Update macrotest to 1.0.9 and enable in CI
2022-06-20 03:53:50 -07:00
David Tolnay
bac90d19b9
Update macrotest to 1.0.9 and enable in CI 2022-06-20 03:40:49 -07:00