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::unreadable_literal)]
|
2019-12-15 21:52:59 -06:00
|
|
|
#![cfg_attr(feature = "unstable", feature(never_type))]
|
2018-06-03 02:15:05 -05:00
|
|
|
|
2018-06-01 02:08:16 -05:00
|
|
|
use std::cell::RefCell;
|
2017-07-09 12:16:49 -05:00
|
|
|
use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet};
|
2018-04-30 03:41:22 -05:00
|
|
|
use std::ffi::CString;
|
2016-02-21 19:02:25 -06:00
|
|
|
use std::net;
|
2018-04-30 03:41:22 -05:00
|
|
|
use std::num::Wrapping;
|
2019-02-01 23:02:57 -06:00
|
|
|
use std::ops::Bound;
|
2016-01-28 11:45:38 -06:00
|
|
|
use std::path::{Path, PathBuf};
|
2018-05-07 13:16:34 -05:00
|
|
|
use std::rc::{Rc, Weak as RcWeak};
|
2019-07-16 12:00:44 -05:00
|
|
|
use std::sync::atomic::{
|
|
|
|
AtomicBool, AtomicI16, AtomicI32, AtomicI8, AtomicIsize, AtomicU16, AtomicU32, AtomicU8,
|
|
|
|
AtomicUsize,
|
|
|
|
};
|
2022-09-22 01:57:55 -05:00
|
|
|
use std::sync::{Arc, Mutex, RwLock, Weak as ArcWeak};
|
2018-04-30 03:41:22 -05:00
|
|
|
use std::time::{Duration, UNIX_EPOCH};
|
2015-03-03 22:33:17 -06:00
|
|
|
|
2017-04-09 16:11:27 -05:00
|
|
|
#[cfg(unix)]
|
|
|
|
use std::str;
|
2019-07-17 11:11:35 -05:00
|
|
|
#[cfg(target_arch = "x86_64")]
|
2019-07-16 12:00:44 -05:00
|
|
|
use std::sync::atomic::{AtomicI64, AtomicU64};
|
2017-04-09 16:11:27 -05:00
|
|
|
|
2018-12-31 20:44:24 -06:00
|
|
|
use fnv::FnvHasher;
|
|
|
|
use serde::Serialize;
|
|
|
|
use serde_test::{assert_ser_tokens, assert_ser_tokens_error, Configure, Token};
|
2016-06-11 02:43:02 -05:00
|
|
|
|
2017-02-24 17:32:13 -06:00
|
|
|
#[macro_use]
|
|
|
|
mod macros;
|
|
|
|
|
2015-03-03 23:42:33 -06:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2015-03-19 09:49:42 -05:00
|
|
|
#[derive(Serialize)]
|
2015-07-04 14:11:20 -05:00
|
|
|
struct UnitStruct;
|
2015-03-03 22:33:17 -06:00
|
|
|
|
2015-03-19 09:49:42 -05:00
|
|
|
#[derive(Serialize)]
|
2015-07-04 14:11:20 -05:00
|
|
|
struct TupleStruct(i32, i32, i32);
|
2015-03-03 22:33:17 -06:00
|
|
|
|
2015-03-19 09:49:42 -05:00
|
|
|
#[derive(Serialize)]
|
2015-07-04 14:11:20 -05:00
|
|
|
struct Struct {
|
2015-03-03 23:42:33 -06:00
|
|
|
a: i32,
|
|
|
|
b: i32,
|
|
|
|
c: i32,
|
|
|
|
}
|
|
|
|
|
2019-09-07 03:43:28 -05:00
|
|
|
#[derive(PartialEq, Debug)]
|
|
|
|
struct NotSerializable;
|
|
|
|
|
2016-12-24 00:37:23 -06:00
|
|
|
#[derive(Serialize, PartialEq, Debug)]
|
2015-03-03 22:33:17 -06:00
|
|
|
enum Enum {
|
|
|
|
Unit,
|
2015-07-17 08:19:11 -05:00
|
|
|
One(i32),
|
2015-03-03 22:33:17 -06:00
|
|
|
Seq(i32, i32),
|
2017-12-23 22:24:57 -06:00
|
|
|
Map {
|
|
|
|
a: i32,
|
|
|
|
b: i32,
|
|
|
|
},
|
|
|
|
#[serde(skip_serializing)]
|
|
|
|
SkippedUnit,
|
|
|
|
#[serde(skip_serializing)]
|
|
|
|
SkippedOne(i32),
|
|
|
|
#[serde(skip_serializing)]
|
|
|
|
SkippedSeq(i32, i32),
|
|
|
|
#[serde(skip_serializing)]
|
|
|
|
SkippedMap {
|
|
|
|
_a: i32,
|
|
|
|
_b: i32,
|
|
|
|
},
|
2019-09-07 03:43:28 -05:00
|
|
|
OneWithSkipped(#[serde(skip_serializing)] NotSerializable),
|
2015-03-03 22:33:17 -06:00
|
|
|
}
|
|
|
|
|
2015-03-03 23:42:33 -06:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2022-01-20 22:07:00 -06:00
|
|
|
#[test]
|
|
|
|
fn test_unit() {
|
|
|
|
assert_ser_tokens(&(), &[Token::Unit]);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_bool() {
|
|
|
|
assert_ser_tokens(&true, &[Token::Bool(true)]);
|
|
|
|
assert_ser_tokens(&false, &[Token::Bool(false)]);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_isizes() {
|
|
|
|
assert_ser_tokens(&0i8, &[Token::I8(0)]);
|
|
|
|
assert_ser_tokens(&0i16, &[Token::I16(0)]);
|
|
|
|
assert_ser_tokens(&0i32, &[Token::I32(0)]);
|
|
|
|
assert_ser_tokens(&0i64, &[Token::I64(0)]);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_usizes() {
|
|
|
|
assert_ser_tokens(&0u8, &[Token::U8(0)]);
|
|
|
|
assert_ser_tokens(&0u16, &[Token::U16(0)]);
|
|
|
|
assert_ser_tokens(&0u32, &[Token::U32(0)]);
|
|
|
|
assert_ser_tokens(&0u64, &[Token::U64(0)]);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_floats() {
|
|
|
|
assert_ser_tokens(&0f32, &[Token::F32(0.)]);
|
|
|
|
assert_ser_tokens(&0f64, &[Token::F64(0.)]);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_char() {
|
|
|
|
assert_ser_tokens(&'a', &[Token::Char('a')]);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_str() {
|
|
|
|
assert_ser_tokens(&"abc", &[Token::Str("abc")]);
|
|
|
|
assert_ser_tokens(&"abc".to_owned(), &[Token::Str("abc")]);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_option() {
|
|
|
|
assert_ser_tokens(&None::<i32>, &[Token::None]);
|
|
|
|
assert_ser_tokens(&Some(1), &[Token::Some, Token::I32(1)]);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_result() {
|
|
|
|
assert_ser_tokens(
|
|
|
|
&Ok::<i32, i32>(0),
|
|
|
|
&[
|
|
|
|
Token::NewtypeVariant {
|
|
|
|
name: "Result",
|
|
|
|
variant: "Ok",
|
|
|
|
},
|
2015-07-19 13:16:46 -05:00
|
|
|
Token::I32(0),
|
|
|
|
],
|
2022-01-20 22:07:00 -06:00
|
|
|
);
|
|
|
|
assert_ser_tokens(
|
|
|
|
&Err::<i32, i32>(1),
|
|
|
|
&[
|
|
|
|
Token::NewtypeVariant {
|
|
|
|
name: "Result",
|
|
|
|
variant: "Err",
|
|
|
|
},
|
2015-07-19 13:16:46 -05:00
|
|
|
Token::I32(1),
|
|
|
|
],
|
2022-01-20 22:07:00 -06:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_slice() {
|
|
|
|
assert_ser_tokens(&[0][..0], &[Token::Seq { len: Some(0) }, Token::SeqEnd]);
|
|
|
|
assert_ser_tokens(
|
|
|
|
&[1, 2, 3][..],
|
|
|
|
&[
|
2017-04-19 15:06:31 -05:00
|
|
|
Token::Seq { len: Some(3) },
|
2022-01-20 22:07:00 -06:00
|
|
|
Token::I32(1),
|
|
|
|
Token::I32(2),
|
|
|
|
Token::I32(3),
|
2015-05-16 04:51:35 -05:00
|
|
|
Token::SeqEnd,
|
|
|
|
],
|
2022-01-20 22:07:00 -06:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_array() {
|
|
|
|
assert_ser_tokens(&[0; 0], &[Token::Tuple { len: 0 }, Token::TupleEnd]);
|
|
|
|
assert_ser_tokens(
|
|
|
|
&[1, 2, 3],
|
|
|
|
&[
|
2017-04-19 15:06:31 -05:00
|
|
|
Token::Tuple { len: 3 },
|
2022-01-20 22:07:00 -06:00
|
|
|
Token::I32(1),
|
|
|
|
Token::I32(2),
|
|
|
|
Token::I32(3),
|
2017-04-17 14:07:49 -05:00
|
|
|
Token::TupleEnd,
|
2015-03-03 22:33:17 -06:00
|
|
|
],
|
2022-01-20 22:07:00 -06:00
|
|
|
);
|
|
|
|
}
|
2015-03-03 22:33:17 -06:00
|
|
|
|
2022-01-20 22:07:00 -06:00
|
|
|
#[test]
|
|
|
|
fn test_vec() {
|
|
|
|
assert_ser_tokens(
|
|
|
|
&Vec::<isize>::new(),
|
|
|
|
&[Token::Seq { len: Some(0) }, Token::SeqEnd],
|
|
|
|
);
|
|
|
|
assert_ser_tokens(
|
|
|
|
&vec![vec![], vec![1], vec![2, 3]],
|
|
|
|
&[
|
|
|
|
Token::Seq { len: Some(3) },
|
2017-07-09 12:16:49 -05:00
|
|
|
Token::Seq { len: Some(0) },
|
|
|
|
Token::SeqEnd,
|
|
|
|
Token::Seq { len: Some(1) },
|
2022-01-20 22:07:00 -06:00
|
|
|
Token::I32(1),
|
2016-06-11 11:59:29 -05:00
|
|
|
Token::SeqEnd,
|
2022-01-20 22:07:00 -06:00
|
|
|
Token::Seq { len: Some(2) },
|
|
|
|
Token::I32(2),
|
|
|
|
Token::I32(3),
|
2016-06-11 11:59:29 -05:00
|
|
|
Token::SeqEnd,
|
|
|
|
Token::SeqEnd,
|
|
|
|
],
|
2022-01-20 22:07:00 -06:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_btreeset() {
|
|
|
|
assert_ser_tokens(
|
|
|
|
&BTreeSet::<isize>::new(),
|
|
|
|
&[Token::Seq { len: Some(0) }, Token::SeqEnd],
|
|
|
|
);
|
|
|
|
assert_ser_tokens(
|
|
|
|
&btreeset![1],
|
|
|
|
&[Token::Seq { len: Some(1) }, Token::I32(1), Token::SeqEnd],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_hashset() {
|
|
|
|
assert_ser_tokens(
|
|
|
|
&HashSet::<isize>::new(),
|
|
|
|
&[Token::Seq { len: Some(0) }, Token::SeqEnd],
|
|
|
|
);
|
|
|
|
assert_ser_tokens(
|
|
|
|
&hashset![1],
|
|
|
|
&[Token::Seq { len: Some(1) }, Token::I32(1), Token::SeqEnd],
|
|
|
|
);
|
|
|
|
assert_ser_tokens(
|
|
|
|
&hashset![FnvHasher @ 1],
|
|
|
|
&[Token::Seq { len: Some(1) }, Token::I32(1), Token::SeqEnd],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_tuple() {
|
|
|
|
assert_ser_tokens(
|
|
|
|
&(1,),
|
|
|
|
&[Token::Tuple { len: 1 }, Token::I32(1), Token::TupleEnd],
|
|
|
|
);
|
|
|
|
assert_ser_tokens(
|
|
|
|
&(1, 2, 3),
|
|
|
|
&[
|
2017-04-19 15:06:31 -05:00
|
|
|
Token::Tuple { len: 3 },
|
2022-01-20 22:07:00 -06:00
|
|
|
Token::I32(1),
|
|
|
|
Token::I32(2),
|
|
|
|
Token::I32(3),
|
2016-02-23 07:15:44 -06:00
|
|
|
Token::TupleEnd,
|
2015-03-03 22:33:17 -06:00
|
|
|
],
|
2022-01-20 22:07:00 -06:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_btreemap() {
|
|
|
|
assert_ser_tokens(
|
|
|
|
&btreemap![1 => 2],
|
|
|
|
&[
|
2017-04-19 15:06:31 -05:00
|
|
|
Token::Map { len: Some(1) },
|
2022-01-20 22:07:00 -06:00
|
|
|
Token::I32(1),
|
|
|
|
Token::I32(2),
|
2015-03-03 22:33:17 -06:00
|
|
|
Token::MapEnd,
|
|
|
|
],
|
2022-01-20 22:07:00 -06:00
|
|
|
);
|
|
|
|
assert_ser_tokens(
|
|
|
|
&btreemap![1 => 2, 3 => 4],
|
|
|
|
&[
|
2017-04-19 15:06:31 -05:00
|
|
|
Token::Map { len: Some(2) },
|
2022-01-20 22:07:00 -06:00
|
|
|
Token::I32(1),
|
|
|
|
Token::I32(2),
|
|
|
|
Token::I32(3),
|
|
|
|
Token::I32(4),
|
2015-03-03 22:33:17 -06:00
|
|
|
Token::MapEnd,
|
|
|
|
],
|
2022-01-20 22:07:00 -06:00
|
|
|
);
|
|
|
|
assert_ser_tokens(
|
|
|
|
&btreemap![1 => btreemap![], 2 => btreemap![3 => 4, 5 => 6]],
|
|
|
|
&[
|
2017-04-19 15:06:31 -05:00
|
|
|
Token::Map { len: Some(2) },
|
2022-01-20 22:07:00 -06:00
|
|
|
Token::I32(1),
|
2017-04-19 15:06:31 -05:00
|
|
|
Token::Map { len: Some(0) },
|
2016-06-11 11:42:02 -05:00
|
|
|
Token::MapEnd,
|
2022-01-20 22:07:00 -06:00
|
|
|
Token::I32(2),
|
|
|
|
Token::Map { len: Some(2) },
|
|
|
|
Token::I32(3),
|
|
|
|
Token::I32(4),
|
|
|
|
Token::I32(5),
|
|
|
|
Token::I32(6),
|
|
|
|
Token::MapEnd,
|
|
|
|
Token::MapEnd,
|
2016-06-11 11:42:02 -05:00
|
|
|
],
|
2022-01-20 22:07:00 -06:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_hashmap() {
|
|
|
|
assert_ser_tokens(
|
|
|
|
&HashMap::<isize, isize>::new(),
|
|
|
|
&[Token::Map { len: Some(0) }, Token::MapEnd],
|
|
|
|
);
|
|
|
|
assert_ser_tokens(
|
|
|
|
&hashmap![1 => 2],
|
|
|
|
&[
|
2017-04-19 15:06:31 -05:00
|
|
|
Token::Map { len: Some(1) },
|
2022-01-20 22:07:00 -06:00
|
|
|
Token::I32(1),
|
|
|
|
Token::I32(2),
|
2016-06-11 11:42:02 -05:00
|
|
|
Token::MapEnd,
|
|
|
|
],
|
2022-01-20 22:07:00 -06:00
|
|
|
);
|
|
|
|
assert_ser_tokens(
|
|
|
|
&hashmap![FnvHasher @ 1 => 2],
|
|
|
|
&[
|
2017-04-19 15:06:31 -05:00
|
|
|
Token::Map { len: Some(1) },
|
2022-01-20 22:07:00 -06:00
|
|
|
Token::I32(1),
|
|
|
|
Token::I32(2),
|
2016-06-11 02:43:02 -05:00
|
|
|
Token::MapEnd,
|
|
|
|
],
|
2022-01-20 22:07:00 -06:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_unit_struct() {
|
|
|
|
assert_ser_tokens(&UnitStruct, &[Token::UnitStruct { name: "UnitStruct" }]);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_tuple_struct() {
|
|
|
|
assert_ser_tokens(
|
|
|
|
&TupleStruct(1, 2, 3),
|
|
|
|
&[
|
|
|
|
Token::TupleStruct {
|
|
|
|
name: "TupleStruct",
|
|
|
|
len: 3,
|
|
|
|
},
|
|
|
|
Token::I32(1),
|
|
|
|
Token::I32(2),
|
|
|
|
Token::I32(3),
|
2016-02-23 07:15:44 -06:00
|
|
|
Token::TupleStructEnd,
|
2015-03-03 22:33:17 -06:00
|
|
|
],
|
2022-01-20 22:07:00 -06:00
|
|
|
);
|
|
|
|
}
|
2015-03-03 23:42:33 -06:00
|
|
|
|
2022-01-20 22:07:00 -06:00
|
|
|
#[test]
|
|
|
|
fn test_struct() {
|
|
|
|
assert_ser_tokens(
|
|
|
|
&Struct { a: 1, b: 2, c: 3 },
|
|
|
|
&[
|
|
|
|
Token::Struct {
|
|
|
|
name: "Struct",
|
|
|
|
len: 3,
|
|
|
|
},
|
|
|
|
Token::Str("a"),
|
|
|
|
Token::I32(1),
|
|
|
|
Token::Str("b"),
|
|
|
|
Token::I32(2),
|
|
|
|
Token::Str("c"),
|
|
|
|
Token::I32(3),
|
2016-02-13 00:05:02 -06:00
|
|
|
Token::StructEnd,
|
2015-03-03 23:42:33 -06:00
|
|
|
],
|
2022-01-20 22:07:00 -06:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_enum() {
|
|
|
|
assert_ser_tokens(
|
|
|
|
&Enum::Unit,
|
|
|
|
&[Token::UnitVariant {
|
|
|
|
name: "Enum",
|
|
|
|
variant: "Unit",
|
|
|
|
}],
|
|
|
|
);
|
|
|
|
assert_ser_tokens(
|
|
|
|
&Enum::One(42),
|
|
|
|
&[
|
|
|
|
Token::NewtypeVariant {
|
|
|
|
name: "Enum",
|
|
|
|
variant: "One",
|
|
|
|
},
|
2019-09-07 22:35:07 -05:00
|
|
|
Token::I32(42),
|
|
|
|
],
|
2022-01-20 22:07:00 -06:00
|
|
|
);
|
|
|
|
assert_ser_tokens(
|
|
|
|
&Enum::Seq(1, 2),
|
|
|
|
&[
|
|
|
|
Token::TupleVariant {
|
|
|
|
name: "Enum",
|
|
|
|
variant: "Seq",
|
|
|
|
len: 2,
|
|
|
|
},
|
|
|
|
Token::I32(1),
|
|
|
|
Token::I32(2),
|
2017-04-05 12:40:14 -05:00
|
|
|
Token::TupleVariantEnd,
|
2015-03-03 22:33:17 -06:00
|
|
|
],
|
2022-01-20 22:07:00 -06:00
|
|
|
);
|
|
|
|
assert_ser_tokens(
|
|
|
|
&Enum::Map { a: 1, b: 2 },
|
|
|
|
&[
|
|
|
|
Token::StructVariant {
|
|
|
|
name: "Enum",
|
|
|
|
variant: "Map",
|
|
|
|
len: 2,
|
|
|
|
},
|
|
|
|
Token::Str("a"),
|
|
|
|
Token::I32(1),
|
|
|
|
Token::Str("b"),
|
|
|
|
Token::I32(2),
|
2017-04-05 12:40:14 -05:00
|
|
|
Token::StructVariantEnd,
|
2015-03-03 22:33:17 -06:00
|
|
|
],
|
2022-01-20 22:07:00 -06:00
|
|
|
);
|
|
|
|
assert_ser_tokens(
|
|
|
|
&Enum::OneWithSkipped(NotSerializable),
|
|
|
|
&[Token::UnitVariant {
|
|
|
|
name: "Enum",
|
|
|
|
variant: "OneWithSkipped",
|
|
|
|
}],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_box() {
|
|
|
|
assert_ser_tokens(&Box::new(0i32), &[Token::I32(0)]);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_boxed_slice() {
|
|
|
|
assert_ser_tokens(
|
|
|
|
&Box::new([0, 1, 2]),
|
|
|
|
&[
|
2017-04-19 15:06:31 -05:00
|
|
|
Token::Tuple { len: 3 },
|
2016-04-17 22:59:26 -05:00
|
|
|
Token::I32(0),
|
|
|
|
Token::I32(1),
|
|
|
|
Token::I32(2),
|
2017-04-17 14:07:49 -05:00
|
|
|
Token::TupleEnd,
|
2016-04-17 22:59:26 -05:00
|
|
|
],
|
2022-01-20 22:07:00 -06:00
|
|
|
);
|
|
|
|
}
|
2016-08-03 19:15:14 -05:00
|
|
|
|
2022-01-20 22:07:00 -06:00
|
|
|
#[test]
|
|
|
|
fn test_duration() {
|
|
|
|
assert_ser_tokens(
|
|
|
|
&Duration::new(1, 2),
|
|
|
|
&[
|
|
|
|
Token::Struct {
|
|
|
|
name: "Duration",
|
|
|
|
len: 2,
|
|
|
|
},
|
|
|
|
Token::Str("secs"),
|
|
|
|
Token::U64(1),
|
|
|
|
Token::Str("nanos"),
|
|
|
|
Token::U32(2),
|
2016-08-03 19:15:14 -05:00
|
|
|
Token::StructEnd,
|
|
|
|
],
|
2022-01-20 22:07:00 -06:00
|
|
|
);
|
|
|
|
}
|
2017-07-11 23:01:40 -05:00
|
|
|
|
2022-01-20 22:07:00 -06:00
|
|
|
#[test]
|
|
|
|
fn test_system_time() {
|
|
|
|
let system_time = UNIX_EPOCH + Duration::new(1, 200);
|
|
|
|
assert_ser_tokens(
|
|
|
|
&system_time,
|
|
|
|
&[
|
|
|
|
Token::Struct {
|
|
|
|
name: "SystemTime",
|
|
|
|
len: 2,
|
|
|
|
},
|
|
|
|
Token::Str("secs_since_epoch"),
|
|
|
|
Token::U64(1),
|
|
|
|
Token::Str("nanos_since_epoch"),
|
|
|
|
Token::U32(200),
|
2017-07-11 23:01:40 -05:00
|
|
|
Token::StructEnd,
|
|
|
|
],
|
2022-01-20 22:07:00 -06:00
|
|
|
);
|
|
|
|
}
|
2017-03-09 05:18:56 -06:00
|
|
|
|
2022-01-20 22:07:00 -06:00
|
|
|
#[test]
|
|
|
|
fn test_range() {
|
|
|
|
assert_ser_tokens(
|
|
|
|
&(1u32..2u32),
|
|
|
|
&[
|
|
|
|
Token::Struct {
|
|
|
|
name: "Range",
|
|
|
|
len: 2,
|
|
|
|
},
|
|
|
|
Token::Str("start"),
|
|
|
|
Token::U32(1),
|
|
|
|
Token::Str("end"),
|
|
|
|
Token::U32(2),
|
2017-03-09 05:18:56 -06:00
|
|
|
Token::StructEnd,
|
|
|
|
],
|
2022-01-20 22:07:00 -06:00
|
|
|
);
|
|
|
|
}
|
2018-08-05 08:45:50 -05:00
|
|
|
|
2022-01-20 22:07:00 -06:00
|
|
|
#[test]
|
|
|
|
fn test_range_inclusive() {
|
|
|
|
assert_ser_tokens(
|
|
|
|
&(1u32..=2u32),
|
|
|
|
&[
|
|
|
|
Token::Struct {
|
|
|
|
name: "RangeInclusive",
|
|
|
|
len: 2,
|
|
|
|
},
|
|
|
|
Token::Str("start"),
|
|
|
|
Token::U32(1),
|
|
|
|
Token::Str("end"),
|
|
|
|
Token::U32(2),
|
2018-08-05 08:45:50 -05:00
|
|
|
Token::StructEnd,
|
|
|
|
],
|
2022-01-20 22:07:00 -06:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_bound() {
|
|
|
|
assert_ser_tokens(
|
|
|
|
&Bound::Unbounded::<()>,
|
|
|
|
&[
|
2019-01-29 07:29:14 -06:00
|
|
|
Token::Enum { name: "Bound" },
|
|
|
|
Token::Str("Unbounded"),
|
|
|
|
Token::Unit,
|
|
|
|
],
|
2022-01-20 22:07:00 -06:00
|
|
|
);
|
|
|
|
assert_ser_tokens(
|
|
|
|
&Bound::Included(0u8),
|
|
|
|
&[
|
2019-01-29 07:29:14 -06:00
|
|
|
Token::Enum { name: "Bound" },
|
|
|
|
Token::Str("Included"),
|
|
|
|
Token::U8(0),
|
|
|
|
],
|
2022-01-20 22:07:00 -06:00
|
|
|
);
|
|
|
|
assert_ser_tokens(
|
|
|
|
&Bound::Excluded(0u8),
|
|
|
|
&[
|
2019-01-29 07:29:14 -06:00
|
|
|
Token::Enum { name: "Bound" },
|
|
|
|
Token::Str("Excluded"),
|
|
|
|
Token::U8(0),
|
|
|
|
],
|
2022-01-20 22:07:00 -06:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_path() {
|
|
|
|
assert_ser_tokens(
|
|
|
|
&Path::new("/usr/local/lib"),
|
|
|
|
&[Token::Str("/usr/local/lib")],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_path_buf() {
|
|
|
|
assert_ser_tokens(
|
|
|
|
&PathBuf::from("/usr/local/lib"),
|
|
|
|
&[Token::Str("/usr/local/lib")],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_cstring() {
|
|
|
|
assert_ser_tokens(&CString::new("abc").unwrap(), &[Token::Bytes(b"abc")]);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_cstr() {
|
|
|
|
let cstring = CString::new("abc").unwrap();
|
|
|
|
assert_ser_tokens(cstring.as_c_str(), &[Token::Bytes(b"abc")]);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_rc() {
|
|
|
|
assert_ser_tokens(&Rc::new(true), &[Token::Bool(true)]);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_rc_weak_some() {
|
|
|
|
let rc = Rc::new(true);
|
|
|
|
assert_ser_tokens(&Rc::downgrade(&rc), &[Token::Some, Token::Bool(true)]);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_rc_weak_none() {
|
|
|
|
assert_ser_tokens(&RcWeak::<bool>::new(), &[Token::None]);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_arc() {
|
|
|
|
assert_ser_tokens(&Arc::new(true), &[Token::Bool(true)]);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_arc_weak_some() {
|
|
|
|
let arc = Arc::new(true);
|
|
|
|
assert_ser_tokens(&Arc::downgrade(&arc), &[Token::Some, Token::Bool(true)]);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_arc_weak_none() {
|
|
|
|
assert_ser_tokens(&ArcWeak::<bool>::new(), &[Token::None]);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_wrapping() {
|
|
|
|
assert_ser_tokens(&Wrapping(1usize), &[Token::U64(1)]);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_rc_dst() {
|
|
|
|
assert_ser_tokens(&Rc::<str>::from("s"), &[Token::Str("s")]);
|
|
|
|
assert_ser_tokens(
|
|
|
|
&Rc::<[bool]>::from(&[true][..]),
|
|
|
|
&[
|
2018-06-03 02:27:26 -05:00
|
|
|
Token::Seq { len: Some(1) },
|
|
|
|
Token::Bool(true),
|
|
|
|
Token::SeqEnd,
|
|
|
|
],
|
2022-01-20 22:07:00 -06:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_arc_dst() {
|
|
|
|
assert_ser_tokens(&Arc::<str>::from("s"), &[Token::Str("s")]);
|
|
|
|
assert_ser_tokens(
|
|
|
|
&Arc::<[bool]>::from(&[true][..]),
|
|
|
|
&[
|
2018-06-03 02:27:26 -05:00
|
|
|
Token::Seq { len: Some(1) },
|
|
|
|
Token::Bool(true),
|
|
|
|
Token::SeqEnd,
|
|
|
|
],
|
2022-01-20 22:07:00 -06:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_fmt_arguments() {
|
|
|
|
assert_ser_tokens(&format_args!("{}{}", 1, 'a'), &[Token::Str("1a")]);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_atomic() {
|
|
|
|
assert_ser_tokens(&AtomicBool::new(false), &[Token::Bool(false)]);
|
|
|
|
assert_ser_tokens(&AtomicBool::new(true), &[Token::Bool(true)]);
|
|
|
|
assert_ser_tokens(&AtomicI8::new(63i8), &[Token::I8(63i8)]);
|
|
|
|
assert_ser_tokens(&AtomicI16::new(-318i16), &[Token::I16(-318i16)]);
|
|
|
|
assert_ser_tokens(&AtomicI32::new(65792i32), &[Token::I32(65792i32)]);
|
|
|
|
assert_ser_tokens(&AtomicIsize::new(-65792isize), &[Token::I64(-65792i64)]);
|
|
|
|
assert_ser_tokens(&AtomicU8::new(192u8), &[Token::U8(192u8)]);
|
|
|
|
assert_ser_tokens(&AtomicU16::new(510u16), &[Token::U16(510u16)]);
|
|
|
|
assert_ser_tokens(&AtomicU32::new(131072u32), &[Token::U32(131072u32)]);
|
|
|
|
assert_ser_tokens(&AtomicUsize::new(655360usize), &[Token::U64(655360u64)]);
|
2019-07-16 12:00:44 -05:00
|
|
|
}
|
|
|
|
|
2019-07-17 11:11:35 -05:00
|
|
|
#[cfg(target_arch = "x86_64")]
|
2022-01-20 22:07:00 -06:00
|
|
|
#[test]
|
|
|
|
fn test_atomic64() {
|
|
|
|
assert_ser_tokens(
|
|
|
|
&AtomicI64::new(-4295032832i64),
|
|
|
|
&[Token::I64(-4295032832i64)],
|
|
|
|
);
|
|
|
|
assert_ser_tokens(
|
|
|
|
&AtomicU64::new(12884901888u64),
|
|
|
|
&[Token::U64(12884901888u64)],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_net_ipv4addr_readable() {
|
|
|
|
assert_ser_tokens(
|
|
|
|
&"1.2.3.4".parse::<net::Ipv4Addr>().unwrap().readable(),
|
|
|
|
&[Token::Str("1.2.3.4")],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_net_ipv6addr_readable() {
|
|
|
|
assert_ser_tokens(
|
|
|
|
&"::1".parse::<net::Ipv6Addr>().unwrap().readable(),
|
|
|
|
&[Token::Str("::1")],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_net_ipaddr_readable() {
|
|
|
|
assert_ser_tokens(
|
|
|
|
&"1.2.3.4".parse::<net::IpAddr>().unwrap().readable(),
|
|
|
|
&[Token::Str("1.2.3.4")],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_net_socketaddr_readable() {
|
|
|
|
assert_ser_tokens(
|
|
|
|
&"1.2.3.4:1234"
|
|
|
|
.parse::<net::SocketAddr>()
|
|
|
|
.unwrap()
|
|
|
|
.readable(),
|
|
|
|
&[Token::Str("1.2.3.4:1234")],
|
|
|
|
);
|
|
|
|
assert_ser_tokens(
|
|
|
|
&"1.2.3.4:1234"
|
|
|
|
.parse::<net::SocketAddrV4>()
|
|
|
|
.unwrap()
|
|
|
|
.readable(),
|
|
|
|
&[Token::Str("1.2.3.4:1234")],
|
|
|
|
);
|
|
|
|
assert_ser_tokens(
|
|
|
|
&"[::1]:1234"
|
|
|
|
.parse::<net::SocketAddrV6>()
|
|
|
|
.unwrap()
|
|
|
|
.readable(),
|
|
|
|
&[Token::Str("[::1]:1234")],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_net_ipv4addr_compact() {
|
|
|
|
assert_ser_tokens(
|
|
|
|
&net::Ipv4Addr::from(*b"1234").compact(),
|
|
|
|
&seq![
|
2017-09-11 08:54:49 -05:00
|
|
|
Token::Tuple { len: 4 },
|
2022-01-20 21:36:41 -06:00
|
|
|
b"1234".iter().copied().map(Token::U8),
|
2017-09-11 08:54:49 -05:00
|
|
|
Token::TupleEnd,
|
|
|
|
],
|
2022-01-20 22:07:00 -06:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_net_ipv6addr_compact() {
|
|
|
|
assert_ser_tokens(
|
|
|
|
&net::Ipv6Addr::from(*b"1234567890123456").compact(),
|
|
|
|
&seq![
|
2017-09-11 08:54:49 -05:00
|
|
|
Token::Tuple { len: 16 },
|
2022-01-20 21:36:41 -06:00
|
|
|
b"1234567890123456".iter().copied().map(Token::U8),
|
2017-09-11 08:54:49 -05:00
|
|
|
Token::TupleEnd,
|
|
|
|
],
|
2022-01-20 22:07:00 -06:00
|
|
|
);
|
|
|
|
}
|
2017-09-11 10:39:57 -05:00
|
|
|
|
2022-01-20 22:07:00 -06:00
|
|
|
#[test]
|
|
|
|
fn test_net_ipaddr_compact() {
|
|
|
|
assert_ser_tokens(
|
|
|
|
&net::IpAddr::from(*b"1234").compact(),
|
|
|
|
&seq![
|
|
|
|
Token::NewtypeVariant {
|
|
|
|
name: "IpAddr",
|
|
|
|
variant: "V4"
|
|
|
|
},
|
2017-09-11 10:39:57 -05:00
|
|
|
Token::Tuple { len: 4 },
|
2022-01-20 21:36:41 -06:00
|
|
|
b"1234".iter().copied().map(Token::U8),
|
2017-09-11 10:39:57 -05:00
|
|
|
Token::TupleEnd,
|
|
|
|
],
|
2022-01-20 22:07:00 -06:00
|
|
|
);
|
|
|
|
}
|
2017-09-11 10:39:57 -05:00
|
|
|
|
2022-01-20 22:07:00 -06:00
|
|
|
#[test]
|
|
|
|
fn test_net_socketaddr_compact() {
|
|
|
|
assert_ser_tokens(
|
|
|
|
&net::SocketAddr::from((*b"1234567890123456", 1234)).compact(),
|
|
|
|
&seq![
|
|
|
|
Token::NewtypeVariant {
|
|
|
|
name: "SocketAddr",
|
|
|
|
variant: "V6"
|
|
|
|
},
|
2017-09-11 08:54:49 -05:00
|
|
|
Token::Tuple { len: 2 },
|
|
|
|
Token::Tuple { len: 16 },
|
2022-01-20 21:36:41 -06:00
|
|
|
b"1234567890123456".iter().copied().map(Token::U8),
|
2017-09-11 08:54:49 -05:00
|
|
|
Token::TupleEnd,
|
|
|
|
Token::U16(1234),
|
|
|
|
Token::TupleEnd,
|
|
|
|
],
|
2022-01-20 22:07:00 -06:00
|
|
|
);
|
|
|
|
assert_ser_tokens(
|
|
|
|
&net::SocketAddrV4::new(net::Ipv4Addr::from(*b"1234"), 1234).compact(),
|
|
|
|
&seq![
|
2017-09-11 08:54:49 -05:00
|
|
|
Token::Tuple { len: 2 },
|
|
|
|
Token::Tuple { len: 4 },
|
2022-01-20 21:36:41 -06:00
|
|
|
b"1234".iter().copied().map(Token::U8),
|
2017-09-11 08:54:49 -05:00
|
|
|
Token::TupleEnd,
|
|
|
|
Token::U16(1234),
|
|
|
|
Token::TupleEnd,
|
|
|
|
],
|
2022-01-20 22:07:00 -06:00
|
|
|
);
|
|
|
|
assert_ser_tokens(
|
|
|
|
&net::SocketAddrV6::new(net::Ipv6Addr::from(*b"1234567890123456"), 1234, 0, 0).compact(),
|
|
|
|
&seq![
|
2017-09-11 08:54:49 -05:00
|
|
|
Token::Tuple { len: 2 },
|
|
|
|
Token::Tuple { len: 16 },
|
2022-01-20 21:36:41 -06:00
|
|
|
b"1234567890123456".iter().copied().map(Token::U8),
|
2017-09-11 08:54:49 -05:00
|
|
|
Token::TupleEnd,
|
|
|
|
Token::U16(1234),
|
|
|
|
Token::TupleEnd,
|
|
|
|
],
|
2022-01-20 22:07:00 -06:00
|
|
|
);
|
2017-09-11 08:54:49 -05:00
|
|
|
}
|
|
|
|
|
2018-06-03 02:15:05 -05:00
|
|
|
#[cfg(feature = "unstable")]
|
2022-01-20 22:07:00 -06:00
|
|
|
#[test]
|
|
|
|
fn test_never_result() {
|
|
|
|
assert_ser_tokens(
|
|
|
|
&Ok::<u8, !>(0),
|
|
|
|
&[
|
|
|
|
Token::NewtypeVariant {
|
|
|
|
name: "Result",
|
|
|
|
variant: "Ok",
|
|
|
|
},
|
2018-06-03 02:15:05 -05:00
|
|
|
Token::U8(0),
|
|
|
|
],
|
2022-01-20 22:07:00 -06:00
|
|
|
);
|
2018-06-03 02:15:05 -05:00
|
|
|
}
|
|
|
|
|
2016-01-28 12:41:21 -06:00
|
|
|
#[test]
|
2017-03-27 11:15:22 -05:00
|
|
|
#[cfg(unix)]
|
2016-01-28 12:41:21 -06:00
|
|
|
fn test_cannot_serialize_paths() {
|
2022-07-18 23:27:20 -05:00
|
|
|
use std::ffi::OsStr;
|
|
|
|
use std::os::unix::ffi::OsStrExt;
|
|
|
|
|
2016-06-28 23:47:54 -05:00
|
|
|
assert_ser_tokens_error(
|
2022-07-18 23:27:20 -05:00
|
|
|
&Path::new(OsStr::from_bytes(b"Hello \xF0\x90\x80World")),
|
2016-06-29 00:23:38 -05:00
|
|
|
&[],
|
2017-04-19 13:38:57 -05:00
|
|
|
"path contains invalid UTF-8 characters",
|
2017-04-13 14:28:23 -05:00
|
|
|
);
|
2016-01-28 12:41:21 -06:00
|
|
|
}
|
2016-12-24 00:37:23 -06:00
|
|
|
|
2018-06-01 02:08:16 -05:00
|
|
|
#[test]
|
|
|
|
fn test_cannot_serialize_mutably_borrowed_ref_cell() {
|
|
|
|
let ref_cell = RefCell::new(42);
|
|
|
|
let _reference = ref_cell.borrow_mut();
|
|
|
|
assert_ser_tokens_error(&ref_cell, &[], "already mutably borrowed");
|
|
|
|
}
|
|
|
|
|
2016-12-24 00:37:23 -06:00
|
|
|
#[test]
|
|
|
|
fn test_enum_skipped() {
|
|
|
|
assert_ser_tokens_error(
|
|
|
|
&Enum::SkippedUnit,
|
|
|
|
&[],
|
2017-04-19 13:38:57 -05:00
|
|
|
"the enum variant Enum::SkippedUnit cannot be serialized",
|
2017-04-13 14:28:23 -05:00
|
|
|
);
|
2016-12-24 00:37:23 -06:00
|
|
|
assert_ser_tokens_error(
|
|
|
|
&Enum::SkippedOne(42),
|
|
|
|
&[],
|
2017-04-19 13:38:57 -05:00
|
|
|
"the enum variant Enum::SkippedOne cannot be serialized",
|
2017-04-13 14:28:23 -05:00
|
|
|
);
|
2016-12-24 00:37:23 -06:00
|
|
|
assert_ser_tokens_error(
|
|
|
|
&Enum::SkippedSeq(1, 2),
|
|
|
|
&[],
|
2017-04-19 13:38:57 -05:00
|
|
|
"the enum variant Enum::SkippedSeq cannot be serialized",
|
2017-04-13 14:28:23 -05:00
|
|
|
);
|
2016-12-24 00:37:23 -06:00
|
|
|
assert_ser_tokens_error(
|
|
|
|
&Enum::SkippedMap { _a: 1, _b: 2 },
|
|
|
|
&[],
|
2017-04-19 13:38:57 -05:00
|
|
|
"the enum variant Enum::SkippedMap cannot be serialized",
|
2017-04-13 14:28:23 -05:00
|
|
|
);
|
2016-12-24 00:37:23 -06:00
|
|
|
}
|
2018-05-19 18:31:44 -05:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_integer128() {
|
|
|
|
assert_ser_tokens_error(&1i128, &[], "i128 is not supported");
|
|
|
|
|
|
|
|
assert_ser_tokens_error(&1u128, &[], "u128 is not supported");
|
|
|
|
}
|
2022-09-22 01:57:55 -05:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_refcell_dst() {
|
|
|
|
assert_ser_tokens(
|
|
|
|
&RefCell::new([true]) as &RefCell<[bool]>,
|
|
|
|
&[
|
|
|
|
Token::Seq { len: Some(1) },
|
|
|
|
Token::Bool(true),
|
|
|
|
Token::SeqEnd,
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_mutex_dst() {
|
|
|
|
assert_ser_tokens(
|
|
|
|
&Mutex::new([true]) as &Mutex<[bool]>,
|
|
|
|
&[
|
|
|
|
Token::Seq { len: Some(1) },
|
|
|
|
Token::Bool(true),
|
|
|
|
Token::SeqEnd,
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_rwlock_dst() {
|
|
|
|
assert_ser_tokens(
|
|
|
|
&RwLock::new([true]) as &RwLock<[bool]>,
|
|
|
|
&[
|
|
|
|
Token::Seq { len: Some(1) },
|
|
|
|
Token::Bool(true),
|
|
|
|
Token::SeqEnd,
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|