mirror of
https://github.com/rust-lang/rust-clippy
synced 2025-02-17 14:38:46 +00:00
dogfood inverse bool_to_int_with_if
This commit is contained in:
parent
1eb41804a2
commit
9925600870
3 changed files with 4 additions and 7 deletions
|
@ -297,13 +297,10 @@ impl<'tcx> LateLintPass<'tcx> for Dereferencing {
|
|||
if !is_lint_allowed(cx, EXPLICIT_DEREF_METHODS, expr.hir_id)
|
||||
&& position.lint_explicit_deref() =>
|
||||
{
|
||||
let ty_changed_count = usize::from(!deref_method_same_type(expr_ty, typeck.expr_ty(sub_expr)));
|
||||
self.state = Some((
|
||||
State::DerefMethod {
|
||||
ty_changed_count: if deref_method_same_type(expr_ty, typeck.expr_ty(sub_expr)) {
|
||||
0
|
||||
} else {
|
||||
1
|
||||
},
|
||||
ty_changed_count,
|
||||
is_final_ufcs: matches!(expr.kind, ExprKind::Call(..)),
|
||||
target_mut,
|
||||
},
|
||||
|
|
|
@ -269,7 +269,7 @@ fn check_other_call_arg<'tcx>(
|
|||
// We can't add an `&` when the trait is `Deref` because `Target = &T` won't match
|
||||
// `Target = T`.
|
||||
if n_refs > 0 || is_copy(cx, receiver_ty) || trait_predicate.def_id() != deref_trait_id;
|
||||
let n_refs = max(n_refs, if is_copy(cx, receiver_ty) { 0 } else { 1 });
|
||||
let n_refs = max(n_refs, usize::from(!is_copy(cx, receiver_ty)));
|
||||
if let Some(receiver_snippet) = snippet_opt(cx, receiver.span);
|
||||
then {
|
||||
span_lint_and_sugg(
|
||||
|
|
|
@ -274,7 +274,7 @@ impl AsyncLen {
|
|||
}
|
||||
|
||||
pub async fn len(&self) -> usize {
|
||||
if self.async_task().await { 0 } else { 1 }
|
||||
usize::from(!self.async_task().await)
|
||||
}
|
||||
|
||||
pub async fn is_empty(&self) -> bool {
|
||||
|
|
Loading…
Add table
Reference in a new issue