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
{{ message }}
Repository navigation
manual_pattern_char_comparison should respect MSRV #12936
#![warn(clippy::manual_pattern_char_comparison)]#[clippy::msrv = "1.57"]fn_f(){let _ = "abc".replace(|c:char| c == 'b' || c == 'c',"a");}
I saw this happen:
warning: this manual char comparison can be written more succinctly
--> src/lib.rs:5:28
|
5 | let _ = "abc".replace(|c: char| c == 'b' || c == 'c', "a");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using an array of `char`: `['b', 'c']`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_pattern_char_comparison
note: the lint level is defined here
--> src/lib.rs:1:9
|
1 | #![warn(clippy::manual_pattern_char_comparison)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: expected a `FnMut<(char,)>` closure, found `[char; 2]`
--> <source>:6:28
|
6 | let _ = "abc".replace(['b', 'c'], "a");
| ------- ^^^^^^^^^^ expected an `FnMut<(char,)>` closure, found `[char; 2]`
| |
| required by a bound introduced by this call
|
= help: the trait `FnMut<(char,)>` is not implemented for `[char; 2]`
= note: required because of the requirements on the impl of `Pattern<'_>` for `[char; 2]`
Activity
AurelienFT commentedon Jun 15, 2024
@rustbot claim
Auto merge of #12937 - AurelienFT:add_msrv_manual_patter_char_compari…