Skip to content

use strum_macros::Display for Token - #666

Closed
moritz-gross wants to merge 1 commit into
daisy:mainfrom
moritz-gross:simplify-display-of-token
Closed

use strum_macros::Display for Token#666
moritz-gross wants to merge 1 commit into
daisy:mainfrom
moritz-gross:simplify-display-of-token

Conversation

@moritz-gross

Copy link
Copy Markdown
Collaborator

ok I forgot that you also need to reuse str in the display-string, so this makes it a bit longer than I thought it would be.

still, that's a 9 line improvement, and it keeps the logic closer by having it directly next to each variant, instead of an extra function.

in my book, this is still worth doing

@NSoiffer NSoiffer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not that happy with this change. I think it makes reading the enum much harder for a minor drop in the total number of lines.

Do you want to provide a counter argument?

@moritz-gross

Copy link
Copy Markdown
Collaborator Author

hm ideally there'd be a syntax like name_of_enum_variant + string, that you specify only once.

when I find a solution that I'm really happy with, I'll open another PR for it.

@github-project-automation github-project-automation Bot moved this from Triage to Done in MathCAT Project Board Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants