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

unnecessary_fold span could be improved #4381

Closed
euclio opened this issue Aug 14, 2019 · 0 comments · Fixed by #4382
Closed

unnecessary_fold span could be improved #4381

euclio opened this issue Aug 14, 2019 · 0 comments · Fixed by #4382
Labels
L-suggestion Lint: Improving, adding or fixing lint suggestions

Comments

@euclio
Copy link
Contributor

euclio commented Aug 14, 2019

https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=4c497beec029469448e2a1fd503e50c2

warning: this `.fold` can be written more succinctly using another method
 --> src/main.rs:3:16
  |
3 |           .iter()
  |  ________________^
4 | |         .fold(0, |sum, x| sum + x);
  | |__________________________________^ help: try: `.sum()`
  |
  = note: `#[warn(clippy::unnecessary_fold)]` on by default
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_fold

The span doesn't need to go across lines, it should instead go up to the method dot.

@phansch phansch added the L-suggestion Lint: Improving, adding or fixing lint suggestions label Aug 14, 2019
bors added a commit that referenced this issue Aug 14, 2019
Change span of unnecessary_fold lint

Resolves #4381

changelog: Change linted span of `unnecessary_fold`
bors added a commit that referenced this issue Aug 14, 2019
Change span of unnecessary_fold lint

Resolves #4381

changelog: Change linted span of `unnecessary_fold`
bors added a commit that referenced this issue Aug 15, 2019
Change span of unnecessary_fold lint

Resolves #4381

changelog: Change linted span of `unnecessary_fold`
bors added a commit that referenced this issue Aug 15, 2019
Change span of unnecessary_fold lint

Resolves #4381

changelog: Change linted span of `unnecessary_fold`
bors added a commit that referenced this issue Aug 15, 2019
Change span of unnecessary_fold lint

Resolves #4381

changelog: Change linted span of `unnecessary_fold`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L-suggestion Lint: Improving, adding or fixing lint suggestions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants