mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 09:00:22 +00:00
AK+Kernel: Format DistinctNumeric using the underlying type's formatter
Forcing the formatting to go through `Formatter<FormatString>` is completely unnecessary, increases code size, performs a String allocation and prevents us from using the formatting options available on that type. This commit also removes explicit formatters from `BlockBasedFileSystem::BlockIndex` and `Kernel::InodeIndex`, as those are already covered by the blanket implementation for all `DistinctNumeric` types.
This commit is contained in:
parent
9bf6d51aec
commit
018c4e0e7e
Notes:
sideshowbarker
2024-07-18 02:05:22 +09:00
Author: https://github.com/BertalanD Commit: https://github.com/SerenityOS/serenity/commit/018c4e0e7e5 Pull-request: https://github.com/SerenityOS/serenity/pull/10558
3 changed files with 2 additions and 18 deletions
|
@ -270,10 +270,10 @@ private:
|
|||
};
|
||||
|
||||
template<typename T, typename X, bool Incr, bool Cmp, bool Bool, bool Flags, bool Shift, bool Arith>
|
||||
struct Formatter<DistinctNumeric<T, X, Incr, Cmp, Bool, Flags, Shift, Arith>> : Formatter<FormatString> {
|
||||
struct Formatter<DistinctNumeric<T, X, Incr, Cmp, Bool, Flags, Shift, Arith>> : Formatter<T> {
|
||||
void format(FormatBuilder& builder, DistinctNumeric<T, X, Incr, Cmp, Bool, Flags, Shift, Arith> value)
|
||||
{
|
||||
return Formatter<FormatString>::format(builder, "{}", value.value());
|
||||
return Formatter<T>::format(builder, value.value());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -48,11 +48,3 @@ private:
|
|||
};
|
||||
|
||||
}
|
||||
|
||||
template<>
|
||||
struct AK::Formatter<Kernel::BlockBasedFileSystem::BlockIndex> : AK::Formatter<FormatString> {
|
||||
void format(FormatBuilder& builder, Kernel::BlockBasedFileSystem::BlockIndex value)
|
||||
{
|
||||
return AK::Formatter<FormatString>::format(builder, "{}", value.value());
|
||||
}
|
||||
};
|
||||
|
|
|
@ -61,11 +61,3 @@ struct AK::Formatter<Kernel::InodeIdentifier> : AK::Formatter<FormatString> {
|
|||
return AK::Formatter<FormatString>::format(builder, "{}:{}", value.fsid(), value.index());
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct AK::Formatter<Kernel::InodeIndex> : AK::Formatter<FormatString> {
|
||||
void format(FormatBuilder& builder, Kernel::InodeIndex value)
|
||||
{
|
||||
return AK::Formatter<FormatString>::format(builder, "{}", value.value());
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue