1353 Commits

Author SHA1 Message Date
David Tolnay
de251c8198
Add test of Display for Number containing float 2022-08-21 13:37:56 -07:00
David Tolnay
6b8b07365e
Release 1.0.84 v1.0.84 2022-08-21 13:24:42 -07:00
David Tolnay
9e9b2b72fb
Revert "Avoid cargo 1.45–1.50 in GitHub Actions"
This reverts commit 39fa675ecf75dc80a5f0ea4b6d160980390930e5.
2022-08-21 13:24:24 -07:00
David Tolnay
a685113765
Merge pull request #918 from serde-rs/debug
Reduce unneeded parens and newlines in Debug for Value
2022-08-21 13:23:26 -07:00
David Tolnay
dd6a86db07
Reduce unneeded parens and newlines in Debug for Value 2022-08-21 13:11:47 -07:00
David Tolnay
de62e3e406
Make Debug test compatible with preserve_order 2022-08-21 13:00:58 -07:00
David Tolnay
0671603282
Cover all the Value variants in indented Debug test 2022-08-21 12:59:04 -07:00
David Tolnay
a047355bcd
Move expected value for indented debug test into test 2022-08-21 12:57:19 -07:00
David Tolnay
39fa675ecf
Avoid cargo 1.45–1.50 in GitHub Actions
These versions are incompatible with packages published by a recent Cargo
2022-08-08 23:02:34 -07:00
David Tolnay
2b0403f5cd
Release 1.0.83 v1.0.83 2022-08-03 07:08:00 -07:00
David Tolnay
db96d72c3f
Add categories to crates.io metadata 2022-08-01 00:06:49 -07:00
David Tolnay
25129334eb
Add authors to Cargo.toml 2022-07-31 19:25:47 -07:00
David Tolnay
22da79711a
Sort package entries in Cargo.toml 2022-07-31 19:19:07 -07:00
David Tolnay
01ef46e363
Ignore assertions_on_result_states clippy lint
error: called `assert!` with `Result::is_err`
      --> tests/regression/issue795.rs:53:5
       |
    53 |     assert!(serde_json::from_str::<Enum>(s).is_err());
       |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `serde_json::from_str::<Enum>(s).unwrap_err()`
       |
       = note: `-D clippy::assertions-on-result-states` implied by `-D clippy::all`
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_result_states

    error: called `assert!` with `Result::is_err`
      --> tests/regression/issue795.rs:56:5
       |
    56 |     assert!(serde_json::from_value::<Enum>(j).is_err());
       |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `serde_json::from_value::<Enum>(j).unwrap_err()`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_result_states

    error: called `assert!` with `Result::is_err`
       --> tests/stream.rs:179:9
        |
    179 |         assert!(stream.next().unwrap().is_err());
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `stream.next().unwrap().unwrap_err()`
        |
        = note: `-D clippy::assertions-on-result-states` implied by `-D clippy::all`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_result_states

    error: called `assert!` with `Result::is_err`
       --> tests/test.rs:940:5
        |
    940 |     assert!(v.is_err());
        |     ^^^^^^^^^^^^^^^^^^^ help: replace with: `v.unwrap_err()`
        |
        = note: `-D clippy::assertions-on-result-states` implied by `-D clippy::all`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_result_states

    error: called `assert!` with `Result::is_err`
        --> tests/test.rs:1735:5
         |
    1735 |     assert!(res.is_err());
         |     ^^^^^^^^^^^^^^^^^^^^^ help: replace with: `res.unwrap_err()`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_result_states

    error: called `assert!` with `Result::is_err`
        --> tests/test.rs:1738:5
         |
    1738 |     assert!(res.is_err());
         |     ^^^^^^^^^^^^^^^^^^^^^ help: replace with: `res.unwrap_err()`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_result_states

    error: called `assert!` with `Result::is_err`
        --> tests/test.rs:1741:5
         |
    1741 |     assert!(res.is_err());
         |     ^^^^^^^^^^^^^^^^^^^^^ help: replace with: `res.unwrap_err()`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_result_states

    error: called `assert!` with `Result::is_err`
        --> tests/test.rs:1930:5
         |
    1930 |     assert!(serde_json::to_value(&map).is_err());
         |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `serde_json::to_value(&map).unwrap_err()`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_result_states

    error: called `assert!` with `Result::is_err`
        --> tests/test.rs:2005:5
         |
    2005 |     assert!(from_str::<E>(r#" "V"0 "#).is_err());
         |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `from_str::<E>(r#" "V"0 "#).unwrap_err()`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_result_states
2022-07-29 22:11:16 -07:00
David Tolnay
aac479a70a
Avoid cargo 1.43–1.45 in GitHub Actions
These versions are incompatible with some recent GitHub change

    error: failed to get `indexmap` as a dependency of package `serde_json v1.0.82 (/home/runner/work/json/json)`

    Caused by:
      failed to load source for dependency `indexmap`

    Caused by:
      Unable to update registry `https://github.com/rust-lang/crates.io-index`

    Caused by:
      failed to fetch `https://github.com/rust-lang/crates.io-index`

    Caused by:
      error reading from the zlib stream; class=Zlib (5)
2022-07-26 21:24:07 -07:00
David Tolnay
1a433816f6
Convert i/u128 conversion to itoa instead of std::fmt 2022-07-20 15:18:35 -07:00
David Tolnay
84c157b41d
Directly install aarch64-unknown-none target support 2022-07-20 15:07:22 -07:00
David Tolnay
d1cbbb634a
Update ui test suite to nightly-2022-07-20 2022-07-19 21:20:38 -07:00
David Tolnay
5b441a2881
Ignore explicit_auto_deref clippy lint
error: deref which would be done by auto-deref
      --> src/value/partial_eq.rs:32:22
       |
    32 |         eq_str(self, *other)
       |                      ^^^^^^ help: try this: `other`
       |
       = 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
      --> src/value/partial_eq.rs:44:23
       |
    44 |         eq_str(other, *self)
       |                       ^^^^^ help: try this: `self`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref
2022-07-01 19:37:10 -07:00
David Tolnay
11cb87a59d
Speed up fuzz build in CI using precompiled cargo-fuzz 2022-06-29 15:07:03 -07:00
David Tolnay
f286714a4b
Release 1.0.82 v1.0.82 2022-06-29 11:46:28 -07:00
David Tolnay
df704c2468
Merge pull request #900 from kvnvelasco/implement_from_option_for_value
Make Value be From<Option<T>>
2022-06-29 11:44:50 -07:00
Kevin Velasco
b87778bf54 don't use experimental (in 1.36) Self:: access for enums 2022-06-24 11:20:05 +08:00
Kevin Velasco
1bf61e9c08 make Value be From<Option<T>> 2022-06-24 10:59:21 +08:00
David Tolnay
3d173405c2
Bump oldest rustc for preserve_order feature to 1.56.1
Required by 2021 edition in hashbrown.

    error: failed to download `hashbrown v0.12.1`

    Caused by:
      unable to get packages from source

    Caused by:
      failed to parse manifest at github.com-1ecc6299db9ec823/hashbrown-0.12.1/Cargo.toml

    Caused by:
      failed to parse the `edition` key

    Caused by:
      this version of Cargo is older than the `2021` edition, and only supports `2015` and `2018` editions.
2022-06-16 20:51:46 -07:00
David Tolnay
dab5ed3ee9
Merge pull request #895 from dtolnay/ref
Eliminate all use of ref keyword
2022-06-07 00:33:32 -07:00
David Tolnay
05e03ee181
Eliminate all use of ref keyword 2022-06-07 00:18:53 -07:00
David Tolnay
45f1c4a744
Resolve borrow_deref_ref clippy lint
error: deref on an immutable reference
       --> src/value/mod.rs:428:45
        |
    428 |             Value::Array(ref array) => Some(&*array),
        |                                             ^^^^^^^
        |
        = note: `-D clippy::borrow-deref-ref` implied by `-D clippy::all`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#borrow_deref_ref
    help: if you would like to reborrow, try removing `&*`
        |
    428 |             Value::Array(ref array) => Some(array),
        |                                             ~~~~~
    help: if you would like to deref, try using `&**`
        |
    428 |             Value::Array(ref array) => Some(&**array),
        |                                             ~~~~~~~~
2022-06-07 00:03:59 -07:00
David Tolnay
de5c34b704
Resolve get_first clippy lint
error: accessing first element with `slice.as_bytes().get(0)`
       --> src/error.rs:441:11
        |
    441 |     match slice.as_bytes().get(0) {
        |           ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `slice.as_bytes().first()`
        |
        = note: `-D clippy::get-first` implied by `-D clippy::all`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#get_first
2022-06-07 00:02:33 -07:00
David Tolnay
6b91c96f8d
Check for outdated deps in fuzz target 2022-06-06 17:04:11 -07:00
David Tolnay
845b928a63
Add actions job to notice outdated dependencies 2022-06-06 15:58:20 -07:00
David Tolnay
f901012df6
Ignore derive_partial_eq_without_eq clippy lint
error: you are deriving `PartialEq` and can implement `Eq`
      --> tests/test.rs:65:24
       |
    65 | #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
       |                        ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
       |
       = note: `-D clippy::derive-partial-eq-without-eq` implied by `-D clippy::all`
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
      --> tests/test.rs:74:24
       |
    74 | #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
       |                        ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
       --> tests/test.rs:565:25
        |
    565 |     #[derive(Serialize, PartialEq, Debug)]
        |                         ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> tests/test.rs:1278:28
         |
    1278 |     #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
         |                            ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> tests/test.rs:1395:21
         |
    1395 |     #[derive(Debug, PartialEq, Deserialize)]
         |                     ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> tests/test.rs:1415:21
         |
    1415 |     #[derive(Debug, PartialEq, Deserialize)]
         |                     ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> tests/test.rs:1425:21
         |
    1425 |     #[derive(Debug, PartialEq, Deserialize)]
         |                     ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> tests/test.rs:1627:21
         |
    1627 |     #[derive(Debug, PartialEq, Serialize, Deserialize)]
         |                     ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq
2022-05-21 20:46:06 -07:00
David Tolnay
b899429dfb
Update fuzz manifest to match cargo fuzz's new template 2022-05-15 13:02:16 -07:00
David Tolnay
efa4c9f9bb
Ignore unused_macro_rules warning in test macros
warning: 1st rule of macro `json_str` is never used
     --> tests/macros/mod.rs:2:5
      |
    2 |     ([]) => {
      |     ^^^^
      |
      = note: `#[warn(unused_macro_rules)]` on by default

    warning: 3rd rule of macro `json_str` is never used
      --> tests/macros/mod.rs:11:5
       |
    11 |     ({}) => {
       |     ^^^^
2022-05-12 21:34:53 -07:00
David Tolnay
2683b1aedc
Run miri in stricter miri-strict-provenance mode 2022-05-06 04:01:35 -07:00
David Tolnay
9fcdb679bd
Merge pull request #889 from dzvon/patch-1
Fix a typo
2022-05-05 07:21:21 -07:00
Dezhi Wu
aed7f7c818
Fix a typo 2022-05-05 22:07:13 +08:00
David Tolnay
a0ea9371cd
Release 1.0.81 v1.0.81 2022-05-03 12:19:34 -07:00
David Tolnay
6c3dfe948a
Make it clearer that preserve_order implies a std dependency
As indicated in the summary of #885.
2022-05-03 12:18:34 -07:00
David Tolnay
f34ef95fd1
Merge pull request #885 from cuviper/indexmap-std
Explicitly enable indexmap/std
2022-05-03 12:17:44 -07:00
Josh Stone
27939bb1f9 Explicitly enable indexmap/std 2022-05-03 11:57:05 -07:00
David Tolnay
c0f93432cc
Ignore trait_duplication_in_bounds clippy false positives
https://github.com/rust-lang/rust-clippy/issues/8757

    error: this trait bound is already specified in the where clause
      --> tests/regression/issue845.rs:13:8
       |
    13 |     T: TryFrom<u64> + TryFrom<i64> + FromStr,
       |        ^^^^^^^^^^^^
       |
       = note: `-D clippy::trait-duplication-in-bounds` implied by `-D clippy::pedantic`
       = help: consider removing this trait bound
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trait_duplication_in_bounds

    error: this trait bound is already specified in the where clause
      --> tests/regression/issue845.rs:14:33
       |
    14 |     <T as TryFrom<u64>>::Error: Display,
       |                                 ^^^^^^^
       |
       = help: consider removing this trait bound
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trait_duplication_in_bounds

    error: this trait bound is already specified in the where clause
      --> tests/regression/issue845.rs:49:8
       |
    49 |     T: TryFrom<u64> + TryFrom<i64> + FromStr,
       |        ^^^^^^^^^^^^
       |
       = help: consider removing this trait bound
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trait_duplication_in_bounds

    error: this trait bound is already specified in the where clause
      --> tests/regression/issue845.rs:50:33
       |
    50 |     <T as TryFrom<u64>>::Error: Display,
       |                                 ^^^^^^^
       |
       = help: consider removing this trait bound
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trait_duplication_in_bounds
2022-04-30 20:19:52 -07:00
David Tolnay
048a64caec
Resolve type_repetition_in_bounds clippy lint
error: this type has already been used as a bound predicate
       --> src/value/ser.rs:278:9
        |
    278 |         T: Display,
        |         ^^^^^^^^^^
        |
        = note: `-D clippy::type-repetition-in-bounds` implied by `-D clippy::pedantic`
        = help: consider combining the bounds: `T: Sized + Display`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_repetition_in_bounds

    error: this type has already been used as a bound predicate
       --> src/value/ser.rs:611:9
        |
    611 |         T: Display,
        |         ^^^^^^^^^^
        |
        = help: consider combining the bounds: `T: Sized + Display`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_repetition_in_bounds
2022-04-30 20:16:37 -07:00
David Tolnay
585e4c5dc7
Release 1.0.80 v1.0.80 2022-04-30 12:16:22 -07:00
David Tolnay
52a9c050f5
Pull miri from miri branch of dtolnay/rust-toolchain 2022-04-28 19:38:27 -07:00
David Tolnay
aff685b8c9
Drop unneeded quoting from env variable in workflows yaml 2022-04-28 19:37:41 -07:00
David Tolnay
6995bbf784
Update workflows to actions/checkout@v3 2022-04-24 19:06:54 -07:00
David Tolnay
829175e606
Fix dev dependencies on serde's derive feature 2022-03-30 11:33:22 -07:00
David Tolnay
2733e635b3
Rewrap readme to 80 columns 2022-02-28 14:37:37 -08:00
David Tolnay
c5475a32db
Apply readme changes from PR 864 to crate-level rustdoc 2022-02-28 14:36:06 -08:00