diff --git a/clippy_lints/src/transmute.rs b/clippy_lints/src/transmute.rs index 7d707b8a0c8..f077c146183 100644 --- a/clippy_lints/src/transmute.rs +++ b/clippy_lints/src/transmute.rs @@ -640,7 +640,7 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, e: &'tcx Expr<'_>) { |diag| { if let Some(arg) = sugg::Sugg::hir_opt(cx, &args[0]) { let sugg = arg.as_ty(&to_ty.to_string()).to_string(); - diag.span_suggestion(e.span, "try", sugg, Applicability::Unspecified); + diag.span_suggestion(e.span, "try", sugg, Applicability::MachineApplicable); } } ), @@ -694,7 +694,7 @@ fn is_layout_incompatible<'tcx>(cx: &LateContext<'tcx>, from: Ty<'tcx>, to: Ty<' } } -/// Check if the the type conversion can be expressed as a pointer cast, instead of +/// Check if the type conversion can be expressed as a pointer cast, instead of /// a transmute. In certain cases, including some invalid casts from array /// references to pointers, this may cause additional errors to be emitted and/or /// ICE error messages. This function will panic if that occurs. diff --git a/tests/ui/transmutes_expressible_as_ptr_casts.rs b/tests/ui/transmutes_expressible_as_ptr_casts.rs index 7e99c928359..2693094ba6c 100644 --- a/tests/ui/transmutes_expressible_as_ptr_casts.rs +++ b/tests/ui/transmutes_expressible_as_ptr_casts.rs @@ -1,3 +1,4 @@ +// run-rustfix #![warn(clippy::transmutes_expressible_as_ptr_casts)] // These two warnings currrently cover the cases transmutes_expressible_as_ptr_casts // would otherwise be responsible for