diff options
| author | Cameron Steffen <cam.steffen94@gmail.com> | 2022-01-17 12:57:45 -0600 |
|---|---|---|
| committer | Cameron Steffen <cam.steffen94@gmail.com> | 2022-01-28 15:45:41 -0600 |
| commit | 20781f195d205dcc3fa244a659dfc5b3547a87d3 (patch) | |
| tree | 91a43af8d68bc628359d6957686c63ab6e0db8da | |
| parent | bea09a2329676e48ea9f780c47e27d653417a4e3 (diff) | |
| download | rust-20781f195d205dcc3fa244a659dfc5b3547a87d3.tar.gz rust-20781f195d205dcc3fa244a659dfc5b3547a87d3.zip | |
Rename qpath_generic_tys
| -rw-r--r-- | clippy_lints/src/types/rc_buffer.rs | 6 | ||||
| -rw-r--r-- | clippy_lints/src/types/redundant_allocation.rs | 4 | ||||
| -rw-r--r-- | clippy_utils/src/lib.rs | 6 |
3 files changed, 8 insertions, 8 deletions
diff --git a/clippy_lints/src/types/rc_buffer.rs b/clippy_lints/src/types/rc_buffer.rs index 31c4abdfc95..0a2df7d2188 100644 --- a/clippy_lints/src/types/rc_buffer.rs +++ b/clippy_lints/src/types/rc_buffer.rs @@ -1,6 +1,6 @@ use clippy_utils::diagnostics::span_lint_and_sugg; use clippy_utils::source::snippet_with_applicability; -use clippy_utils::{get_qpath_generic_tys, is_ty_param_diagnostic_item}; +use clippy_utils::{is_ty_param_diagnostic_item, qpath_generic_tys}; use rustc_errors::Applicability; use rustc_hir::{self as hir, def_id::DefId, QPath, TyKind}; use rustc_lint::LateContext; @@ -25,7 +25,7 @@ pub(super) fn check(cx: &LateContext<'_>, hir_ty: &hir::Ty<'_>, qpath: &QPath<'_ TyKind::Path(qpath) => qpath, _ => return false, }; - let inner_span = match get_qpath_generic_tys(qpath).next() { + let inner_span = match qpath_generic_tys(qpath).next() { Some(ty) => ty.span, None => return false, }; @@ -60,7 +60,7 @@ pub(super) fn check(cx: &LateContext<'_>, hir_ty: &hir::Ty<'_>, qpath: &QPath<'_ TyKind::Path(qpath) => qpath, _ => return false, }; - let inner_span = match get_qpath_generic_tys(qpath).next() { + let inner_span = match qpath_generic_tys(qpath).next() { Some(ty) => ty.span, None => return false, }; diff --git a/clippy_lints/src/types/redundant_allocation.rs b/clippy_lints/src/types/redundant_allocation.rs index ac7bdd6a1eb..8638197a584 100644 --- a/clippy_lints/src/types/redundant_allocation.rs +++ b/clippy_lints/src/types/redundant_allocation.rs @@ -1,6 +1,6 @@ use clippy_utils::diagnostics::span_lint_and_then; use clippy_utils::source::{snippet, snippet_with_applicability}; -use clippy_utils::{get_qpath_generic_tys, is_ty_param_diagnostic_item, is_ty_param_lang_item}; +use clippy_utils::{is_ty_param_diagnostic_item, is_ty_param_lang_item, qpath_generic_tys}; use rustc_errors::Applicability; use rustc_hir::{self as hir, def_id::DefId, LangItem, QPath, TyKind}; use rustc_lint::LateContext; @@ -53,7 +53,7 @@ pub(super) fn check(cx: &LateContext<'_>, hir_ty: &hir::Ty<'_>, qpath: &QPath<'_ TyKind::Path(inner_qpath) => inner_qpath, _ => return false, }; - let inner_span = match get_qpath_generic_tys(inner_qpath).next() { + let inner_span = match qpath_generic_tys(inner_qpath).next() { Some(ty) => { // Box<Box<dyn T>> is smaller than Box<dyn T> because of wide pointers if matches!(ty.kind, TyKind::TraitObject(..)) { diff --git a/clippy_utils/src/lib.rs b/clippy_utils/src/lib.rs index 8cc4f0449e3..64634c64602 100644 --- a/clippy_utils/src/lib.rs +++ b/clippy_utils/src/lib.rs @@ -268,7 +268,7 @@ pub fn is_ty_param_lang_item<'tcx>( qpath: &QPath<'tcx>, item: LangItem, ) -> Option<&'tcx hir::Ty<'tcx>> { - let ty = get_qpath_generic_tys(qpath).next()?; + let ty = qpath_generic_tys(qpath).next()?; if let TyKind::Path(qpath) = &ty.kind { cx.qpath_res(qpath, ty.hir_id) @@ -288,7 +288,7 @@ pub fn is_ty_param_diagnostic_item<'tcx>( qpath: &QPath<'tcx>, item: Symbol, ) -> Option<&'tcx hir::Ty<'tcx>> { - let ty = get_qpath_generic_tys(qpath).next()?; + let ty = qpath_generic_tys(qpath).next()?; if let TyKind::Path(qpath) = &ty.kind { cx.qpath_res(qpath, ty.hir_id) @@ -368,7 +368,7 @@ pub fn get_qpath_generics<'tcx>(path: &QPath<'tcx>) -> Option<&'tcx GenericArgs< } } -pub fn get_qpath_generic_tys<'tcx>(path: &QPath<'tcx>) -> impl Iterator<Item = &'tcx hir::Ty<'tcx>> { +pub fn qpath_generic_tys<'tcx>(path: &QPath<'tcx>) -> impl Iterator<Item = &'tcx hir::Ty<'tcx>> { get_qpath_generics(path) .map_or([].as_ref(), |a| a.args) .iter() |
