Skip to content

Commit 69252b2

Browse files
formatting
1 parent f68be5b commit 69252b2

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

amqp-type/src/fixed_width/uint.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::error::AppError;
2-
use crate::serde::encode::{Encode, Encoded};
32
use crate::serde::decode::Decode;
3+
use crate::serde::encode::{Encode, Encoded};
44
use crate::verify::verify_bytes_read_eq;
55

66
impl Encode for u32 {
@@ -19,19 +19,20 @@ impl Decode for u32 {
1919
Some(0x70) => true,
2020
Some(0x52) => true,
2121
Some(0x43) => true,
22-
_ => false
22+
_ => false,
2323
}
2424
}
2525

2626
fn try_decode(mut iter: impl Iterator<Item = u8>) -> Result<Self, crate::error::AppError>
27-
where
28-
Self: Sized {
27+
where
28+
Self: Sized,
29+
{
2930
match iter.next() {
3031
Some(0x70) => Ok(parse_uint(iter)?),
3132
Some(0x52) => Ok(parse_small_uint(iter)?),
3233
Some(0x43) => Ok(0u32),
3334
Some(c) => Err(AppError::DeserializationIllegalConstructorError(c)),
34-
None => Err(AppError::IteratorEmptyOrTooShortError)
35+
None => Err(AppError::IteratorEmptyOrTooShortError),
3536
}
3637
}
3738
}
@@ -53,7 +54,6 @@ fn parse_small_uint(mut iter: impl Iterator<Item = u8>) -> Result<u32, AppError>
5354
} else {
5455
Err(AppError::IteratorEmptyOrTooShortError)
5556
}
56-
5757
}
5858

5959
#[cfg(test)]
@@ -79,7 +79,6 @@ mod test {
7979
assert_eq!(val.encode().constructor(), 0x52);
8080
}
8181

82-
8382
#[test]
8483
fn can_deocde_returns_true_if_constructor_is_valid() {
8584
let val_norm = vec![0x70];
@@ -98,7 +97,7 @@ mod test {
9897

9998
#[test]
10099
fn try_decode_returns_correct_value() {
101-
let val = vec![0x70, 0x00,0x00, 0x00, 0x10];
100+
let val = vec![0x70, 0x00, 0x00, 0x00, 0x10];
102101
assert_eq!(u32::try_decode(val.into_iter()).unwrap(), 16);
103102
}
104103

@@ -123,12 +122,12 @@ mod test {
123122
#[test]
124123
fn try_decode_can_decode_smalluint_values() {
125124
let val = vec![0x52, 0xff];
126-
assert_eq!(u32::try_decode(val.into_iter()).unwrap(), 255);
125+
assert_eq!(u32::try_decode(val.into_iter()).unwrap(), 255);
127126
}
128127

129128
#[test]
130129
fn try_decode_returns_error_when_parsing_small_unint_and_bytes_are_missing() {
131130
let val = vec![0x52];
132-
assert!(u32::try_decode(val.into_iter()).is_err());
131+
assert!(u32::try_decode(val.into_iter()).is_err());
133132
}
134133
}

amqp-type/src/verify.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
use crate::error::AppError;
22

3-
4-
53
pub fn verify_bytes_read_eq(actual: usize, expected: usize) -> Result<(), AppError> {
64
if actual == expected {
75
Ok(())

0 commit comments

Comments
 (0)