Expect instead of else unreachable
This commit is contained in:
parent
c2a6aeea20
commit
1535643929
32
src/api.rs
32
src/api.rs
|
@ -154,11 +154,11 @@ impl<'a> StartInsertState<'a> {
|
|||
for mut doc in docs.into_values() {
|
||||
let buf: iref::IriBuf = doc.contents.iri.key.clone().into();
|
||||
|
||||
if let Some(iribuf) = iri_set.get(&buf) {
|
||||
ids.insert(*iribuf, doc.header.id);
|
||||
} else {
|
||||
unreachable!("Should always be able to insert ID mapping");
|
||||
}
|
||||
let iribuf = iri_set
|
||||
.get(&buf)
|
||||
.expect("Should always be able to insert ID mapping");
|
||||
|
||||
ids.insert(*iribuf, doc.header.id);
|
||||
|
||||
doc.contents.iri.increment();
|
||||
doc.update_in_transaction(&mut tx)?;
|
||||
|
@ -232,11 +232,12 @@ impl<'a> StartInsertState<'a> {
|
|||
let num_updates = docs.len();
|
||||
|
||||
for mut doc in docs.into_values() {
|
||||
if let Some(string) = self.strings.get(doc.contents.string.key.as_str()) {
|
||||
ids.insert(*string, doc.header.id);
|
||||
} else {
|
||||
unreachable!("Should always be able to insert ID mapping");
|
||||
}
|
||||
let string = self
|
||||
.strings
|
||||
.get(doc.contents.string.key.as_str())
|
||||
.expect("Should always be able to insert ID mapping");
|
||||
|
||||
ids.insert(*string, doc.header.id);
|
||||
|
||||
doc.contents.string.increment();
|
||||
doc.update_in_transaction(&mut tx)?;
|
||||
|
@ -320,11 +321,12 @@ impl<'a> StartInsertState<'a> {
|
|||
for mut doc in docs.into_values() {
|
||||
let buf: langtag::LanguageTagBuf = doc.contents.langtag.key.clone().into();
|
||||
|
||||
if let Some(langtag) = self.langtags.get(&buf) {
|
||||
ids.insert(*langtag, doc.header.id);
|
||||
} else {
|
||||
unreachable!("Should always be able to insert ID mapping");
|
||||
}
|
||||
let langtag = self
|
||||
.langtags
|
||||
.get(&buf)
|
||||
.expect("Should always be able to insert ID mapping");
|
||||
|
||||
ids.insert(*langtag, doc.header.id);
|
||||
|
||||
doc.contents.langtag.increment();
|
||||
doc.update_in_transaction(&mut tx)?;
|
||||
|
|
Loading…
Reference in a new issue