refactor internal generic function

This commit is contained in:
MaxOhn
2024-03-02 07:14:11 +01:00
parent 6eac895339
commit eec15b0cc2
+4 -2
View File
@@ -175,8 +175,7 @@ impl<M> Debug for Converted<'_, M> {
impl<T> Debug for GenericFormatter<T> {
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
let full_type_name = any::type_name::<T>();
fn fmt_stripped(full_type_name: &str, f: &mut Formatter<'_>) -> FmtResult {
// Strip fully qualified syntax
if let Some(position) = full_type_name.rfind("::") {
if let Some(type_name) = full_type_name.get(position + 2..) {
@@ -186,6 +185,9 @@ impl<M> Debug for Converted<'_, M> {
Ok(())
}
fmt_stripped(any::type_name::<T>(), f)
}
}
f.debug_struct("Converted")