A character constant holds several characters, which gives a value the compiler chooses

tx0/c:multi-character-constantrecommendedwarningreliability/strings-and-regexdepth fastbug

What it finds

c == 'ab' or '\n\r': a character constant with more than one character is an int whose value the compiler chooses, so it compares equal to no single character. A string or two constants was meant.

Plain constants count, without a prefix, whose characters are ASCII; an escape sequence is one character. Four-character codes such as 'RIFF' are written so on purpose in some code, so the rule is not in the default set.

From the rule's source, multi_character_constant.rs.

Example from the rule's tests
int is_newline(int c){  int a = c == '\n\r';tx0 reports: this character constant holds 2 characters  return a || c == '\n' || c == '\x41';}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/c:multi-character-constant" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/c:multi-character-constant] reason="..."

tx0 explain tx0/c:multi-character-constant shows the same in the terminal. Found a false positive? Report it.