Skip to content

Commit

Permalink
feat: Simplify GitOid trait bounds (#96)
Browse files Browse the repository at this point in the history
Turns out the prior bounds were more complicated than
they needed to be. H::OutputSize works instead of
<H as OutputSizeUser>::OutputSize.

Signed-off-by: Andrew Lilley Brinker <[email protected]>
  • Loading branch information
alilleybrinker authored Feb 13, 2024
1 parent d43cbb6 commit 9e85a3c
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions gitoid/src/gitoid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub struct GitOid<H, O>
where
H: HashAlgorithm,
O: ObjectType,
<H as OutputSizeUser>::OutputSize: ArrayLength<u8>,
H::OutputSize: ArrayLength<u8>,
GenericArray<u8, H::OutputSize>: Copy,
{
#[doc(hidden)]
Expand All @@ -55,7 +55,7 @@ impl<H, O> GitOid<H, O>
where
H: HashAlgorithm,
O: ObjectType,
<H as OutputSizeUser>::OutputSize: ArrayLength<u8>,
H::OutputSize: ArrayLength<u8>,
GenericArray<u8, H::OutputSize>: Copy,
{
//===========================================================================================
Expand All @@ -78,7 +78,7 @@ where
where
H: HashAlgorithm,
O: ObjectType,
<H as OutputSizeUser>::OutputSize: ArrayLength<u8>,
H::OutputSize: ArrayLength<u8>,
GenericArray<u8, H::OutputSize>: Copy,
{
// PANIC SAFETY: We're reading from an in-memory buffer, so no IO errors can arise.
Expand All @@ -95,7 +95,7 @@ where
where
H: HashAlgorithm,
O: ObjectType,
<H as OutputSizeUser>::OutputSize: ArrayLength<u8>,
H::OutputSize: ArrayLength<u8>,
GenericArray<u8, H::OutputSize>: Copy,
{
GitOid::from_bytes(s.as_bytes())
Expand Down Expand Up @@ -170,7 +170,7 @@ impl<H, O> FromStr for GitOid<H, O>
where
H: HashAlgorithm,
O: ObjectType,
<H as OutputSizeUser>::OutputSize: ArrayLength<u8>,
H::OutputSize: ArrayLength<u8>,
GenericArray<u8, H::OutputSize>: Copy,
{
type Err = Error;
Expand All @@ -184,7 +184,7 @@ impl<H, O> Clone for GitOid<H, O>
where
H: HashAlgorithm,
O: ObjectType,
<H as OutputSizeUser>::OutputSize: ArrayLength<u8>,
H::OutputSize: ArrayLength<u8>,
GenericArray<u8, H::OutputSize>: Copy,
{
fn clone(&self) -> Self {
Expand All @@ -196,7 +196,7 @@ impl<H, O> Copy for GitOid<H, O>
where
H: HashAlgorithm,
O: ObjectType,
<H as OutputSizeUser>::OutputSize: ArrayLength<u8>,
H::OutputSize: ArrayLength<u8>,
GenericArray<u8, H::OutputSize>: Copy,
{
}
Expand All @@ -205,7 +205,7 @@ impl<H, O> PartialEq<GitOid<H, O>> for GitOid<H, O>
where
H: HashAlgorithm,
O: ObjectType,
<H as OutputSizeUser>::OutputSize: ArrayLength<u8>,
H::OutputSize: ArrayLength<u8>,
GenericArray<u8, H::OutputSize>: Copy,
{
fn eq(&self, other: &GitOid<H, O>) -> bool {
Expand All @@ -217,7 +217,7 @@ impl<H, O> Eq for GitOid<H, O>
where
H: HashAlgorithm,
O: ObjectType,
<H as OutputSizeUser>::OutputSize: ArrayLength<u8>,
H::OutputSize: ArrayLength<u8>,
GenericArray<u8, H::OutputSize>: Copy,
{
}
Expand All @@ -226,7 +226,7 @@ impl<H, O> PartialOrd<GitOid<H, O>> for GitOid<H, O>
where
H: HashAlgorithm,
O: ObjectType,
<H as OutputSizeUser>::OutputSize: ArrayLength<u8>,
H::OutputSize: ArrayLength<u8>,
GenericArray<u8, H::OutputSize>: Copy,
{
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
Expand All @@ -238,7 +238,7 @@ impl<H, O> Ord for GitOid<H, O>
where
H: HashAlgorithm,
O: ObjectType,
<H as OutputSizeUser>::OutputSize: ArrayLength<u8>,
H::OutputSize: ArrayLength<u8>,
GenericArray<u8, H::OutputSize>: Copy,
{
fn cmp(&self, other: &Self) -> Ordering {
Expand All @@ -250,7 +250,7 @@ impl<H, O> Hash for GitOid<H, O>
where
H: HashAlgorithm,
O: ObjectType,
<H as OutputSizeUser>::OutputSize: ArrayLength<u8>,
H::OutputSize: ArrayLength<u8>,
GenericArray<u8, H::OutputSize>: Copy,
{
fn hash<H2>(&self, state: &mut H2)
Expand All @@ -265,7 +265,7 @@ impl<H, O> Debug for GitOid<H, O>
where
H: HashAlgorithm,
O: ObjectType,
<H as OutputSizeUser>::OutputSize: ArrayLength<u8>,
H::OutputSize: ArrayLength<u8>,
GenericArray<u8, H::OutputSize>: Copy,
{
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
Expand All @@ -279,7 +279,7 @@ impl<H, O> Display for GitOid<H, O>
where
H: HashAlgorithm,
O: ObjectType,
<H as OutputSizeUser>::OutputSize: ArrayLength<u8>,
H::OutputSize: ArrayLength<u8>,
GenericArray<u8, H::OutputSize>: Copy,
{
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
Expand All @@ -291,7 +291,7 @@ struct GitOidUrlParser<'u, H, O>
where
H: HashAlgorithm,
O: ObjectType,
<H as OutputSizeUser>::OutputSize: ArrayLength<u8>,
H::OutputSize: ArrayLength<u8>,
GenericArray<u8, H::OutputSize>: Copy,
{
url: &'u Url,
Expand All @@ -313,7 +313,7 @@ impl<'u, H, O> GitOidUrlParser<'u, H, O>
where
H: HashAlgorithm,
O: ObjectType,
<H as OutputSizeUser>::OutputSize: ArrayLength<u8>,
H::OutputSize: ArrayLength<u8>,
GenericArray<u8, H::OutputSize>: Copy,
{
fn new(url: &'u Url) -> GitOidUrlParser<'u, H, O> {
Expand Down Expand Up @@ -402,7 +402,7 @@ impl<H, O> TryFrom<Url> for GitOid<H, O>
where
H: HashAlgorithm,
O: ObjectType,
<H as OutputSizeUser>::OutputSize: ArrayLength<u8>,
H::OutputSize: ArrayLength<u8>,
GenericArray<u8, H::OutputSize>: Copy,
{
type Error = Error;
Expand Down Expand Up @@ -430,7 +430,7 @@ fn gitoid_from_buffer<H, O, R>(
where
H: HashAlgorithm,
O: ObjectType,
<H as OutputSizeUser>::OutputSize: ArrayLength<u8>,
H::OutputSize: ArrayLength<u8>,
GenericArray<u8, H::OutputSize>: Copy,
R: Read,
{
Expand Down Expand Up @@ -506,7 +506,7 @@ fn hash_from_buffer<H, O, R>(
where
H: HashAlgorithm,
O: ObjectType,
<H as OutputSizeUser>::OutputSize: ArrayLength<u8>,
H::OutputSize: ArrayLength<u8>,
GenericArray<u8, H::OutputSize>: Copy,
R: Read,
{
Expand Down

0 comments on commit 9e85a3c

Please sign in to comment.