Code readability and Clippy

⚓ Rust    📅 2026-01-20    👤 surdeus    👁️ 9      

surdeus

Info

This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: Code readability and Clippy

One my student from Poland taught me to use the style of a negation, however Clippy doesn't like it:

66 |     if session.is_empty() == false {
   |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `!session.is_empty()`

The reason is Unnecessary code.. However ! is hardly visible and a source of mistakes. Do you agree that Clippy suggestion reduces a readability of the code?

3 posts - 3 participants

Read full topic

🏷️ Rust_feed