Skip to content

Disable misguided clippy lint #655

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

Conversation

jannic
Copy link
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
Member

burrbull commented Apr 3, 2025

for

@Dirbaio
Copy link
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