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

Prefer Display over Debug formatting #13621

Open
BenjaminBrienen opened this issue Oct 28, 2024 · 0 comments
Open

Prefer Display over Debug formatting #13621

BenjaminBrienen opened this issue Oct 28, 2024 · 0 comments
Labels
A-lint Area: New lints

Comments

@BenjaminBrienen
Copy link

BenjaminBrienen commented Oct 28, 2024

What it does

Suggest when Display ("{}") can be used instead of Debug ("{:?}").

Advantage

Makes things like bevyengine/bevy#16112 more long-term maintainable

Drawbacks

Debug might be intentional (often). Workaround would be to make the suggestion opt-in per-struct.

Example

println!("{:?}", 100);

Could be written as:

println!("{}", 100);
@BenjaminBrienen BenjaminBrienen added the A-lint Area: New lints label Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints
Projects
None yet
Development

No branches or pull requests

1 participant