mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 02:57:37 +00:00
changed msrv name for consistency & changed nested if for style
This commit is contained in:
parent
ca00b138b2
commit
a693cbc1bc
@ -77,15 +77,10 @@ pub(super) fn check<'tcx>(
|
||||
return;
|
||||
}
|
||||
|
||||
let mut suggest_is_some_and = false;
|
||||
// argument to `unwrap_or` is false & is_some_and is stabilised; should suggest using `is_some_and`
|
||||
if msrv.meets(msrvs::OPT_IS_SOME_AND) {
|
||||
if let ExprKind::Lit(unwrap_lit) = &unwrap_arg.kind {
|
||||
if let rustc_ast::LitKind::Bool(false) = unwrap_lit.node {
|
||||
suggest_is_some_and = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
// is_some_and is stabilised && `unwrap_or` argument is false; suggest `is_some_and` instead
|
||||
let suggest_is_some_and = msrv.meets(msrvs::OPTION_IS_SOME_AND)
|
||||
&& matches!(&unwrap_arg.kind, ExprKind::Lit(lit)
|
||||
if matches!(lit.node, rustc_ast::LitKind::Bool(false)));
|
||||
|
||||
let mut applicability = Applicability::MachineApplicable;
|
||||
// get snippet for unwrap_or()
|
||||
|
@ -19,7 +19,7 @@ macro_rules! msrv_aliases {
|
||||
|
||||
// names may refer to stabilized feature flags or library items
|
||||
msrv_aliases! {
|
||||
1,70,0 { OPT_IS_SOME_AND }
|
||||
1,70,0 { OPTION_IS_SOME_AND }
|
||||
1,68,0 { PATH_MAIN_SEPARATOR_STR }
|
||||
1,65,0 { LET_ELSE, POINTER_CAST_CONSTNESS }
|
||||
1,62,0 { BOOL_THEN_SOME, DEFAULT_ENUM_ATTRIBUTE }
|
||||
|
Loading…
Reference in New Issue
Block a user