mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-22 19:13:29 +00:00
59 lines
2.8 KiB
Text
59 lines
2.8 KiB
Text
error: this manual char comparison can be written more succinctly
|
|
--> tests/ui/manual_pattern_char_comparison.rs:11:31
|
|
|
|
|
LL | sentence.trim_end_matches(|c: char| c == '.' || c == ',' || c == '!' || c == '?');
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using an array of `char`: `['.', ',', '!', '?']`
|
|
|
|
|
= note: `-D clippy::manual-pattern-char-comparison` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::manual_pattern_char_comparison)]`
|
|
|
|
error: this manual char comparison can be written more succinctly
|
|
--> tests/ui/manual_pattern_char_comparison.rs:12:20
|
|
|
|
|
LL | sentence.split(|c: char| c == '\n' || c == 'X');
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using an array of `char`: `['\n', 'X']`
|
|
|
|
error: this manual char comparison can be written more succinctly
|
|
--> tests/ui/manual_pattern_char_comparison.rs:13:20
|
|
|
|
|
LL | sentence.split(|c| c == '\n' || c == 'X');
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using an array of `char`: `['\n', 'X']`
|
|
|
|
error: this manual char comparison can be written more succinctly
|
|
--> tests/ui/manual_pattern_char_comparison.rs:14:24
|
|
|
|
|
LL | sentence.splitn(3, |c: char| c == 'X');
|
|
| ^^^^^^^^^^^^^^^^^^ help: consider using a `char`: `'X'`
|
|
|
|
error: this manual char comparison can be written more succinctly
|
|
--> tests/ui/manual_pattern_char_comparison.rs:17:24
|
|
|
|
|
LL | sentence.splitn(3, |c: char| c == char_compare);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using a `char`: `char_compare`
|
|
|
|
error: this manual char comparison can be written more succinctly
|
|
--> tests/ui/manual_pattern_char_comparison.rs:18:20
|
|
|
|
|
LL | sentence.split(|c: char| matches!(c, '\n' | 'X' | 'Y'));
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using an array of `char`: `['\n', 'X', 'Y']`
|
|
|
|
error: this manual char comparison can be written more succinctly
|
|
--> tests/ui/manual_pattern_char_comparison.rs:19:24
|
|
|
|
|
LL | sentence.splitn(3, |c: char| matches!(c, 'X'));
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using a `char`: `'X'`
|
|
|
|
error: this manual char comparison can be written more succinctly
|
|
--> tests/ui/manual_pattern_char_comparison.rs:20:24
|
|
|
|
|
LL | sentence.splitn(3, |c: char| matches!(c, 'X' | 'W'));
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using an array of `char`: `['X', 'W']`
|
|
|
|
error: this manual char comparison can be written more succinctly
|
|
--> tests/ui/manual_pattern_char_comparison.rs:21:19
|
|
|
|
|
LL | sentence.find(|c| c == '🎈');
|
|
| ^^^^^^^^^^^^^ help: consider using a `char`: `'🎈'`
|
|
|
|
error: aborting due to 9 previous errors
|
|
|