Skip to content

Commit

Permalink
apply manual_contains to Clippy sources
Browse files Browse the repository at this point in the history
  • Loading branch information
lapla-cogito committed Feb 11, 2025
1 parent 45b16c6 commit f68b292
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion clippy_lints/src/booleans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ impl<'tcx> NonminimalBoolVisitor<'_, 'tcx> {
_ => simplified.push(Bool::Not(Box::new(simple.clone()))),
}
let simple_negated = simple_negate(simple);
if simplified.iter().any(|s| *s == simple_negated) {
if simplified.contains(&simple_negated) {
continue;
}
simplified.push(simple_negated);
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/casts/cast_sign_loss.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,11 @@ fn expr_sign<'cx, 'tcx>(cx: &LateContext<'cx>, mut expr: &'tcx Expr<'tcx>, ty: i
expr = recv;
}

if METHODS_POW.iter().any(|&name| method_name == name)
if METHODS_POW.contains(&method_name)
&& let [arg] = args
{
return pow_call_result_sign(cx, caller, arg);
} else if METHODS_RET_POSITIVE.iter().any(|&name| method_name == name) {
} else if METHODS_RET_POSITIVE.contains(&method_name) {
return Sign::ZeroOrPositive;
}
}
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/size_of_in_element_count.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ fn get_pointee_ty_and_count_expr<'tcx>(
if let ExprKind::MethodCall(method_path, ptr_self, [.., count], _) = expr.kind
// Find calls to copy_{from,to}{,_nonoverlapping}
&& let method_ident = method_path.ident.as_str()
&& METHODS.iter().any(|m| *m == method_ident)
&& METHODS.contains(&method_ident)

// Get the pointee type
&& let ty::RawPtr(pointee_ty, _) =
Expand Down

0 comments on commit f68b292

Please sign in to comment.