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

unwrap_or_else false positive #1653

Closed
clarfonthey opened this issue Apr 1, 2017 · 0 comments · Fixed by #4429
Closed

unwrap_or_else false positive #1653

clarfonthey opened this issue Apr 1, 2017 · 0 comments · Fixed by #4429
Labels
C-bug Category: Clippy is not doing the correct thing E-medium Call for participation: Medium difficulty level problem and requires some initial experience. T-middle Type: Probably requires verifiying types

Comments

@clarfonthey
Copy link
Contributor

Code from toml-rs:

self.chars.clone().next().map(|i| i.0).unwrap_or(self.input.len())

Currently, it's suggesting to change this to unwrap_or_else when this is a simple value copy.

@oli-obk oli-obk added E-medium Call for participation: Medium difficulty level problem and requires some initial experience. C-bug Category: Clippy is not doing the correct thing T-middle Type: Probably requires verifiying types labels Apr 4, 2017
bors added a commit that referenced this issue May 25, 2020
Update 'or_fun_call' to ignore calls to len

Resolves #1653

changelog: Update `or_fun_call`: Allow calls to `len` for Slice, Array & Vec.
@bors bors closed this as completed in dd06d29 May 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing E-medium Call for participation: Medium difficulty level problem and requires some initial experience. T-middle Type: Probably requires verifiying types
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants