15 Commits

Author SHA1 Message Date
David Tolnay
4a0be88b5a
Format regression tests with rustfmt 2024-03-23 20:24:22 -07:00
David Tolnay
d2dbbf7055
Ignore dead code lint in tests
New in nightly-2024-03-24 from https://github.com/rust-lang/rust/pull/119552.

    warning: field `x` is never read
      --> tests/regression/issue795.rs:11:15
       |
    11 |     Variant { x: u8 },
       |     -------   ^
       |     |
       |     field in this variant
       |
       = note: `#[warn(dead_code)]` on by default

    warning: field `i` is never read
      --> tests/regression/issue845.rs:63:9
       |
    61 | pub struct Struct {
       |            ------ field in this struct
    62 |     #[serde(deserialize_with = "deserialize_integer_or_string")]
    63 |     pub i: i64,
       |         ^
       |
       = note: `Struct` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis
2024-03-23 20:19:20 -07:00
David Tolnay
5def3367b6
Update to 2021 edition 2023-07-06 14:45:48 -07:00
David Tolnay
ce53b862b9
Fix needless_borrow clippy lint in test
error: the borrowed expression implements the required traits
     --> tests/regression/issue1004.rs:6:38
      |
    6 |     let value = serde_json::to_value(&float).unwrap();
      |                                      ^^^^^^ help: change this to: `float`
      |
      = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
      = note: `-D clippy::needless-borrow` implied by `-D clippy::all`
2023-03-27 10:11:48 -07:00
David Tolnay
06f3443c6e
Eliminate f32-to-f64 casting in arbitrary_precision mode 2023-03-27 09:39:41 -07:00
David Tolnay
b0990a51db
Add regression test for issue 1004 2023-03-27 09:38:35 -07:00
David Tolnay
c27b02334b
Add regression test for issue 953 2022-11-21 19:15:11 -08: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
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
0ca5a69d73
Add regression test for issue 845 2022-01-15 16:40:22 -08:00
David Tolnay
f4fc150c45
Fix dead code warning in issue 795 regression test
warning: field is never read: `x`
     --> tests/regression/issue795.rs:9:15
      |
    9 |     Variant { x: u8 },
      |               ^^^^^
      |
      = note: `#[warn(dead_code)]` on by default
2021-09-14 12:49:18 -07:00
David Tolnay
12207ed2a3
Add regression test for issue 795 2021-08-28 11:21:40 -07:00
David Tolnay
509d52e70a
Simplify how regression tests are imported 2020-09-05 12:33:03 -07:00
David Tolnay
e943bec750
Deal with clippy lints in tests
$ cargo clippy --tests
2020-06-06 00:01:53 -07:00
David Tolnay
d79c8e5f1e
Fix adjacently tagged f32 roundtrip regression 2019-02-28 00:57:55 -08:00