Skip to content

Commit 1b372e9

Browse files
authored
chore: fix new linting problems (#50)
1 parent 5aa4e7d commit 1b372e9

File tree

4 files changed

+3
-15
lines changed

4 files changed

+3
-15
lines changed

examples/readme.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// NOTE: This file should be kept in sync with README.md
22

3+
#[cfg(feature = "std")]
34
use serde_derive::{Deserialize, Serialize};
45
#[cfg(feature = "std")]
56
use std::error::Error;
@@ -10,6 +11,7 @@ use std::io::BufReader;
1011

1112
// Types annotated with `Serialize` can be stored as DAG-CBOR.
1213
// To be able to load them again add `Deserialize`.
14+
#[cfg(feature = "std")]
1315
#[derive(Debug, Serialize, Deserialize)]
1416
struct Mascot {
1517
name: String,

tests/enum.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,3 @@ fn test_variable_length_array_error() {
8585
let value: Result<Vec<Foo>, _> = from_slice(slice);
8686
assert!(matches!(value.unwrap_err(), DecodeError::IndefiniteSize));
8787
}
88-
89-
#[derive(Serialize, Deserialize, PartialEq, Debug)]
90-
enum Bar {
91-
Empty,
92-
Number(i32),
93-
Flag(String, bool),
94-
Point { x: i32, y: i32 },
95-
}

tests/ipld.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,6 @@ fn unit_struct_not_supported() {
7979
assert!(ipld.is_err());
8080
}
8181

82-
#[derive(Debug, Deserialize, Serialize)]
83-
struct SmallStruct {
84-
spam: u32,
85-
eggs: u32,
86-
}
87-
8882
#[derive(Debug, PartialEq, Clone, Deserialize_tuple, Serialize_tuple)]
8983
#[serde(deny_unknown_fields)]
9084
struct StructWithTupleSerialization {

tests/std_types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use serde_derive::{Deserialize, Serialize};
33
use serde_ipld_dagcbor::{from_slice, to_vec};
44

55
fn to_binary(s: &'static str) -> Vec<u8> {
6-
assert!(s.len() % 2 == 0);
6+
assert!(s.len().is_multiple_of(2));
77
let mut b = Vec::with_capacity(s.len() / 2);
88
for i in 0..s.len() / 2 {
99
b.push(u8::from_str_radix(&s[i * 2..(i + 1) * 2], 16).unwrap());

0 commit comments

Comments
 (0)