Remove unwrap_none/expect_none from compiler/.
This commit is contained in:
parent
895a8e71b1
commit
cfb4ad4f2a
10 changed files with 38 additions and 23 deletions
|
@ -118,7 +118,8 @@ impl ExpnId {
|
|||
HygieneData::with(|data| {
|
||||
let old_expn_data = &mut data.expn_data[self.0 as usize];
|
||||
assert!(old_expn_data.is_none(), "expansion data is reset for an expansion ID");
|
||||
expn_data.orig_id.replace(self.as_u32()).expect_none("orig_id should be None");
|
||||
assert_eq!(expn_data.orig_id, None);
|
||||
expn_data.orig_id = Some(self.as_u32());
|
||||
*old_expn_data = Some(expn_data);
|
||||
});
|
||||
update_disambiguator(self)
|
||||
|
@ -202,7 +203,8 @@ impl HygieneData {
|
|||
fn fresh_expn(&mut self, mut expn_data: Option<ExpnData>) -> ExpnId {
|
||||
let raw_id = self.expn_data.len() as u32;
|
||||
if let Some(data) = expn_data.as_mut() {
|
||||
data.orig_id.replace(raw_id).expect_none("orig_id should be None");
|
||||
assert_eq!(data.orig_id, None);
|
||||
data.orig_id = Some(raw_id);
|
||||
}
|
||||
self.expn_data.push(expn_data);
|
||||
ExpnId(raw_id)
|
||||
|
@ -1410,9 +1412,11 @@ fn update_disambiguator(expn_id: ExpnId) {
|
|||
let new_hash: Fingerprint = hasher.finish();
|
||||
|
||||
HygieneData::with(|data| {
|
||||
data.expn_data_disambiguators
|
||||
.get(&new_hash)
|
||||
.expect_none("Hash collision after disambiguator update!");
|
||||
assert_eq!(
|
||||
data.expn_data_disambiguators.get(&new_hash),
|
||||
None,
|
||||
"Hash collision after disambiguator update!",
|
||||
);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue