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

Add lint: Calling panicking methods like single() instead of get_ variants #58

Open
janhohenheim opened this issue Sep 6, 2024 · 2 comments
Assignees
Labels
A-Linter Related to the linter and custom lints C-Enhancement A general improvement X-Blessed

Comments

@janhohenheim
Copy link
Member

No description provided.

@janhohenheim janhohenheim added the A-Linter Related to the linter and custom lints label Sep 6, 2024
@BD103 BD103 added the C-Enhancement A general improvement label Sep 6, 2024
@BD103
Copy link
Member

BD103 commented Sep 17, 2024

Quoting @alice-i-cecile from #85:

Calling .single, .single_mut, .resource, .resource_mut and so on can introduce surprising crashes to your production game.

We should pair this with a recommendation to use equivalent lints around unwrap and expect in clippy, so coders don't just change .single() to .get_single().unwrap().

We probably want to split this into two lints, one for query data and the other for resources.

@alice-i-cecile
Copy link
Member

Related to bevyengine/bevy#14275

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Linter Related to the linter and custom lints C-Enhancement A general improvement X-Blessed
Projects
Status: In Progress
Development

No branches or pull requests

3 participants