S0031: unary minus requires Int or Float
Generated from rellum-diagnostics/src/db.rs.
Explanation
The unary - operator is numeric negation. It is defined only for Int and Float values; Rellum does not implicitly convert Bool, Char, String, arrays, records, or enums to numbers.
Common causes
- negating a String, Char, Bool, array, record, or enum value
- using - where logical not or bitwise not was intended
- expecting implicit numeric conversion
Canonical fixes
- negate a numeric value
Before:
value = -text
After:
value = -count
- convert explicitly before numeric negation
Code example
value = -text