Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shorten the MaybeUninit Debug implementation #133282

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Nov 21, 2024

  1. Shorten the MaybeUninit Debug implementation

    Currently the `Debug` implementation for `MaybeUninit` winds up being
    pretty verbose. This struct:
    
        #[derive(Debug)]
        pub struct Foo {
            pub a: u32,
            pub b: &'static str,
            pub c: MaybeUninit<u32>,
            pub d: MaybeUninit<String>,
        }
    
    Prints as:
    
        Foo {
            a: 0,
            b: "hello",
            c: core::mem::maybe_uninit::MaybeUninit<u32>,
            d: core::mem::maybe_uninit::MaybeUninit<alloc::string::String>,
        }
    
    The goal is just to be a standin for content so the path prefix doesn't
    add any useful information. Change the implementation to trim
    `MaybeUninit`'s leading path, meaning the new result is now:
    
        Foo {
            a: 0,
            b: "hello",
            c: MaybeUninit<u32>,
            d: MaybeUninit<alloc::string::String>,
        }
    tgross35 committed Nov 21, 2024
    Configuration menu
    Copy the full SHA
    d7e21eb View commit details
    Browse the repository at this point in the history