rust-clippy/tests/ui/suspicious_unary_op_formatting.rs
Nikos Filippakis 5143fe1a78 New lint: suspicious_unary_op_formatting
Lints when, on the RHS of a BinOp, there is a UnOp without a space
before the operator but with a space after (e.g. foo >- 1).

Signed-off-by: Nikos Filippakis <nikolaos.filippakis@cern.ch>
2019-10-09 16:22:00 +02:00

23 lines
350 B
Rust

#![warn(clippy::suspicious_unary_op_formatting)]
#[rustfmt::skip]
fn main() {
// weird binary operator formatting:
let a = 42;
if a >- 30 {}
if a >=- 30 {}
let b = true;
let c = false;
if b &&! c {}
if a >- 30 {}
// those are ok:
if a >-30 {}
if a < -30 {}
if b && !c {}
if a > - 30 {}
}