Replace contains_ty(..) with Ty::contains(..)
This removes some code we don't need and the method syntax is also more readable IMO.
This commit is contained in:
parent
cc637bacfa
commit
a0afbdfbec
6 changed files with 11 additions and 21 deletions
|
|
@ -99,7 +99,7 @@ mod zst_offset;
|
|||
use bind_instead_of_map::BindInsteadOfMap;
|
||||
use clippy_utils::consts::{constant, Constant};
|
||||
use clippy_utils::diagnostics::{span_lint, span_lint_and_help};
|
||||
use clippy_utils::ty::{contains_adt_constructor, contains_ty, implements_trait, is_copy, is_type_diagnostic_item};
|
||||
use clippy_utils::ty::{contains_adt_constructor, implements_trait, is_copy, is_type_diagnostic_item};
|
||||
use clippy_utils::{
|
||||
contains_return, get_trait_def_id, is_trait_method, iter_input_pats, meets_msrv, msrvs, paths, return_ty,
|
||||
};
|
||||
|
|
@ -3242,7 +3242,7 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
|
|||
if contains_adt_constructor(ret_ty, self_adt) {
|
||||
return;
|
||||
}
|
||||
} else if contains_ty(ret_ty, self_ty) {
|
||||
} else if ret_ty.contains(self_ty) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -3260,7 +3260,7 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
|
|||
if contains_adt_constructor(assoc_ty, self_adt) {
|
||||
return;
|
||||
}
|
||||
} else if contains_ty(assoc_ty, self_ty) {
|
||||
} else if assoc_ty.contains(self_ty) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -3309,7 +3309,7 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
|
|||
if let TraitItemKind::Fn(_, _) = item.kind;
|
||||
let ret_ty = return_ty(cx, item.hir_id());
|
||||
let self_ty = TraitRef::identity(cx.tcx, item.def_id.to_def_id()).self_ty().skip_binder();
|
||||
if !contains_ty(ret_ty, self_ty);
|
||||
if !ret_ty.contains(self_ty);
|
||||
|
||||
then {
|
||||
span_lint(
|
||||
|
|
|
|||
|
|
@ -3,8 +3,7 @@ use super::unnecessary_iter_cloned::{self, is_into_iter};
|
|||
use clippy_utils::diagnostics::span_lint_and_sugg;
|
||||
use clippy_utils::source::snippet_opt;
|
||||
use clippy_utils::ty::{
|
||||
contains_ty, get_associated_type, get_iterator_item_ty, implements_trait, is_copy, is_type_diagnostic_item,
|
||||
peel_mid_ty_refs,
|
||||
get_associated_type, get_iterator_item_ty, implements_trait, is_copy, is_type_diagnostic_item, peel_mid_ty_refs,
|
||||
};
|
||||
use clippy_utils::{fn_def_id, get_parent_expr, is_diag_item_method, is_diag_trait_item};
|
||||
use clippy_utils::{meets_msrv, msrvs};
|
||||
|
|
@ -304,7 +303,7 @@ fn check_other_call_arg<'tcx>(
|
|||
// (https://github.com/rust-lang/rust-clippy/issues/8507).
|
||||
if (n_refs == 0 && !receiver_ty.is_ref())
|
||||
|| trait_predicate.def_id() != as_ref_trait_id
|
||||
|| !contains_ty(fn_sig.output(), input);
|
||||
|| !fn_sig.output().contains(input);
|
||||
if let Some(receiver_snippet) = snippet_opt(cx, receiver.span);
|
||||
then {
|
||||
span_lint_and_sugg(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue