Skip to content

Disable misguided clippy lint#655

Closed
jannic wants to merge 1 commit into
rust-embedded:masterfrom
jannic-dev-forks:disable-double-ended-iterator-warning
Closed

Disable misguided clippy lint#655
jannic wants to merge 1 commit into
rust-embedded:masterfrom
jannic-dev-forks:disable-double-ended-iterator-warning

Conversation

@jannic
Copy link
Copy Markdown
Member

@jannic jannic commented Apr 3, 2025

Disables this warning and its wrong suggestion:

warning: called `Iterator::last` on a `DoubleEndedIterator`; this will needlessly iterate the entire iterator
   --> embedded-hal-nb/src/serial.rs:127:17
    |
127 |           let _ = s
    |  _________________^
128 | |             .bytes()
129 | |             .map(|c| nb::block!(self.write(Word::from(c))))
130 | |             .last();
    | |______________-----^
    |                |
    |                help: try: `next_back()`
    |
    = note: this change will alter drop order which may be undesirable
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#double_ended_iterator_last
    = note: `#[warn(clippy::double_ended_iterator_last)]` on by default

@jannic jannic requested a review from a team as a code owner April 3, 2025 17:10
@burrbull
Copy link
Copy Markdown
Member

burrbull commented Apr 3, 2025

for

@Dirbaio
Copy link
Copy Markdown
Member

Dirbaio commented Apr 6, 2025

IMO the real issue here is using map for the side effect (it's not idiomatic). We should fix it with a plain old for .. in instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants