Skip to content

Commit

Permalink
Merge pull request #47 from artichoke/fix-unwrap-pre-release-check
Browse files Browse the repository at this point in the history
Replace a missed unwrap with an ExpectedConstant error
  • Loading branch information
lopopolo authored Jun 14, 2020
2 parents 06d668d + dae66ac commit 7dea74a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,9 @@ pub fn decode<T: AsRef<[u8]>>(encoded: T) -> Result<Vec<u8>, DecodeError> {
return Err(DecodeError::ChecksumMismatch);
}
} else {
let b = CONSONANTS.find_byte(*mid).unwrap() as u8;
let b = CONSONANTS
.find_byte(*mid)
.ok_or(DecodeError::ExpectedConsonant)? as u8;
decoded.push(decode_3_tuple(a, b, c, checksum)?);
}
Ok(decoded)
Expand Down

0 comments on commit 7dea74a

Please sign in to comment.