RS.CLIPPY.SUSPICIOUS_UNARY_OP_FORMATTING

Suspicious formatting of unary `-` or `!` on the RHS of a BinOp

This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: suspicious_unary_op_formatting. Copyright ©2025 The Rust Team. All rights reserved.

What it does

Checks the formatting of a unary operator on the right hand side of a binary operator. It lints if there is no space between the binary and unary operators, but there is a space between the unary and its operand.

Why is this bad?

This is either a typo in the binary operator or confusing.

Example

// &&! looks like a different operator
if foo &&! bar {}

Use instead:

if foo && !bar {}