You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For str::starts_with using a single char string literal generates much better code as it can just compare the single byte of the str literal, while comparing against a char involves decoding possibly multiple bytes of the text. Here is the Godbolt for it: https://rust.godbolt.org/z/V_Arel
Therefore the single_char_pattern lint should not apply for str::starts_with (and possibly ends_with) and instead it should possibly even advice against using a char.
For str::starts_with using a single char string literal generates much better code as it can just compare the single byte of the str literal, while comparing against a char involves decoding possibly multiple bytes of the text. Here is the Godbolt for it: https://rust.godbolt.org/z/V_Arel
Therefore the single_char_pattern lint should not apply for str::starts_with (and possibly ends_with) and instead it should possibly even advice against using a char.
clippy 0.0.212 (b2601be 2018-11-27)
The text was updated successfully, but these errors were encountered: