Skip to content

Commit 04288a6

Browse files
author
Saleem Jaffer
committed
minor
1 parent 90b2b67 commit 04288a6

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

src/librustc/ty/context.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,7 @@ pub struct TypeckTables<'tcx> {
409409
/// MIR construction and hence is not serialized to metadata.
410410
fru_field_types: ItemLocalMap<Vec<Ty<'tcx>>>,
411411

412+
/// For every coercion cast we add the HIR node ID to this set.
412413
coercion_casts: ItemLocalSet,
413414

414415
/// Set of trait imports actually used in the method resolution.
@@ -717,13 +718,10 @@ impl<'tcx> TypeckTables<'tcx> {
717718
}
718719

719720
pub fn is_coercion_cast(&self, hir_id: &hir::HirId) -> bool {
720-
if self.coercion_casts.contains(&hir_id.local_id) {
721-
return true
722-
}
723-
false
721+
self.coercion_casts.contains(&hir_id.local_id)
724722
}
725723

726-
pub fn set_coercion_cast(&mut self, hir_id: &hir::HirId) -> () {
724+
pub fn set_coercion_cast(&mut self, hir_id: &hir::HirId) {
727725
self.coercion_casts.insert(hir_id.local_id);
728726
}
729727

src/librustc_mir/hair/cx/expr.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -655,8 +655,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
655655

656656
// Check to see if this cast is a "coercion cast", where the cast is actually done
657657
// using a coercion (or is a no-op).
658-
let cast = if cx.tables().is_coercion_cast(&source.hir_id)
659-
{
658+
let cast = if cx.tables().is_coercion_cast(&source.hir_id) {
660659
// Convert the lexpr to a vexpr.
661660
ExprKind::Use { source: source.to_ref() }
662661
} else {

0 commit comments

Comments
 (0)