Add MSRV check for bool::then_some

This commit is contained in:
Josh Triplett 2022-07-06 00:51:40 -07:00
parent 528308b5aa
commit ebff7206bc
2 changed files with 7 additions and 1 deletions

View file

@ -2737,7 +2737,12 @@ impl Methods {
}
},
("take", []) => needless_option_take::check(cx, expr, recv),
("then", [arg]) => unnecessary_lazy_eval::check(cx, expr, recv, arg, "then_some"),
("then", [arg]) => {
if !meets_msrv(self.msrv, msrvs::BOOL_THEN_SOME) {
return;
}
unnecessary_lazy_eval::check(cx, expr, recv, arg, "then_some");
},
("to_os_string" | "to_owned" | "to_path_buf" | "to_vec", []) => {
implicit_clone::check(cx, name, expr, recv);
},

View file

@ -12,6 +12,7 @@ macro_rules! msrv_aliases {
// names may refer to stabilized feature flags or library items
msrv_aliases! {
1,62,0 { BOOL_THEN_SOME }
1,53,0 { OR_PATTERNS, MANUAL_BITS, BTREE_MAP_RETAIN, BTREE_SET_RETAIN }
1,52,0 { STR_SPLIT_ONCE, REM_EUCLID_CONST }
1,51,0 { BORROW_AS_PTR, UNSIGNED_ABS }