Skip to content

Commit c499a24

Browse files
committed
apply suggestion
1 parent 0abd167 commit c499a24

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

compiler/rustc_mir_transform/src/check_unnecessary_transmutes.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,8 @@ impl<'tcx> Visitor<'tcx> for UnnecessaryTransmuteChecker<'_, 'tcx> {
9292
self.tcx.sess.source_map().span_to_snippet(arg).expect("ok"),
9393
span,
9494
)
95-
&& let Some(call_id) = self.body.source.def_id().as_local()
95+
&& let Some(hir_id) = terminator.source_info.scope.lint_root(&self.body.source_scopes)
9696
{
97-
let hir_id = self.tcx.local_def_id_to_hir_id(call_id);
98-
9997
self.tcx.emit_node_span_lint(UNNECESSARY_TRANSMUTATE, hir_id, span, lint);
10098
}
10199
}

tests/ui/transmute/redundant-transmutation.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ note: the lint level is defined here
99
--> $DIR/redundant-transmutation.rs:2:9
1010
|
1111
LL | #![deny(unnecessary_transmutate)]
12-
| ^^^^^^^^^^^^^^^^^^^^^^^^^
12+
| ^^^^^^^^^^^^^^^^^^^^^^^
1313

1414
error: unnecessary transmute
1515
--> $DIR/redundant-transmutation.rs:13:22

0 commit comments

Comments
 (0)