Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
fpoli committed Aug 21, 2023
1 parent 611999b commit afc8019
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 22 deletions.
21 changes: 5 additions & 16 deletions analysis/src/domains/reaching_definitions/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,7 @@ impl<'mir, 'tcx: 'mir> ReachingDefsState<'mir, 'tcx> {
let stmt = &self.mir[location.block].statements[location.statement_index];
if let mir::StatementKind::Assign(box (ref target, _)) = stmt.kind {
if let Some(local) = target.as_local() {
let location_set = self
.reaching_defs
.entry(local)
.or_default();
let location_set = self.reaching_defs.entry(local).or_default();
location_set.clear();
location_set.insert(DefLocation::Assignment(location));
}
Expand All @@ -134,10 +131,7 @@ impl<'mir, 'tcx: 'mir> ReachingDefsState<'mir, 'tcx> {
if let Some(bb) = target {
let mut dest_state = self.clone();
if let Some(local) = destination.as_local() {
let location_set = dest_state
.reaching_defs
.entry(local)
.or_default();
let location_set = dest_state.reaching_defs.entry(local).or_default();
location_set.clear();
location_set.insert(DefLocation::Assignment(location));
}
Expand All @@ -150,10 +144,8 @@ impl<'mir, 'tcx: 'mir> ReachingDefsState<'mir, 'tcx> {
// while keeping all others
if target.is_some() {
if let Some(local) = destination.as_local() {
let location_set = cleanup_state
.reaching_defs
.entry(local)
.or_default();
let location_set =
cleanup_state.reaching_defs.entry(local).or_default();
location_set.insert(DefLocation::Assignment(location));
}
}
Expand Down Expand Up @@ -182,10 +174,7 @@ impl<'mir, 'tcx: 'mir> AbstractState for ReachingDefsState<'mir, 'tcx> {

fn join(&mut self, other: &Self) {
for (local, other_locations) in other.reaching_defs.iter() {
let location_set = self
.reaching_defs
.entry(*local)
.or_default();
let location_set = self.reaching_defs.entry(*local).or_default();
location_set.extend(other_locations);
}
}
Expand Down
4 changes: 1 addition & 3 deletions analysis/src/pointwise_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,7 @@ impl<'mir, 'tcx: 'mir, S: Serialize> PointwiseState<'mir, 'tcx, S> {
&mut self,
block: mir::BasicBlock,
) -> &mut FxHashMap<mir::BasicBlock, S> {
self.state_after_block
.entry(block)
.or_default()
self.state_after_block.entry(block).or_default()
}

/// Update the state before the `location`.
Expand Down
4 changes: 1 addition & 3 deletions prusti-interface/src/environment/loops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,7 @@ impl ProcedureLoops {
FxHashMap::default();
for (&loop_head, loop_body) in loop_bodies.iter() {
for &block in loop_body.iter() {
let heads_set = enclosing_loop_heads_set
.entry(block)
.or_default();
let heads_set = enclosing_loop_heads_set.entry(block).or_default();
heads_set.insert(loop_head);
}
}
Expand Down

0 comments on commit afc8019

Please sign in to comment.