serde/test_suite/tests/test_borrow.rs

191 lines
4.3 KiB
Rust
Raw Normal View History

Ignore derive_partial_eq_without_eq clippy lint error: you are deriving `PartialEq` and can implement `Eq` --> serde/src/de/value.rs:51:17 | 51 | #[derive(Clone, PartialEq)] | ^^^^^^^^^ 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` --> serde_derive/src/internals/case.rs:13:23 | 13 | #[derive(Copy, Clone, PartialEq)] | ^^^^^^^^^ 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` --> test_suite/tests/unstable/mod.rs:6:21 | 6 | #[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 error: you are deriving `PartialEq` and can implement `Eq` --> test_suite/tests/test_ignored_any.rs:7:10 | 7 | #[derive(PartialEq, Debug, 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` --> test_suite/tests/test_identifier.rs:7:34 | 7 | #[derive(Deserialize, Debug, PartialEq)] | ^^^^^^^^^ 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` --> test_suite/tests/test_identifier.rs:24:34 | 24 | #[derive(Deserialize, Debug, PartialEq)] | ^^^^^^^^^ 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` --> test_suite/tests/test_identifier.rs:41:34 | 41 | #[derive(Deserialize, Debug, PartialEq)] | ^^^^^^^^^ 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` --> test_suite/tests/test_identifier.rs:59:34 | 59 | #[derive(Deserialize, Debug, PartialEq)] | ^^^^^^^^^ 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` --> test_suite/tests/test_ser.rs:46:10 | 46 | #[derive(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` --> test_suite/tests/test_value.rs:11:34 | 11 | #[derive(Deserialize, Debug, PartialEq)] | ^^^^^^^^^ 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` --> test_suite/tests/test_de_error.rs:15:23 | 15 | #[derive(Copy, Clone, PartialEq, Debug, 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` --> test_suite/tests/test_de_error.rs:18:10 | 18 | #[derive(PartialEq, Debug, 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` --> test_suite/tests/test_de_error.rs:26:10 | 26 | #[derive(PartialEq, Debug, 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` --> test_suite/tests/test_de_error.rs:34:10 | 34 | #[derive(PartialEq, Debug, 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` --> test_suite/tests/test_de_error.rs:41:19 | 41 | #[derive(Default, 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` --> test_suite/tests/test_de_error.rs:60:10 | 60 | #[derive(PartialEq, Debug, 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` --> test_suite/tests/test_borrow.rs:70:34 | 70 | #[derive(Deserialize, Debug, PartialEq)] | ^^^^^^^^^ 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` --> test_suite/tests/test_borrow.rs:97:34 | 97 | #[derive(Deserialize, Debug, PartialEq)] | ^^^^^^^^^ 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` --> test_suite/tests/test_borrow.rs:106:34 | 106 | #[derive(Deserialize, Debug, PartialEq)] | ^^^^^^^^^ 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` --> test_suite/tests/test_de.rs:43:23 | 43 | #[derive(Copy, Clone, PartialEq, Debug, 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` --> test_suite/tests/test_de.rs:46:10 | 46 | #[derive(PartialEq, Debug, 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` --> test_suite/tests/test_de.rs:49:10 | 49 | #[derive(PartialEq, Debug, 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` --> test_suite/tests/test_de.rs:52:10 | 52 | #[derive(PartialEq, Debug, 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` --> test_suite/tests/test_de.rs:76:10 | 76 | #[derive(PartialEq, Debug, 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` --> test_suite/tests/test_de.rs:82:10 | 82 | #[derive(PartialEq, Debug, 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` --> test_suite/tests/test_de.rs:102:10 | 102 | #[derive(PartialEq, Debug, 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` --> test_suite/tests/test_de.rs:109:19 | 109 | #[derive(Default, 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` --> test_suite/tests/test_de.rs:128:10 | 128 | #[derive(PartialEq, Debug, 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` --> test_suite/tests/test_de.rs:135:10 | 135 | #[derive(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` --> test_suite/tests/test_de.rs:185:14 | 185 | #[derive(PartialEq, Debug, 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` --> test_suite/tests/test_macros.rs:25:17 | 25 | #[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 error: you are deriving `PartialEq` and can implement `Eq` --> test_suite/tests/test_macros.rs:110:17 | 110 | #[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 error: you are deriving `PartialEq` and can implement `Eq` --> test_suite/tests/test_macros.rs:580:21 | 580 | #[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 error: you are deriving `PartialEq` and can implement `Eq` --> test_suite/tests/test_macros.rs:607:21 | 607 | #[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 error: you are deriving `PartialEq` and can implement `Eq` --> test_suite/tests/test_macros.rs:681:21 | 681 | #[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 error: you are deriving `PartialEq` and can implement `Eq` --> test_suite/tests/test_macros.rs:684:21 | 684 | #[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 error: you are deriving `PartialEq` and can implement `Eq` --> test_suite/tests/test_macros.rs:816:21 | 816 | #[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` --> test_suite/tests/test_macros.rs:976:21 | 976 | #[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 error: you are deriving `PartialEq` and can implement `Eq` --> test_suite/tests/test_macros.rs:1027:21 | 1027 | #[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 error: you are deriving `PartialEq` and can implement `Eq` --> test_suite/tests/test_macros.rs:1273:21 | 1273 | #[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` --> test_suite/tests/test_macros.rs:1342:21 | 1342 | #[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 error: you are deriving `PartialEq` and can implement `Eq` --> test_suite/tests/test_macros.rs:1413:21 | 1413 | #[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 error: you are deriving `PartialEq` and can implement `Eq` --> test_suite/tests/test_macros.rs:1450:21 | 1450 | #[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 error: you are deriving `PartialEq` and can implement `Eq` --> test_suite/tests/test_macros.rs:1474:21 | 1474 | #[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 error: you are deriving `PartialEq` and can implement `Eq` --> test_suite/tests/test_macros.rs:1509:21 | 1509 | #[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 error: you are deriving `PartialEq` and can implement `Eq` --> test_suite/tests/test_macros.rs:1543:21 | 1543 | #[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 error: you are deriving `PartialEq` and can implement `Eq` --> test_suite/tests/test_macros.rs:1601:21 | 1601 | #[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` --> test_suite/tests/test_macros.rs:1743:45 | 1743 | #[derive(Serialize, Deserialize, Debug, PartialEq)] | ^^^^^^^^^ 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` --> test_suite/tests/test_macros.rs:1763:45 | 1763 | #[derive(Serialize, Deserialize, Debug, PartialEq)] | ^^^^^^^^^ 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` --> test_suite/tests/test_macros.rs:1770:45 | 1770 | #[derive(Serialize, Deserialize, Debug, PartialEq)] | ^^^^^^^^^ 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` --> test_suite/tests/test_macros.rs:1870:21 | 1870 | #[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 error: you are deriving `PartialEq` and can implement `Eq` --> test_suite/tests/test_macros.rs:1888:21 | 1888 | #[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 error: you are deriving `PartialEq` and can implement `Eq` --> test_suite/tests/test_annotations.rs:108:17 | 108 | #[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 error: you are deriving `PartialEq` and can implement `Eq` --> test_suite/tests/test_annotations.rs:124:17 | 124 | #[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 error: you are deriving `PartialEq` and can implement `Eq` --> test_suite/tests/test_annotations.rs:147:17 | 147 | #[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 error: you are deriving `PartialEq` and can implement `Eq` --> test_suite/tests/test_annotations.rs:344:17 | 344 | #[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` --> test_suite/tests/test_annotations.rs:394:17 | 394 | #[derive(Debug, PartialEq)] | ^^^^^^^^^ 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` --> test_suite/tests/test_annotations.rs:413:17 | 413 | #[derive(Debug, PartialEq)] | ^^^^^^^^^ 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` --> test_suite/tests/test_annotations.rs:458:17 | 458 | #[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 error: you are deriving `PartialEq` and can implement `Eq` --> test_suite/tests/test_annotations.rs:512:17 | 512 | #[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 error: you are deriving `PartialEq` and can implement `Eq` --> test_suite/tests/test_annotations.rs:520:17 | 520 | #[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 error: you are deriving `PartialEq` and can implement `Eq` --> test_suite/tests/test_annotations.rs:528:17 | 528 | #[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` --> test_suite/tests/test_annotations.rs:647:17 | 647 | #[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 error: you are deriving `PartialEq` and can implement `Eq` --> test_suite/tests/test_gen.rs:835:17 | 835 | #[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` --> test_suite/tests/test_annotations.rs:675:17 | 675 | #[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` --> test_suite/tests/test_annotations.rs:1047:17 | 1047 | #[derive(Debug, PartialEq)] | ^^^^^^^^^ 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` --> test_suite/tests/test_annotations.rs:1050:17 | 1050 | #[derive(Debug, PartialEq)] | ^^^^^^^^^ 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` --> test_suite/tests/test_annotations.rs:1196:17 | 1196 | #[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 error: you are deriving `PartialEq` and can implement `Eq` --> test_suite/tests/test_annotations.rs:1514:17 | 1514 | #[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` --> test_suite/tests/test_annotations.rs:1548:41 | 1548 | #[derive(Clone, Serialize, Deserialize, 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` --> test_suite/tests/test_annotations.rs:1566:41 | 1566 | #[derive(Clone, Serialize, Deserialize, 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` --> test_suite/tests/test_annotations.rs:1600:30 | 1600 | #[derive(Clone, Deserialize, 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` --> test_suite/tests/test_annotations.rs:1803:21 | 1803 | #[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 error: you are deriving `PartialEq` and can implement `Eq` --> test_suite/tests/test_annotations.rs:1843:21 | 1843 | #[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 error: you are deriving `PartialEq` and can implement `Eq` --> test_suite/tests/test_annotations.rs:1852:21 | 1852 | #[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 error: you are deriving `PartialEq` and can implement `Eq` --> test_suite/tests/test_annotations.rs:1947:21 | 1947 | #[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` --> test_suite/tests/test_annotations.rs:2003:21 | 2003 | #[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 error: you are deriving `PartialEq` and can implement `Eq` --> test_suite/tests/test_annotations.rs:2037:21 | 2037 | #[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 error: you are deriving `PartialEq` and can implement `Eq` --> test_suite/tests/test_annotations.rs:2074:45 | 2074 | #[derive(Deserialize, Serialize, Debug, PartialEq)] | ^^^^^^^^^ 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` --> test_suite/tests/test_annotations.rs:2080:45 | 2080 | #[derive(Deserialize, Serialize, Debug, PartialEq)] | ^^^^^^^^^ 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` --> test_suite/tests/test_annotations.rs:2157:38 | 2157 | #[derive(Serialize, Deserialize, 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` --> test_suite/tests/test_annotations.rs:2193:38 | 2193 | #[derive(Serialize, Deserialize, 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` --> test_suite/tests/test_annotations.rs:2200:38 | 2200 | #[derive(Serialize, Deserialize, 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` --> test_suite/tests/test_annotations.rs:2240:38 | 2240 | #[derive(Serialize, Deserialize, 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` --> test_suite/tests/test_annotations.rs:2279:38 | 2279 | #[derive(Serialize, Deserialize, 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` --> test_suite/tests/test_annotations.rs:2316:38 | 2316 | #[derive(Serialize, Deserialize, 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` --> test_suite/tests/test_annotations.rs:2359:38 | 2359 | #[derive(Serialize, Deserialize, 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` --> test_suite/tests/test_annotations.rs:2390:38 | 2390 | #[derive(Serialize, Deserialize, 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` --> test_suite/tests/test_annotations.rs:2421:38 | 2421 | #[derive(Serialize, Deserialize, 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` --> test_suite/tests/test_annotations.rs:2426:38 | 2426 | #[derive(Serialize, Deserialize, 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` --> test_suite/tests/test_annotations.rs:2483:38 | 2483 | #[derive(Serialize, Deserialize, 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` --> test_suite/tests/test_annotations.rs:2507:38 | 2507 | #[derive(Serialize, Deserialize, 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` --> test_suite/tests/test_annotations.rs:2521:27 | 2521 | #[derive(Deserialize, 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` --> test_suite/tests/test_annotations.rs:2552:27 | 2552 | #[derive(Deserialize, 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` --> test_suite/tests/test_annotations.rs:2558:27 | 2558 | #[derive(Deserialize, 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` --> test_suite/tests/test_annotations.rs:2586:14 | 2586 | #[derive(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` --> test_suite/tests/test_annotations.rs:2624:27 | 2624 | #[derive(Deserialize, 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` --> test_suite/tests/test_annotations.rs:2647:27 | 2647 | #[derive(Deserialize, 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
2022-05-21 22:36:25 -05:00
#![allow(
clippy::derive_partial_eq_without_eq,
clippy::items_after_statements,
clippy::used_underscore_binding
)]
2017-04-04 12:47:21 -05:00
use serde::{Deserialize, Deserializer};
2017-12-23 22:13:08 -06:00
use serde_test::{assert_de_tokens, assert_de_tokens_error, Token};
2017-04-04 12:47:21 -05:00
use std::borrow::Cow;
#[test]
fn test_borrowed_str() {
2017-04-13 14:28:23 -05:00
assert_de_tokens(&"borrowed", &[Token::BorrowedStr("borrowed")]);
2017-04-04 12:47:21 -05:00
}
#[test]
fn test_borrowed_str_from_string() {
assert_de_tokens_error::<&str>(
2017-04-13 14:28:23 -05:00
&[Token::String("borrowed")],
"invalid type: string \"borrowed\", expected a borrowed string",
2017-04-04 12:47:21 -05:00
);
}
#[test]
fn test_borrowed_str_from_str() {
assert_de_tokens_error::<&str>(
2017-04-13 14:28:23 -05:00
&[Token::Str("borrowed")],
"invalid type: string \"borrowed\", expected a borrowed string",
2017-04-04 12:47:21 -05:00
);
}
#[test]
fn test_string_from_borrowed_str() {
2017-04-13 14:28:23 -05:00
assert_de_tokens(&"owned".to_owned(), &[Token::BorrowedStr("owned")]);
2017-04-04 12:47:21 -05:00
}
#[test]
fn test_borrowed_bytes() {
2017-04-13 14:28:23 -05:00
assert_de_tokens(&&b"borrowed"[..], &[Token::BorrowedBytes(b"borrowed")]);
2017-04-04 12:47:21 -05:00
}
#[test]
fn test_borrowed_bytes_from_bytebuf() {
assert_de_tokens_error::<&[u8]>(
2017-04-13 14:28:23 -05:00
&[Token::ByteBuf(b"borrowed")],
"invalid type: byte array, expected a borrowed byte array",
2017-04-04 12:47:21 -05:00
);
}
#[test]
fn test_borrowed_bytes_from_bytes() {
assert_de_tokens_error::<&[u8]>(
2017-04-13 14:28:23 -05:00
&[Token::Bytes(b"borrowed")],
"invalid type: byte array, expected a borrowed byte array",
2017-04-04 12:47:21 -05:00
);
}
#[test]
fn test_tuple() {
assert_de_tokens(
&("str", &b"bytes"[..]),
&[
2017-04-19 15:06:31 -05:00
Token::Tuple { len: 2 },
2017-04-04 12:47:21 -05:00
Token::BorrowedStr("str"),
Token::BorrowedBytes(b"bytes"),
Token::TupleEnd,
2017-04-13 14:28:23 -05:00
],
2017-04-04 12:47:21 -05:00
);
}
#[test]
fn test_struct() {
#[derive(Deserialize, Debug, PartialEq)]
struct Borrowing<'a, 'b> {
bs: &'a str,
bb: &'b [u8],
}
assert_de_tokens(
2017-04-13 14:28:23 -05:00
&Borrowing {
2017-12-23 22:13:08 -06:00
bs: "str",
bb: b"bytes",
},
2017-04-04 12:47:21 -05:00
&[
2017-12-23 22:13:08 -06:00
Token::Struct {
name: "Borrowing",
len: 2,
},
2017-04-04 12:47:21 -05:00
Token::BorrowedStr("bs"),
Token::BorrowedStr("str"),
Token::BorrowedStr("bb"),
Token::BorrowedBytes(b"bytes"),
Token::StructEnd,
2017-04-13 14:28:23 -05:00
],
2017-04-04 12:47:21 -05:00
);
}
2020-10-23 06:12:06 -05:00
#[test]
fn test_field_identifier() {
#[derive(Deserialize, Debug, PartialEq)]
#[serde(field_identifier)]
enum FieldStr<'a> {
#[serde(borrow)]
Str(&'a str),
}
2021-01-23 14:29:20 -06:00
assert_de_tokens(&FieldStr::Str("value"), &[Token::BorrowedStr("value")]);
2020-10-23 06:12:06 -05:00
#[derive(Deserialize, Debug, PartialEq)]
#[serde(field_identifier)]
enum FieldBytes<'a> {
#[serde(borrow)]
Bytes(&'a [u8]),
}
assert_de_tokens(
&FieldBytes::Bytes(b"value"),
2021-01-23 14:29:20 -06:00
&[Token::BorrowedBytes(b"value")],
2020-10-23 06:12:06 -05:00
);
}
2017-04-04 12:47:21 -05:00
#[test]
fn test_cow() {
#[derive(Deserialize)]
struct Cows<'a, 'b> {
copied: Cow<'a, str>,
#[serde(borrow)]
borrowed: Cow<'b, str>,
2017-04-04 12:47:21 -05:00
}
let tokens = &[
2017-12-23 22:13:08 -06:00
Token::Struct {
name: "Cows",
len: 2,
},
2017-04-04 12:47:21 -05:00
Token::Str("copied"),
Token::BorrowedStr("copied"),
Token::Str("borrowed"),
Token::BorrowedStr("borrowed"),
Token::StructEnd,
];
let mut de = serde_test::Deserializer::new(tokens);
2017-04-04 12:47:21 -05:00
let cows = Cows::deserialize(&mut de).unwrap();
match cows.copied {
Cow::Owned(ref s) if s == "copied" => {}
_ => panic!("expected a copied string"),
}
match cows.borrowed {
Cow::Borrowed("borrowed") => {}
_ => panic!("expected a borrowed string"),
}
}
#[test]
fn test_lifetimes() {
#[derive(Deserialize)]
struct Cows<'a, 'b> {
_copied: Cow<'a, str>,
#[serde(borrow)]
_borrowed: Cow<'b, str>,
2017-04-04 12:47:21 -05:00
}
// Tests that `'de: 'a` is not required by the Deserialize impl.
fn _cows_lifetimes<'de: 'b, 'a, 'b, D>(deserializer: D) -> Cows<'a, 'b>
2017-04-13 14:28:23 -05:00
where
D: Deserializer<'de>,
2017-04-04 12:47:21 -05:00
{
Deserialize::deserialize(deserializer).unwrap()
}
#[derive(Deserialize)]
struct Wrap<'a, 'b> {
#[serde(borrow = "'b")]
_cows: Cows<'a, 'b>,
2017-04-04 12:47:21 -05:00
}
// Tests that `'de: 'a` is not required by the Deserialize impl.
fn _wrap_lifetimes<'de: 'b, 'a, 'b, D>(deserializer: D) -> Wrap<'a, 'b>
2017-04-13 14:28:23 -05:00
where
D: Deserializer<'de>,
2017-04-04 12:47:21 -05:00
{
Deserialize::deserialize(deserializer).unwrap()
}
}