Simplify instances of Option::map_or(true, …) in Clippy sources
This commit is contained in:
parent
d1688b53f1
commit
ca963b653e
34 changed files with 39 additions and 42 deletions
|
|
@ -30,7 +30,7 @@ pub(super) fn check(
|
|||
.type_dependent_def_id(expr.hir_id)
|
||||
.and_then(|id| cx.tcx.trait_of_item(id))
|
||||
.zip(cx.tcx.lang_items().clone_trait())
|
||||
.map_or(true, |(x, y)| x != y)
|
||||
.is_none_or(|(x, y)| x != y)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4531,7 +4531,7 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
|
|||
&& method_config.output_type.matches(&sig.decl.output)
|
||||
// in case there is no first arg, since we already have checked the number of arguments
|
||||
// it's should be always true
|
||||
&& first_arg_ty_opt.map_or(true, |first_arg_ty| method_config
|
||||
&& first_arg_ty_opt.is_none_or(|first_arg_ty| method_config
|
||||
.self_kind.matches(cx, self_ty, first_arg_ty)
|
||||
)
|
||||
&& fn_header_equals(method_config.fn_header, sig.header)
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'tcx>, a
|
|||
if let hir::ExprKind::Closure(&hir::Closure { body, .. }) = arg.kind {
|
||||
let body = cx.tcx.hir().body(body);
|
||||
let arg_id = body.params[0].pat.hir_id;
|
||||
let mutates_arg = mutated_variables(body.value, cx).map_or(true, |used_mutably| used_mutably.contains(&arg_id));
|
||||
let mutates_arg = mutated_variables(body.value, cx).is_none_or(|used_mutably| used_mutably.contains(&arg_id));
|
||||
let (clone_or_copy_needed, _) = clone_or_copy_needed(cx, body.params[0].pat, body.value);
|
||||
|
||||
let (mut found_mapping, mut found_filtering) = check_expression(cx, arg_id, body.value);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue