Skip to content

Commit a612173

Browse files
committed
remove expect() in unnecessary_transmutes
1 parent 862156d commit a612173

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compiler/rustc_mir_transform/src/check_unnecessary_transmutes.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ impl<'a, 'tcx> UnnecessaryTransmuteChecker<'a, 'tcx> {
2727
fn is_unnecessary_transmute(
2828
&self,
2929
function: &Operand<'tcx>,
30-
arg: String,
30+
arg: &str,
3131
span: Span,
3232
) -> Option<Error> {
3333
let fn_sig = function.ty(self.body, self.tcx).fn_sig(self.tcx).skip_binder();
@@ -89,7 +89,7 @@ impl<'tcx> Visitor<'tcx> for UnnecessaryTransmuteChecker<'_, 'tcx> {
8989
&& let span = self.body.source_info(location).span
9090
&& let Some(lint) = self.is_unnecessary_transmute(
9191
func,
92-
self.tcx.sess.source_map().span_to_snippet(arg).expect("ok"),
92+
self.tcx.sess.source_map().span_to_snippet(arg).as_deref().unwrap_or("…"),
9393
span,
9494
)
9595
&& let Some(hir_id) = terminator.source_info.scope.lint_root(&self.body.source_scopes)

0 commit comments

Comments
 (0)