- Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
S-needs-discussionStatus: Needs further discussion before merging or work can be startedStatus: Needs further discussion before merging or work can be started
Description
When I ran cargo clippy against rustfmt repository, I got the following suggestion, which is incorrect:
warning: `if _ { .. } else { .. }` is an expression --> src/visitor.rs:189:9 | 189 | / let mut unindent_comment = self.is_if_else_block && !b.stmts.is_empty(); 190 | | if unindent_comment { 191 | | let end_pos = source!(self, b.span).hi() - brace_compensation - remove_len; 192 | | let snippet = self.snippet(mk_sp(self.last_pos, end_pos)); 193 | | unindent_comment = snippet.contains("//") || snippet.contains("/*"); 194 | | } | |_________^ help: it is more idiomatic to write: `let <mut> unindent_comment = if unindent_comment { ..; snippet.contains("//") || snippet.contains("/*") } else { self.is_if_else_block && !b.stmts.is_empty() };` | = note: #[warn(useless_let_if_seq)] on by default = note: you might not need `mut` at all = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.166/index.html#useless_let_if_seq This looks similar to #975.
I am using 0.0.166.
Metadata
Metadata
Assignees
Labels
S-needs-discussionStatus: Needs further discussion before merging or work can be startedStatus: Needs further discussion before merging or work can be started