We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
impl Debug for MaybeUninit
1 parent 1fc9700 commit 678769bCopy full SHA for 678769b
core/src/mem/maybe_uninit.rs
@@ -276,10 +276,9 @@ impl<T: Copy> Clone for MaybeUninit<T> {
276
impl<T> fmt::Debug for MaybeUninit<T> {
277
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
278
// NB: there is no `.pad_fmt` so we can't use a simpler `format_args!("MaybeUninit<{..}>").
279
- // This needs to be adjusted if `MaybeUninit` moves modules.
280
let full_name = type_name::<Self>();
281
- let short_name = full_name.split_once("mem::maybe_uninit::").unwrap().1;
282
- f.pad(short_name)
+ let prefix_len = full_name.find("MaybeUninit").unwrap();
+ f.pad(&full_name[prefix_len..])
283
}
284
285
0 commit comments