]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/transmute/transmute_int_to_float.rs
Minor cleanup on transmute lints
[rust.git] / clippy_lints / src / transmute / transmute_int_to_float.rs
index c762a7ab885029b5dd44df954454139ff0711acc..b8703052e6c869750a09751579885123c0e1143a 100644 (file)
@@ -1,6 +1,6 @@
 use super::TRANSMUTE_INT_TO_FLOAT;
-use crate::utils::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;
@@ -13,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<'_>,
     const_context: bool,
 ) -> bool {
     match (&from_ty.kind(), &to_ty.kind()) {
@@ -24,7 +24,7 @@ pub(super) fn check<'tcx>(
                 e.span,
                 &format!("transmute from a `{}` to a `{}`", from_ty, to_ty),
                 |diag| {
-                    let arg = sugg::Sugg::hir(cx, &args[0], "..");
+                    let arg = sugg::Sugg::hir(cx, arg, "..");
                     let arg = if let ty::Int(int_ty) = from_ty.kind() {
                         arg.as_ty(format!(
                             "u{}",
@@ -36,7 +36,7 @@ pub(super) fn check<'tcx>(
                     diag.span_suggestion(
                         e.span,
                         "consider using",
-                        format!("{}::from_bits({})", to_ty, arg.to_string()),
+                        format!("{}::from_bits({})", to_ty, arg),
                         Applicability::Unspecified,
                     );
                 },