Skip to content

Exercise enums1.rs could be clearer about value-less enum variants #2269

@E-Geraet

Description

@E-Geraet

Hey there!

I just went through the enums1.rs exercise, and I found the instructions a little confusing at first.

The comment says:

// TODO: Define a few types of messages as used below.

But in the main() function, you see things like Message::Resize, Message::Move, etc.
and that kind of looks like those variants might take values (especially after doing the structs exercises).
So I initially tried adding values or thinking I had to pass in data like Message::Resize(800, 600).

Turns out, all of those variants are meant to be value-less, which is super simple once you know — but it wasn’t totally obvious from the comment.

Suggestion: maybe make the comment a bit more explicit, like:

// TODO: Define the message types used below.
// These are simple enum variants with no data.

Small change, but I think it might help people avoid overthinking the task.

Thanks for this awesome project!

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

    Issue actions