Why Clippy giving a warnig on changing a value sign?

⚓ Rust    📅 2025-11-23    👤 surdeus    👁️ 16      

surdeus

I noticed warnings like that

warning: this looks like you are trying to use `.. -= ..`, but you really are doing `.. = (- ..)`
   --> ./lib.rs:325:42
    |
325 |                         if neg {num_value =- num_value}
    |                                          ^^^^
    |
    = note: to remove this lint, use either `-=` or `= -`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_assignment_formatting
    = note: `#[warn(clippy::suspicious_assignment_formatting)]` on by default

Is there any reason for that?

2 posts - 2 participants

Read full topic

🏷️ Rust_feed