S0020: min/max require an ordered scalar type
Generated from rellum-diagnostics/src/db.rs.
Explanation
The built-in min and max functions are defined only for Int, Float, and Char in V1. They rely on a total ordering that arrays, records, enums, strings, and function values do not currently provide.
Common causes
- calling min or max with String values
- calling min or max with arrays or records
- expecting lexicographic ordering for strings
Canonical fixes
- compare an ordered projection instead
Before:
best = max(left_name, right_name)
After:
best_len = max(len(left_name), len(right_name))
- write an explicit match or helper for custom comparison
Code example
best = max(left_name, right_name)