Skip to content

Commit 4caa00d

Browse files
committed
Rename contains_adt to contains_adt_constructor
1 parent 6181a4b commit 4caa00d

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

clippy_lints/src/methods/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ mod zst_offset;
6161

6262
use bind_instead_of_map::BindInsteadOfMap;
6363
use clippy_utils::diagnostics::{span_lint, span_lint_and_help};
64-
use clippy_utils::ty::{contains_adt, contains_ty, implements_trait, is_copy, is_type_diagnostic_item};
64+
use clippy_utils::ty::{contains_adt_constructor, contains_ty, implements_trait, is_copy, is_type_diagnostic_item};
6565
use clippy_utils::{
6666
contains_return, get_trait_def_id, in_macro, iter_input_pats, match_qpath, method_calls, paths, return_ty,
6767
SpanlessEq,
@@ -1919,7 +1919,7 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
19191919

19201920
// walk the return type and check for Self (this does not check associated types)
19211921
if let Some(self_adt) = self_ty.ty_adt_def() {
1922-
if contains_adt(ret_ty, self_adt) {
1922+
if contains_adt_constructor(ret_ty, self_adt) {
19231923
return;
19241924
}
19251925
} else if contains_ty(ret_ty, self_ty) {
@@ -1933,7 +1933,7 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
19331933
if let ty::PredicateKind::Projection(projection_predicate) = predicate.kind().skip_binder() {
19341934
// walk the associated type and check for Self
19351935
if let Some(self_adt) = self_ty.ty_adt_def() {
1936-
if contains_adt(projection_predicate.ty, self_adt) {
1936+
if contains_adt_constructor(projection_predicate.ty, self_adt) {
19371937
return;
19381938
}
19391939
} else if contains_ty(projection_predicate.ty, self_ty) {

clippy_utils/src/ty.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ pub fn contains_ty(ty: Ty<'_>, other_ty: Ty<'_>) -> bool {
4343
})
4444
}
4545

46-
/// Walks into `ty` and returns `true` if any inner type is any instance of the given abstract data
47-
/// type.`
48-
pub fn contains_adt(ty: Ty<'_>, adt: &AdtDef) -> bool {
46+
/// Walks into `ty` and returns `true` if any inner type is an instance of the given adt
47+
/// constructor.
48+
pub fn contains_adt_constructor(ty: Ty<'_>, adt: &AdtDef) -> bool {
4949
ty.walk().any(|inner| match inner.unpack() {
5050
GenericArgKind::Type(inner_ty) => inner_ty.ty_adt_def() == Some(adt),
5151
GenericArgKind::Lifetime(_) | GenericArgKind::Const(_) => false,

0 commit comments

Comments
 (0)