mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-13 17:13:48 +00:00
60 lines
2.9 KiB
Plaintext
60 lines
2.9 KiB
Plaintext
error: usage of `.chars().any(...)` to check if a char matches any from a string literal
|
|
--> tests/ui/string_lit_chars_any.rs:18:5
|
|
|
|
|
LL | "\\.+*?()|[]{}^$#&-~".chars().any(|x| x == c);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: `-D clippy::string-lit-chars-any` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::string_lit_chars_any)]`
|
|
help: use `matches!(...)` instead
|
|
|
|
|
LL | matches!(c, '\\' | '.' | '+' | '*' | '?' | '(' | ')' | '|' | '[' | ']' | '{' | '}' | '^' | '$' | '#' | '&' | '-' | '~');
|
|
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
error: usage of `.chars().any(...)` to check if a char matches any from a string literal
|
|
--> tests/ui/string_lit_chars_any.rs:19:5
|
|
|
|
|
LL | r#"\.+*?()|[]{}^$#&-~"#.chars().any(|x| x == c);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
help: use `matches!(...)` instead
|
|
|
|
|
LL | matches!(c, '\\' | '.' | '+' | '*' | '?' | '(' | ')' | '|' | '[' | ']' | '{' | '}' | '^' | '$' | '#' | '&' | '-' | '~');
|
|
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
error: usage of `.chars().any(...)` to check if a char matches any from a string literal
|
|
--> tests/ui/string_lit_chars_any.rs:20:5
|
|
|
|
|
LL | "\\.+*?()|[]{}^$#&-~".chars().any(|x| c == x);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
help: use `matches!(...)` instead
|
|
|
|
|
LL | matches!(c, '\\' | '.' | '+' | '*' | '?' | '(' | ')' | '|' | '[' | ']' | '{' | '}' | '^' | '$' | '#' | '&' | '-' | '~');
|
|
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
error: usage of `.chars().any(...)` to check if a char matches any from a string literal
|
|
--> tests/ui/string_lit_chars_any.rs:21:5
|
|
|
|
|
LL | r#"\.+*?()|[]{}^$#&-~"#.chars().any(|x| c == x);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
help: use `matches!(...)` instead
|
|
|
|
|
LL | matches!(c, '\\' | '.' | '+' | '*' | '?' | '(' | ')' | '|' | '[' | ']' | '{' | '}' | '^' | '$' | '#' | '&' | '-' | '~');
|
|
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
error: usage of `.chars().any(...)` to check if a char matches any from a string literal
|
|
--> tests/ui/string_lit_chars_any.rs:23:5
|
|
|
|
|
LL | "\\.+*?()|[]{}^$#&-~".chars().any(|x| { x == c });
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
help: use `matches!(...)` instead
|
|
|
|
|
LL | matches!(c, '\\' | '.' | '+' | '*' | '?' | '(' | ')' | '|' | '[' | ']' | '{' | '}' | '^' | '$' | '#' | '&' | '-' | '~');
|
|
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
error: aborting due to 5 previous errors
|
|
|