]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/transmute/transmute_ptr_to_ptr.rs
remove the `Subst` trait, always use `EarlyBinder`
[rust.git] / clippy_lints / src / transmute / transmute_ptr_to_ptr.rs
index f4e60a3020cf58367976647d181e7333012bbfdb..31a9b69ca15838ad4e4b7719ee52615c2e4a1e81 100644 (file)
@@ -1,5 +1,6 @@
 use super::TRANSMUTE_PTR_TO_PTR;
-use crate::utils::{span_lint_and_then, sugg};
+use clippy_utils::diagnostics::span_lint_and_then;
+use clippy_utils::sugg;
 use rustc_errors::Applicability;
 use rustc_hir::Expr;
 use rustc_lint::LateContext;
@@ -12,7 +13,7 @@ pub(super) fn check<'tcx>(
     e: &'tcx Expr<'_>,
     from_ty: Ty<'tcx>,
     to_ty: Ty<'tcx>,
-    args: &'tcx [Expr<'_>],
+    arg: &'tcx Expr<'_>,
 ) -> bool {
     match (&from_ty.kind(), &to_ty.kind()) {
         (ty::RawPtr(_), ty::RawPtr(to_ty)) => {
@@ -22,9 +23,9 @@ pub(super) fn check<'tcx>(
                 e.span,
                 "transmute from a pointer to a pointer",
                 |diag| {
-                    if let Some(arg) = sugg::Sugg::hir_opt(cx, &args[0]) {
+                    if let Some(arg) = sugg::Sugg::hir_opt(cx, arg) {
                         let sugg = arg.as_ty(cx.tcx.mk_ptr(*to_ty));
-                        diag.span_suggestion(e.span, "try", sugg.to_string(), Applicability::Unspecified);
+                        diag.span_suggestion(e.span, "try", sugg, Applicability::Unspecified);
                     }
                 },
             );