Skip to content

CAT 018

unurgunite edited this page Jul 11, 2026 · 3 revisions

CAT-018 — String#downcase == → compare

Severity: hintConfidence: mediumAuto-fix:

Tip

This rule supports auto-fix via --fix

Description

String#downcase == → compare — Use case-insensitive comparison instead of downcase + == to avoid allocating a new string.

Bad code

str.downcase == "hello"

Good code

str.compare("hello", case_insensitive: true)

Benchmark

Note

See bench results at bench/cat-018/

Clone this wiki locally