Commit Graph

3441 Commits

Author SHA1 Message Date
Erick Tryzelaar
1050f6b808 Change comment to // Safety: ...
This changes a comment to be explicit on how it's safe we can avoid
validating UTF-8.
2022-11-09 22:44:24 +00:00
Erick Tryzelaar
15ec95a98d Make Buf::as_str private and unsafe, add safety docs
serde:🇩🇪:format::Buf is a private type, so this makes it explicit by
declaring the type `pub(super)`. In addition, it marks the function
`Buf::as_str` as unsafe, which lets us document the callsites with
`// Safety: ...` comments to explain why it is safe to use.
2022-11-09 22:40:40 +00:00
David Tolnay
072145e0e9
Update TOML link to a page that covers usage with serde 2022-11-08 17:33:39 -08:00
David Tolnay
92957f17f2
Merge pull request #2317 from TomAFrench/patch-1
Update link to `toml` crate repo
2022-11-08 17:32:56 -08:00
Tom French
667db558b6
chore: update link to toml crate repo 2022-11-09 01:07:53 +00:00
David Tolnay
f41509261e
Release 1.0.147 2022-10-21 10:04:43 -07:00
David Tolnay
6d009711a2
Merge pull request #2305 from serde-rs/enumaccessdeserializer
Add EnumAccessDeserializer to turn EnumAccess into a Deserializer
2022-10-21 10:04:08 -07:00
David Tolnay
354b48fd40
Add EnumAccessDeserializer to turn EnumAccess into a Deserializer 2022-10-21 09:51:42 -07:00
David Tolnay
3fd8e52f0c
Release 1.0.146 2022-10-21 01:03:47 -07:00
David Tolnay
142dce0d3d
Touch up PR 2303 2022-10-21 01:02:46 -07:00
David Tolnay
6aed101630
Merge pull request #2303 from tage64/master
Serialize and deserialize a tagged newtype variant over unit () as if it was a unit variant
2022-10-21 00:59:40 -07:00
Tage Johansson
e2ccfd9ea7 Remove bad deserialization from sequence to internally tagged newtype variant over . 2022-10-21 09:07:27 +02:00
tage64
a07d794f74
Update test_suite/tests/test_annotations.rs
Co-authored-by: David Tolnay <dtolnay@gmail.com>
2022-10-21 08:53:55 +02:00
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
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