A string is searched for a string literal of one character, where the character itself is faster
What it finds
s.find("x") searches for a substring, which costs more than s.find('x'), the search for a character. The fix passes the character.
From the rule's source, find_with_one_character_string.rs.
Turn it on, off or suppress it
The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/cpp:find-with-one-character-string" = "note"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/cpp:find-with-one-character-string] reason="..."tx0 explain tx0/cpp:find-with-one-character-string shows the same in the terminal. Found a false positive? Report it.