Closed
Description
Summary
Having an function returning a boxed iterator triggers this lint.
Lint Name
iter_not_returning_iterator
Reproducer
I tried this code:
pub trait Foo {
fn iter(&self) -> Box<dyn Iterator<Item = i32> + '_>;
}
I saw this happen:
warning: this method is named `iter` but its return type does not implement `Iterator`
--> src/lib.rs:3:5
|
3 | fn iter(&self) -> Box<dyn Iterator<Item = i32> + '_>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: the lint level is defined here
--> src/lib.rs:1:9
|
1 | #![warn(clippy::iter_not_returning_iterator)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#iter_not_returning_iterator
I expected to see this happen:
No warn being triggered
Version
rustc 1.60.0-nightly (bd3cb5256 2022-01-16)
binary: rustc
commit-hash: bd3cb52565faab2755ff1bdb54d88bc91f47b4b9
commit-date: 2022-01-16
host: x86_64-unknown-linux-gnu
release: 1.60.0-nightly
LLVM version: 13.0.0
Additional Labels
No response