Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoxc committed Mar 18, 2024
1 parent 9e3a20d commit 23f65b6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 33 deletions.
6 changes: 1 addition & 5 deletions src/concurrency/data_race.rs
Original file line number Diff line number Diff line change
Expand Up @@ -564,11 +564,7 @@ impl MemoryCellClocks {
true
};
self.read.set_at_index(&thread_clocks.clock, index);
if race_free {
Ok(())
} else {
Err(DataRace)
}
if race_free { Ok(()) } else { Err(DataRace) }
} else {
Err(DataRace)
}
Expand Down
34 changes: 15 additions & 19 deletions src/concurrency/vector_clock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,7 @@ impl VTimestamp {
}

pub fn read_type(&self) -> NaReadType {
if self.time_and_read_type & 1 == 0 {
NaReadType::Read
} else {
NaReadType::Retag
}
if self.time_and_read_type & 1 == 0 { NaReadType::Read } else { NaReadType::Retag }
}

pub fn set_read_type(&mut self, read_type: NaReadType) {
Expand Down Expand Up @@ -236,16 +232,14 @@ impl PartialOrd for VClock {
for (l, r) in iter {
match order {
Ordering::Equal => order = l.cmp(r),
Ordering::Less => {
Ordering::Less =>
if l > r {
return None;
}
}
Ordering::Greater => {
},
Ordering::Greater =>
if l < r {
return None;
}
}
},
}
}

Expand All @@ -260,16 +254,18 @@ impl PartialOrd for VClock {
Ordering::Equal => Some(order),
// Right has at least 1 element > than the implicit 0,
// so the only valid values are Ordering::Less or None.
Ordering::Less => match order {
Ordering::Less | Ordering::Equal => Some(Ordering::Less),
Ordering::Greater => None,
},
Ordering::Less =>
match order {
Ordering::Less | Ordering::Equal => Some(Ordering::Less),
Ordering::Greater => None,
},
// Left has at least 1 element > than the implicit 0,
// so the only valid values are Ordering::Greater or None.
Ordering::Greater => match order {
Ordering::Greater | Ordering::Equal => Some(Ordering::Greater),
Ordering::Less => None,
},
Ordering::Greater =>
match order {
Ordering::Greater | Ordering::Equal => Some(Ordering::Greater),
Ordering::Less => None,
},
}
}

Expand Down
15 changes: 6 additions & 9 deletions src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,10 @@ pub fn report_error<'tcx, 'mir>(
let title = match info {
Exit { code, leak_check } => return Some((*code, *leak_check)),
Abort(_) => Some("abnormal termination"),
UnsupportedInIsolation(_) | Int2PtrWithStrictProvenance => {
Some("unsupported operation")
}
StackedBorrowsUb { .. } | TreeBorrowsUb { .. } | DataRace { .. } => {
Some("Undefined Behavior")
}
UnsupportedInIsolation(_) | Int2PtrWithStrictProvenance =>
Some("unsupported operation"),
StackedBorrowsUb { .. } | TreeBorrowsUb { .. } | DataRace { .. } =>
Some("Undefined Behavior"),
Deadlock => Some("deadlock"),
MultipleSymbolDefinitions { .. } | SymbolShimClashing { .. } => None,
};
Expand Down Expand Up @@ -536,9 +534,8 @@ impl<'mir, 'tcx> MiriMachine<'mir, 'tcx> {
let (stacktrace, _was_pruned) = prune_stacktrace(stacktrace, self);

let (title, diag_level) = match &e {
RejectedIsolatedOp(_) => {
("operation rejected by isolation".to_string(), DiagLevel::Warning)
}
RejectedIsolatedOp(_) =>
("operation rejected by isolation".to_string(), DiagLevel::Warning),
Int2Ptr { .. } => ("integer-to-pointer cast".to_string(), DiagLevel::Warning),
CreatedPointerTag(..)
| PoppedPointerTag(..)
Expand Down

0 comments on commit 23f65b6

Please sign in to comment.