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

Using trait as _ to avoid namespace pollution #16268

Open
BenjaminBrienen opened this issue Nov 6, 2024 · 1 comment
Open

Using trait as _ to avoid namespace pollution #16268

BenjaminBrienen opened this issue Nov 6, 2024 · 1 comment
Labels
S-Duplicate This issue or PR already exists

Comments

@BenjaminBrienen
Copy link
Contributor

BenjaminBrienen commented Nov 6, 2024

This is really interesting, I hadn't considered using trait as _ to avoid name collisions. At a glance this also works in preludes. For a future PR, could be nice to do this for extension style traits (e.g., AppAssetExt etc.) so the preludes aren't so heavy with names.

Originally posted by @bushrat011899 in #16163 (comment)

@BenjaminBrienen BenjaminBrienen changed the title Using trait as _ to avoid name collisions for extension style traits Using trait as _ to avoid namespace pollution Nov 6, 2024
@benfrankel
Copy link
Contributor

benfrankel commented Nov 9, 2024

This is a duplicate of #13959 btw :)

Although this issue does seem to go further and say that use trait as _ should be preferred even if it's not being re-exported (not just pub use trait as _). I'd personally agree with that as well, although that's more of a question of style.

@BenjaminBrienen BenjaminBrienen added the S-Duplicate This issue or PR already exists label Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-Duplicate This issue or PR already exists
Projects
None yet
Development

No branches or pull requests

2 participants