Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
mumbleskates committed Dec 29, 2024
1 parent dcdaf2f commit 67ec962
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 20 deletions.
27 changes: 14 additions & 13 deletions src/encoding/mod.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
use alloc::boxed::Box;
use core::cmp::{min, Eq, Ordering, PartialEq};
use core::default::Default;
use core::fmt::Debug;
use core::ops::{Deref, DerefMut};

use bytes::buf::Take;
use bytes::{Buf, BufMut};

use crate::buf::ReverseBuf;
use crate::DecodeErrorKind::{
ConflictingFields, InvalidVarint, NotCanonical, Oversize, TagOverflowed, Truncated,
UnexpectedlyRepeated, UnknownField, WrongWireType,
};
use crate::{decode_length_delimiter, DecodeError, DecodeErrorKind};
use alloc::boxed::Box;
use bytes::buf::Take;
use bytes::{Buf, BufMut};
use core::cmp::{min, Eq, Ordering, PartialEq};
use core::default::Default;
use core::fmt::Debug;
use core::ops::{Deref, DerefMut};

mod fixed;
mod general;
Expand Down Expand Up @@ -2651,7 +2649,7 @@ mod test {
fn check_type_empty_via_proxy() {
$crate::encoding::test::check_type_empty_impl::<$ty>();
$crate::encoding::test::check_type_empty_impl::<
<$ty as $crate::encoding::proxy::Proxiable>::Proxy
<$ty as $crate::encoding::proxy::Proxiable>::Proxy,
>();
let start = <$ty as $crate::encoding::EmptyState>::empty();
let proxy = $crate::encoding::proxy::Proxiable::encode_proxy(&start);
Expand All @@ -2668,14 +2666,17 @@ mod test {
fn check_type_empty_via_distinguished_proxy() {
$crate::encoding::test::check_type_empty_impl::<$ty>();
$crate::encoding::test::check_type_empty_impl::<
<$ty as $crate::encoding::proxy::Proxiable>::Proxy
<$ty as $crate::encoding::proxy::Proxiable>::Proxy,
>();
let start = <$ty as $crate::encoding::EmptyState>::empty();
let proxy = $crate::encoding::proxy::Proxiable::encode_proxy(&start);
assert!($crate::encoding::EmptyState::is_empty(&proxy));
let mut end = <$ty as $crate::encoding::EmptyState>::empty();
let canon = $crate::encoding::proxy::DistinguishedProxiable::
decode_proxy_distinguished(&mut end, proxy).unwrap();
let canon =
$crate::encoding::proxy::DistinguishedProxiable::decode_proxy_distinguished(
&mut end, proxy,
)
.unwrap();
assert_eq!(canon, $crate::Canonicity::Canonical);
assert!($crate::encoding::EmptyState::is_empty(&end));
assert_eq!(start, end);
Expand Down
18 changes: 11 additions & 7 deletions src/encoding/type_support/std.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
use core::cmp::Ordering;
use crate::encoding::value_traits::for_overwrite_via_default;
use crate::encoding::{delegate_encoding, delegate_value_encoding, Collection, EmptyState, ForOverwrite, General, Map, Mapping, Packed, Proxiable, Proxied, Unpacked, Varint};
use crate::encoding::{
delegate_encoding, delegate_value_encoding, Collection, EmptyState, ForOverwrite, General, Map,
Mapping, Packed, Proxiable, Proxied, Unpacked, Varint,
};
use crate::DecodeErrorKind;
use crate::DecodeErrorKind::{InvalidValue, OutOfDomainValue, UnexpectedlyRepeated};
use core::cmp::Ordering;
use std::collections::{hash_map, hash_set, HashMap, HashSet};
use std::time::{SystemTime, UNIX_EPOCH};

Expand Down Expand Up @@ -48,12 +51,12 @@ where
{
type Item = T;
type RefIter<'a>
= hash_set::Iter<'a, T>
= hash_set::Iter<'a, T>
where
Self::Item: 'a,
Self: 'a;
type ReverseIter<'a>
= Self::RefIter<'a>
= Self::RefIter<'a>
where
Self::Item: 'a,
Self: 'a;
Expand Down Expand Up @@ -109,13 +112,13 @@ where
type Key = K;
type Value = V;
type RefIter<'a>
= hash_map::Iter<'a, K, V>
= hash_map::Iter<'a, K, V>
where
K: 'a,
V: 'a,
Self: 'a;
type ReverseIter<'a>
= Self::RefIter<'a>
= Self::RefIter<'a>
where
K: 'a,
V: 'a,
Expand Down Expand Up @@ -191,7 +194,8 @@ impl Proxiable for SystemTime {
Ok(nanos)
}
})?;
*self = operation(&UNIX_EPOCH, core::time::Duration::new(secs, nanos)).ok_or(OutOfDomainValue)?;
*self = operation(&UNIX_EPOCH, core::time::Duration::new(secs, nanos))
.ok_or(OutOfDomainValue)?;
Ok(())
}
}
Expand Down

0 comments on commit 67ec962

Please sign in to comment.