Use Option::is_some_and
and Result::is_ok_and
in the compiler
This commit is contained in:
parent
70db836922
commit
fb0f74a8c9
87 changed files with 148 additions and 158 deletions
|
@ -1816,7 +1816,7 @@ impl CheckAttrVisitor<'_> {
|
|||
|| (is_simd && is_c)
|
||||
|| (int_reprs == 1
|
||||
&& is_c
|
||||
&& item.map_or(false, |item| {
|
||||
&& item.is_some_and(|item| {
|
||||
if let ItemLike::Item(item) = item {
|
||||
return is_c_like_enum(item);
|
||||
}
|
||||
|
@ -2095,7 +2095,7 @@ impl CheckAttrVisitor<'_> {
|
|||
| sym::feature
|
||||
| sym::repr
|
||||
| sym::target_feature
|
||||
) && attr.meta_item_list().map_or(false, |list| list.is_empty())
|
||||
) && attr.meta_item_list().is_some_and(|list| list.is_empty())
|
||||
{
|
||||
errors::UnusedNote::EmptyList { name: attr.name_or_empty() }
|
||||
} else if matches!(
|
||||
|
|
|
@ -554,10 +554,8 @@ impl<'tcx> MissingStabilityAnnotations<'tcx> {
|
|||
|
||||
let is_const = self.tcx.is_const_fn(def_id.to_def_id())
|
||||
|| self.tcx.is_const_trait_impl_raw(def_id.to_def_id());
|
||||
let is_stable = self
|
||||
.tcx
|
||||
.lookup_stability(def_id)
|
||||
.map_or(false, |stability| stability.level.is_stable());
|
||||
let is_stable =
|
||||
self.tcx.lookup_stability(def_id).is_some_and(|stability| stability.level.is_stable());
|
||||
let missing_const_stability_attribute = self.tcx.lookup_const_stability(def_id).is_none();
|
||||
let is_reachable = self.effective_visibilities.is_reachable(def_id);
|
||||
|
||||
|
@ -772,7 +770,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'tcx> {
|
|||
// needs to have an error emitted.
|
||||
if features.const_trait_impl
|
||||
&& *constness == hir::Constness::Const
|
||||
&& const_stab.map_or(false, |(stab, _)| stab.is_const_stable())
|
||||
&& const_stab.is_some_and(|(stab, _)| stab.is_const_stable())
|
||||
{
|
||||
self.tcx.sess.emit_err(errors::TraitImplConstStable { span: item.span });
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue