Apply suggestions from code review

Co-authored-by: Philipp Krones <hello@philkrones.com>
This commit is contained in:
Ryan Wiedemann 2020-08-06 07:57:31 -06:00 committed by GitHub
parent 42f3d39a54
commit 49c7e39d03
2 changed files with 3 additions and 2 deletions

View File

@ -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.

View File

@ -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