From 90f739265e38e74c51b5a23ed56bed4f70bcca35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2?= Date: Fri, 19 Nov 2021 19:32:28 +0300 Subject: [PATCH] fmt and fix io::Write impl --- digest/src/core_api.rs | 5 ++++- digest/src/core_api/ct_variable.rs | 2 +- digest/src/core_api/rt_variable.rs | 8 +++++--- digest/src/core_api/wrapper.rs | 20 ++++++++++++++------ digest/src/core_api/xof_reader.rs | 2 +- 5 files changed, 25 insertions(+), 12 deletions(-) diff --git a/digest/src/core_api.rs b/digest/src/core_api.rs index 10833fbb9..d7d236476 100644 --- a/digest/src/core_api.rs +++ b/digest/src/core_api.rs @@ -4,7 +4,10 @@ //! core algorithm wrapped by the wrapper types, which implement the //! higher-level traits. use crate::InvalidOutputSize; -use generic_array::{ArrayLength, typenum::{U256, IsLess, Le, NonZero}}; +use generic_array::{ + typenum::{IsLess, Le, NonZero, U256}, + ArrayLength, +}; pub use crypto_common::{AlgorithmName, Block, BlockSizeUser, OutputSizeUser, Reset}; diff --git a/digest/src/core_api/ct_variable.rs b/digest/src/core_api/ct_variable.rs index 2dc4c076e..b91f067a5 100644 --- a/digest/src/core_api/ct_variable.rs +++ b/digest/src/core_api/ct_variable.rs @@ -7,7 +7,7 @@ use crate::MacMarker; use core::{fmt, marker::PhantomData}; use crypto_common::{Block, BlockSizeUser, OutputSizeUser}; use generic_array::{ - typenum::{IsLessOrEqual, IsLess, Le, LeEq, NonZero, U256}, + typenum::{IsLess, IsLessOrEqual, Le, LeEq, NonZero, U256}, ArrayLength, GenericArray, }; diff --git a/digest/src/core_api/rt_variable.rs b/digest/src/core_api/rt_variable.rs index 9a63f4d25..f87863845 100644 --- a/digest/src/core_api/rt_variable.rs +++ b/digest/src/core_api/rt_variable.rs @@ -5,7 +5,7 @@ use crate::MacMarker; use crate::{InvalidOutputSize, Reset, Update, VariableOutput}; use block_buffer::BlockBuffer; use core::fmt; -use generic_array::typenum::{Unsigned, Le, IsLess, U256, NonZero}; +use generic_array::typenum::{IsLess, Le, NonZero, Unsigned, U256}; /// Wrapper around [`VariableOutputCore`] which selects output size /// at run time. @@ -26,7 +26,8 @@ where T: VariableOutputCore + HashMarker, T::BlockSize: IsLess, Le: NonZero, -{} +{ +} #[cfg(feature = "mac")] #[cfg_attr(docsrs, doc(cfg(feature = "mac")))] @@ -35,7 +36,8 @@ where T: VariableOutputCore + MacMarker, T::BlockSize: IsLess, Le: NonZero, -{} +{ +} impl Reset for RtVariableCoreWrapper where diff --git a/digest/src/core_api/wrapper.rs b/digest/src/core_api/wrapper.rs index b354cad9b..164971b7d 100644 --- a/digest/src/core_api/wrapper.rs +++ b/digest/src/core_api/wrapper.rs @@ -5,8 +5,8 @@ use super::{ use crate::{ExtendableOutput, FixedOutput, FixedOutputReset, HashMarker, Update}; use block_buffer::BlockBuffer; use core::fmt; -use crypto_common::{InvalidLength, Key, KeyInit, KeySizeUser, Output, BlockSizeUser}; -use generic_array::typenum::{NonZero, IsLess, Le, U256}; +use crypto_common::{BlockSizeUser, InvalidLength, Key, KeyInit, KeySizeUser, Output}; +use generic_array::typenum::{IsLess, Le, NonZero, U256}; #[cfg(feature = "mac")] use crate::MacMarker; @@ -30,7 +30,8 @@ where T: BufferKindUser + HashMarker, T::BlockSize: IsLess, Le: NonZero, -{} +{ +} #[cfg(feature = "mac")] #[cfg_attr(docsrs, doc(cfg(feature = "mac")))] @@ -39,7 +40,8 @@ where T: BufferKindUser + MacMarker, T::BlockSize: IsLess, Le: NonZero, -{} +{ +} impl CoreWrapper where @@ -196,7 +198,12 @@ where #[cfg(feature = "std")] #[cfg_attr(docsrs, doc(cfg(feature = "std")))] -impl std::io::Write for CoreWrapper { +impl std::io::Write for CoreWrapper +where + T: BufferKindUser + UpdateCore, + T::BlockSize: IsLess, + Le: NonZero, +{ #[inline] fn write(&mut self, buf: &[u8]) -> std::io::Result { Update::update(self, buf); @@ -226,7 +233,8 @@ where T: BufferKindUser, T::BlockSize: IsLess, Le: NonZero, -{} +{ +} impl CoreProxy for CoreWrapper where diff --git a/digest/src/core_api/xof_reader.rs b/digest/src/core_api/xof_reader.rs index 03d0e078e..5b41479b0 100644 --- a/digest/src/core_api/xof_reader.rs +++ b/digest/src/core_api/xof_reader.rs @@ -2,7 +2,7 @@ use super::{AlgorithmName, XofReaderCore}; use crate::XofReader; use block_buffer::EagerBuffer; use core::fmt; -use generic_array::typenum::{IsLess, Le, U256, NonZero}; +use generic_array::typenum::{IsLess, Le, NonZero, U256}; /// Wrapper around [`XofReaderCore`] implementations. ///