Skip to content

Allow automatically derived Show for enums to be just the field name #18669

Closed
@mitsuhiko

Description

@mitsuhiko
Contributor

When working with enums for error reporting it would be super useful if the default implementation of Show for enums could be customized so that you can skip the contained data. For instance if you have a MyError(SomeOtherError) it is interesting to just get MyError instead of MyError(SomeOtherError { foo: 42 }) or whatever is contained in there.

Activity

steveklabnik

steveklabnik commented on Jan 27, 2015

@steveklabnik
Member

I believe the Display/Debug split takes care of this now, as Display no longer has a default implementation for exactly this reason.

added a commit that references this issue on Dec 16, 2024

Merge pull request rust-lang#18669 from Veykril/push-qqkuxtvsmsut

508ce7c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @mitsuhiko@steveklabnik

        Issue actions

          Allow automatically derived Show for enums to be just the field name · Issue #18669 · rust-lang/rust