Skip to content

Commit c613097

Browse files
committed
tweak Debug impls
1 parent ca7bf39 commit c613097

3 files changed

Lines changed: 4 additions & 24 deletions

File tree

k12/src/custom/borrow.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,7 @@ impl<Rate: BlockSizes> Default for CustomRefKt<'static, Rate> {
3939
impl<Rate: BlockSizes> fmt::Debug for CustomRefKt<'_, Rate> {
4040
#[inline]
4141
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
42-
let debug_str = match Rate::USIZE {
43-
168 => "CustomRefKt128 { ... }",
44-
136 => "CustomRefKt256 { ... }",
45-
_ => unreachable!(),
46-
};
47-
f.write_str(debug_str)
42+
write!(f, "CustomKt{} {{ ... }}", 4 * (200 - Rate::USIZE))
4843
}
4944
}
5045

k12/src/custom/owned.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,7 @@ impl<Rate: BlockSizes> Default for CustomKt<Rate> {
4747
impl<Rate: BlockSizes> fmt::Debug for CustomKt<Rate> {
4848
#[inline]
4949
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
50-
let debug_str = match Rate::USIZE {
51-
168 => "CustomKt128 { ... }",
52-
136 => "CustomKt256 { ... }",
53-
_ => unreachable!(),
54-
};
55-
f.write_str(debug_str)
50+
write!(f, "CustomKt{} {{ ... }}", 4 * (200 - Rate::USIZE))
5651
}
5752
}
5853

k12/src/lib.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -68,24 +68,14 @@ impl<Rate: BlockSizes> Default for Kt<Rate> {
6868
impl<Rate: BlockSizes> fmt::Debug for Kt<Rate> {
6969
#[inline]
7070
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
71-
let debug_str = match Rate::USIZE {
72-
168 => "Kt128 { ... }",
73-
136 => "Kt256 { ... }",
74-
_ => unreachable!(),
75-
};
76-
f.write_str(debug_str)
71+
write!(f, "Kt{} {{ ... }}", 4 * (200 - Rate::USIZE))
7772
}
7873
}
7974

8075
impl<Rate: BlockSizes> AlgorithmName for Kt<Rate> {
8176
#[inline]
8277
fn write_alg_name(f: &mut fmt::Formatter<'_>) -> fmt::Result {
83-
let debug_str = match Rate::USIZE {
84-
168 => "KT128",
85-
136 => "KT256",
86-
_ => unreachable!(),
87-
};
88-
f.write_str(debug_str)
78+
write!(f, "KT{}", 4 * (200 - Rate::USIZE))
8979
}
9080
}
9181

0 commit comments

Comments
 (0)