Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use expects() more appropriately #504

Merged
merged 2 commits into from
Aug 3, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/engine/strat_engine/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ impl StratPool {

pub fn check(&mut self) -> () {
#![allow(match_same_arms)]
let dm = DM::new().expect("Could not get DM handle");
let dm = DM::new().unwrap();

let result = match self.thin_pool.check(&dm) {
Ok(r) => r,
Expand Down
12 changes: 9 additions & 3 deletions src/engine/strat_engine/range_alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,22 @@ impl RangeAllocator {
(None, Some((next_off, next_len))) => {
// Contig with next, make new entry
self.used.insert(off, len + next_len);
self.used.remove(&next_off).expect("must exist");
self.used
.remove(&next_off)
.expect("matched Some((next_off, ...");
}
(Some((prev_off, prev_len)), None) => {
// Contig with prev, just extend prev
*self.used.get_mut(&prev_off).expect("must exist") = prev_len + len;
*self.used
.get_mut(&prev_off)
.expect("matched Some((prev_off, ...") = prev_len + len;
}
(Some((prev_off, prev_len)), Some((next_off, next_len))) => {
// Contig with both, remove next and extend prev
self.used.remove(&next_off);
*self.used.get_mut(&prev_off).expect("must exist") = prev_len + len + next_len;
*self.used
.get_mut(&prev_off)
.expect("matched Some((prev_off, ...") = prev_len + len + next_len;
}
}
}
Expand Down