11use crate :: utils:: {
2- is_type_diagnostic_item, match_def_path, match_trait_method, paths, same_tys , snippet, snippet_with_macro_callsite,
2+ is_type_diagnostic_item, match_def_path, match_trait_method, paths, snippet, snippet_with_macro_callsite,
33 span_lint_and_help, span_lint_and_sugg,
44} ;
55use if_chain:: if_chain;
66use rustc_errors:: Applicability ;
77use rustc_hir:: { Expr , ExprKind , HirId , MatchSource } ;
88use rustc_lint:: { LateContext , LateLintPass } ;
9- use rustc_middle:: ty;
9+ use rustc_middle:: ty:: { self , TyS } ;
1010use rustc_session:: { declare_tool_lint, impl_lint_pass} ;
1111
1212declare_clippy_lint ! {
@@ -65,7 +65,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UselessConversion {
6565 if match_trait_method ( cx, e, & paths:: INTO ) && & * name. ident . as_str ( ) == "into" {
6666 let a = cx. tables . expr_ty ( e) ;
6767 let b = cx. tables . expr_ty ( & args[ 0 ] ) ;
68- if same_tys ( cx , a, b) {
68+ if TyS :: same_type ( a, b) {
6969 let sugg = snippet_with_macro_callsite ( cx, args[ 0 ] . span , "<expr>" ) . to_string ( ) ;
7070 span_lint_and_sugg (
7171 cx,
@@ -81,7 +81,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UselessConversion {
8181 if match_trait_method ( cx, e, & paths:: INTO_ITERATOR ) && & * name. ident . as_str ( ) == "into_iter" {
8282 let a = cx. tables . expr_ty ( e) ;
8383 let b = cx. tables . expr_ty ( & args[ 0 ] ) ;
84- if same_tys ( cx , a, b) {
84+ if TyS :: same_type ( a, b) {
8585 let sugg = snippet ( cx, args[ 0 ] . span , "<expr>" ) . into_owned ( ) ;
8686 span_lint_and_sugg (
8787 cx,
@@ -101,7 +101,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UselessConversion {
101101 if is_type_diagnostic_item( cx, a, sym!( result_type) ) ;
102102 if let ty:: Adt ( _, substs) = a. kind;
103103 if let Some ( a_type) = substs. types( ) . next( ) ;
104- if same_tys ( cx , a_type, b) ;
104+ if TyS :: same_type ( a_type, b) ;
105105
106106 then {
107107 span_lint_and_help(
@@ -131,7 +131,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UselessConversion {
131131 if is_type_diagnostic_item( cx, a, sym!( result_type) ) ;
132132 if let ty:: Adt ( _, substs) = a. kind;
133133 if let Some ( a_type) = substs. types( ) . next( ) ;
134- if same_tys ( cx , a_type, b) ;
134+ if TyS :: same_type ( a_type, b) ;
135135
136136 then {
137137 let hint = format!( "consider removing `{}()`" , snippet( cx, path. span, "TryFrom::try_from" ) ) ;
@@ -148,7 +148,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UselessConversion {
148148
149149 if_chain! {
150150 if match_def_path( cx, def_id, & paths:: FROM_FROM ) ;
151- if same_tys ( cx , a, b) ;
151+ if TyS :: same_type ( a, b) ;
152152
153153 then {
154154 let sugg = snippet( cx, args[ 0 ] . span. source_callsite( ) , "<expr>" ) . into_owned( ) ;
0 commit comments