Info
This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: Mismatched lifetime syntaxes lint in Rust 1.89.0
Sorry, this is probably a rant. But I also have a question at the end.
I think the newly enabled "Mismatched lifetime syntaxes lint" in Rust 1.89.0 is making Rust code less readable.
Quote the example from the release blog:
fn items(scores: &[u8]) -> std::slice::Iter<u8>
will cause the lint warning, and will need to be changed into
fn items(scores: &[u8]) -> std::slice::Iter<'_, u8>
As a regular Rust user, I felt the first one is more readable, and the new explicit lifetime is not worth it. With today's IDEs, it is very easy for users to be aware of the definition of Iter
has a lifetime.
Isn't the whole point of "Lifetime elision" is to make the code more readable? This change seems to be going backwards.
My question is: Is there a real problem with using Iter<u8>
?
2 posts - 2 participants
🏷️ Rust_feed