Skip to content

Commit 300e7e5

Browse files
authored
Fix CI (#196)
* chore: fix Clippy warnings * test: don't match on specific panic Recent Rust versions (>=1.73.0) changed the wording when using `assert_eq!()`. This made a test fail, as it was targeted at a specific message. As this message could change any time (as it's not under our control), just remove that exact matching, and just match on any panic. Closes #195.
1 parent 63104f3 commit 300e7e5

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

core/src/codec.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! `Ipld` codecs.
2-
use alloc::{format, string::String, vec::Vec};
3-
use core::convert::TryFrom;
2+
use alloc::{string::String, vec::Vec};
3+
use core::{convert::TryFrom, fmt::Write as _};
44

55
use crate::cid::Cid;
66
use crate::error::{Result, UnsupportedCodec};
@@ -85,7 +85,10 @@ where
8585
Ipld: Decode<C> + Encode<C>,
8686
{
8787
fn hex(bytes: &[u8]) -> String {
88-
bytes.iter().map(|byte| format!("{:02x}", byte)).collect()
88+
bytes.iter().fold(String::new(), |mut output, byte| {
89+
let _ = write!(output, "{byte:02x}");
90+
output
91+
})
8992
}
9093
let mut bytes = Vec::new();
9194
data.encode(c, &mut bytes).unwrap();

core/tests/serde_deserialize.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ fn ipld_deserialize_link() {
143143
}
144144

145145
#[test]
146-
#[should_panic(expected = "assertion failed")]
146+
#[should_panic]
147147
fn ipld_deserialize_link_not_as_bytes() {
148148
let cid = Cid::try_from("bafkreie74tgmnxqwojhtumgh5dzfj46gi4mynlfr7dmm7duwzyvnpw7h7m").unwrap();
149149
let ipld = Ipld::Link(cid);

dag-cbor/tests/serde_interop.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ impl Arbitrary for ValueArb {
4141
.into_iter()
4242
.map(|x| {
4343
let slf = Self(x);
44-
let shrunk = slf.shrink().map(|x| x.0).collect::<Vec<_>>();
45-
shrunk
44+
slf.shrink().map(|x| x.0).collect::<Vec<_>>()
4645
})
4746
.map(Value::Array)
4847
.map(Self),

0 commit comments

Comments
 (0)