|
1 | 1 | use clippy_utils::diagnostics::{span_lint_and_help, span_lint_and_sugg};
|
| 2 | +use clippy_utils::is_ty_alias; |
2 | 3 | use clippy_utils::source::{snippet, snippet_with_context};
|
3 | 4 | use clippy_utils::sugg::Sugg;
|
4 | 5 | use clippy_utils::ty::{is_copy, is_type_diagnostic_item, same_type_and_consts};
|
5 | 6 | use clippy_utils::{get_parent_expr, is_trait_method, match_def_path, path_to_local, paths};
|
6 | 7 | use if_chain::if_chain;
|
7 | 8 | use rustc_errors::Applicability;
|
8 |
| -use rustc_hir::def::{DefKind, Res}; |
9 |
| -use rustc_hir::{BindingAnnotation, Expr, ExprKind, HirId, MatchSource, Node, PatKind, QPath, TyKind}; |
| 9 | +use rustc_hir::{BindingAnnotation, Expr, ExprKind, HirId, MatchSource, Node, PatKind}; |
10 | 10 | use rustc_lint::{LateContext, LateLintPass};
|
11 | 11 | use rustc_middle::ty;
|
12 | 12 | use rustc_session::{declare_tool_lint, impl_lint_pass};
|
@@ -197,12 +197,3 @@ impl<'tcx> LateLintPass<'tcx> for UselessConversion {
|
197 | 197 | }
|
198 | 198 | }
|
199 | 199 | }
|
200 |
| - |
201 |
| -/// `cx.qpath_res` seems to return `AssocFn` so we do this instead |
202 |
| -fn is_ty_alias(qpath: &QPath<'_>) -> bool { |
203 |
| - match *qpath { |
204 |
| - QPath::Resolved(_, path) => matches!(path.res, Res::Def(DefKind::TyAlias, ..)), |
205 |
| - QPath::TypeRelative(ty, _) if let TyKind::Path(qpath) = ty.kind => is_ty_alias(&qpath), |
206 |
| - _ => false, |
207 |
| - } |
208 |
| -} |
0 commit comments