-
Notifications
You must be signed in to change notification settings - Fork 13k
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 against Iterator::map
receiving a callable that returns ()
#107890
Conversation
r? @cjgillot (rustbot has picked a reviewer for you, use r? to override) |
|
7764f08
to
fe9dba2
Compare
Also, I wonder if we should just make |
This comment has been minimized.
This comment has been minimized.
fe9dba2
to
055c0cd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still have my question about #[must_use]
.
This comment has been minimized.
This comment has been minimized.
If this were to go in
|
055c0cd
to
34ecad3
Compare
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
cb6b545
to
b6b121e
Compare
@rustbot ready |
Could you add a test that the example in #106991 (comment) diagnoses both the type error and the lint? There is a redundancy between the |
☔ The latest upstream changes (presumably #103042) made this pull request unmergeable. Please resolve the merge conflicts. |
cac8701
to
7bc1a52
Compare
This comment has been minimized.
This comment has been minimized.
cac8701
to
a97f486
Compare
This comment has been minimized.
This comment has been minimized.
a97f486
to
99344a8
Compare
@bors r+ |
Lint against `Iterator::map` receiving a callable that returns `()` Close rust-lang#106991
Lint against `Iterator::map` receiving a callable that returns `()` Close rust-lang#106991
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#107062 (Do some cleanup of doc/index.md) - rust-lang#107890 (Lint against `Iterator::map` receiving a callable that returns `()`) - rust-lang#108431 (Add regression test for rust-lang#107918) - rust-lang#108432 (test: drop unused deps) - rust-lang#108436 (make "proc macro panicked" translatable) - rust-lang#108444 (docs/test: add UI test and docs for `E0476`) - rust-lang#108449 (Do not lint ineffective unstable trait impl for unresolved trait) - rust-lang#108456 (Complete migrating `ast_passes` to derive diagnostics) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
error[E0271]: expected `foo` to be a fn item that returns `i32`, but it returns `()` | ||
--> $DIR/issue-106991.rs:5:13 | ||
| | ||
LL | fn bar() -> impl Iterator<Item = i32> { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `i32` | ||
| | ||
= note: required for `Map<std::slice::IterMut<'_, Vec<u8>>, for<'a> fn(&'a mut Vec<u8>) {foo}>` to implement `Iterator` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a case where we should be doing more than we are now. A similar explanation to the lint's would be necessary to properly convey to users what the problem was. At least pointing at the return expression with nothing else would be an improvement.
Close #106991