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

Lint for iterating over a slice with one (or zero) element #1540

Closed
malbarbo opened this issue Feb 14, 2017 · 2 comments · Fixed by #6109
Closed

Lint for iterating over a slice with one (or zero) element #1540

malbarbo opened this issue Feb 14, 2017 · 2 comments · Fixed by #6109
Labels
A-lint Area: New lints good-first-issue These issues are a good way to get started with Clippy L-unnecessary Lint: Warn about unnecessary code T-middle Type: Probably requires verifiying types

Comments

@malbarbo
Copy link

Another day a see something like:

for a in &[b] {
}
@oli-obk oli-obk added L-unnecessary Lint: Warn about unnecessary code good-first-issue These issues are a good way to get started with Clippy A-lint Area: New lints T-middle Type: Probably requires verifiying types labels Feb 14, 2017
@clarfonthey
Copy link
Contributor

This should suggest to replace with an if let

@llogiq
Copy link
Contributor

llogiq commented Feb 14, 2017

Or just let a = &b?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints good-first-issue These issues are a good way to get started with Clippy L-unnecessary Lint: Warn about unnecessary code T-middle Type: Probably requires verifiying types
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants