-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
L-complexityLint: Belongs in the complexity lint groupLint: Belongs in the complexity lint group
Description
Calling -x.foo()
will first call foo
and then negate. While this is correct as per the precedence rules, it can be surprising (see rust-lang/rust#59388). We should suggest a cleanup either by writing (-x).foo()
if that was intended, by writing -(x.foo())
for by introducing an intermediate variable:
let x_foo = x.foo();
-x_foo
Metadata
Metadata
Assignees
Labels
L-complexityLint: Belongs in the complexity lint groupLint: Belongs in the complexity lint group