Skip to content

Commit 8f6b8a9

Browse files
chore: apply cleaner cargo fmt
1 parent 9a8d6ab commit 8f6b8a9

File tree

6 files changed

+56
-28
lines changed

6 files changed

+56
-28
lines changed

Makefile.toml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Use cargo-make to run tasks here: https://crates.io/crates/cargo-make
2+
3+
[tasks.format]
4+
workspace = false
5+
command = "cargo"
6+
args = [
7+
"fmt",
8+
"--all",
9+
"--",
10+
"--config",
11+
"unstable_features=true",
12+
"--config",
13+
"imports_granularity=Crate,group_imports=StdExternalCrate,reorder_imports=true,format_code_in_doc_comments=true",
14+
]
15+
16+
[tasks.format-check]
17+
workspace = false
18+
command = "cargo"
19+
args = [
20+
"fmt",
21+
"--all",
22+
"--check",
23+
"--",
24+
"--config",
25+
"unstable_features=true",
26+
"--config",
27+
"imports_granularity=Crate,group_imports=StdExternalCrate,reorder_imports=true,format_code_in_doc_comments=true",
28+
]

src/cid.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
//!
33
//! [Spec](https://dasl.ing/cid.html)
44
5-
use std::fmt::Display;
6-
use std::str::FromStr;
5+
use std::{fmt::Display, str::FromStr};
76

87
use sha2::Digest;
98
use thiserror::Error;

src/drisl.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,14 @@ pub mod error;
88
pub mod ser;
99

1010
#[doc(inline)]
11-
pub use self::error::{DecodeError, EncodeError};
12-
11+
pub use self::de::from_reader;
1312
// Convenience functions for serialization and deserialization.
1413
#[doc(inline)]
1514
pub use self::de::from_slice;
16-
1715
#[doc(inline)]
18-
pub use self::de::from_reader;
19-
16+
pub use self::error::{DecodeError, EncodeError};
2017
#[doc(inline)]
2118
pub use self::ser::to_vec;
22-
2319
#[doc(inline)]
2420
pub use self::ser::to_writer;
2521

src/drisl/cbor4ii_nonpub.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
//! Some things needed for the Serde implementation are not public in the cbor4ii crate. Those are
44
//! copied into this file.
55
6-
use cbor4ii::core::dec;
7-
use cbor4ii::core::error::Len;
6+
use cbor4ii::core::{dec, error::Len};
87

98
use super::error::DecodeError;
109

src/drisl/de.rs

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,28 @@
11
//! Deserialization.
2-
use cbor4ii::core::error::Len;
3-
use core::convert::{Infallible, TryFrom};
4-
use core::marker::PhantomData;
5-
use serde::Deserialize;
2+
use core::{
3+
convert::{Infallible, TryFrom},
4+
marker::PhantomData,
5+
};
66
use std::borrow::Cow;
77

8-
use cbor4ii::core::dec::{self, Decode};
9-
use cbor4ii::core::utils::IoReader;
10-
use cbor4ii::core::{major, types, utils::SliceReader};
11-
use serde::de::{self, Visitor};
12-
8+
use cbor4ii::core::{
9+
dec::{self, Decode},
10+
error::Len,
11+
major, types,
12+
utils::{IoReader, SliceReader},
13+
};
14+
use serde::{
15+
Deserialize,
16+
de::{self, Visitor},
17+
};
18+
19+
use super::{
20+
CBOR_TAGS_CID,
21+
cbor4ii_nonpub::{marker, peek_one, pull_one},
22+
error::DecodeError,
23+
};
1324
use crate::cid::CID_SERDE_PRIVATE_IDENTIFIER;
1425

15-
use super::CBOR_TAGS_CID;
16-
use super::cbor4ii_nonpub::{marker, peek_one, pull_one};
17-
use super::error::DecodeError;
18-
1926
/// Decodes a value from CBOR data in a slice.
2027
///
2128
/// # Examples
@@ -134,7 +141,9 @@ where
134141
/// assert_eq!(value, "foobar");
135142
/// assert!(iter.next().is_none());
136143
///
137-
/// let v: &[u8] = &[0x66, 0x66, 0x6f, 0x6f, 0x62, 0x61, 0x72, 0x63, 0x62, 0x61, 0x7A];
144+
/// let v: &[u8] = &[
145+
/// 0x66, 0x66, 0x6f, 0x6f, 0x62, 0x61, 0x72, 0x63, 0x62, 0x61, 0x7A,
146+
/// ];
138147
/// let mut reader = std::io::Cursor::new(v);
139148
/// let mut iter = de::iter_from_reader::<String, _>(&mut reader);
140149
/// let value_1: String = iter.next().unwrap().unwrap();

src/drisl/ser.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,15 @@
22
use std::{collections::TryReserveError, string::ToString, vec::Vec};
33

44
pub use cbor4ii::core::utils::{BufWriter, IoWriter};
5-
65
use cbor4ii::core::{
76
enc::{self, Encode},
87
types,
98
};
109
use serde::{Serialize, ser};
1110

11+
use super::{CBOR_TAGS_CID, error::EncodeError};
1212
use crate::cid::CID_SERDE_PRIVATE_IDENTIFIER;
1313

14-
use super::CBOR_TAGS_CID;
15-
use super::error::EncodeError;
16-
1714
/// Serializes a value to a vector.
1815
pub fn to_vec<T>(value: &T) -> Result<Vec<u8>, EncodeError<TryReserveError>>
1916
where

0 commit comments

Comments
 (0)