Skip to content

Commit bcee07e

Browse files
committed
Add Mutability::{is_mut,is_not}
1 parent d3817e2 commit bcee07e

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/constant.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,9 @@ pub(crate) fn data_id_for_alloc_id(
257257
mutability: rustc_hir::Mutability,
258258
) -> DataId {
259259
cx.todo.push(TodoItem::Alloc(alloc_id));
260-
*cx.anon_allocs.entry(alloc_id).or_insert_with(|| {
261-
module.declare_anonymous_data(mutability == rustc_hir::Mutability::Mut, false).unwrap()
262-
})
260+
*cx.anon_allocs
261+
.entry(alloc_id)
262+
.or_insert_with(|| module.declare_anonymous_data(mutability.is_mut(), false).unwrap())
263263
}
264264

265265
fn data_id_for_static(
@@ -343,12 +343,7 @@ fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut dyn Module, cx: &mut Constant
343343
}
344344
};
345345
let data_id = *cx.anon_allocs.entry(alloc_id).or_insert_with(|| {
346-
module
347-
.declare_anonymous_data(
348-
alloc.inner().mutability == rustc_hir::Mutability::Mut,
349-
false,
350-
)
351-
.unwrap()
346+
module.declare_anonymous_data(alloc.inner().mutability.is_mut(), false).unwrap()
352347
});
353348
(data_id, alloc, None)
354349
}

0 commit comments

Comments
 (0)