Skip to content

Commit

Permalink
♻️ 优化写法
Browse files Browse the repository at this point in the history
  • Loading branch information
phidiaLam committed Nov 19, 2024
1 parent 2910e21 commit 551b8b5
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions libs/bitmap-convert/src/base70.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,10 @@ impl BitmapBase70Conv for Bitmap<256> {
for c in string.chars() {
let index = CHAR_TO_INDEX
.get(c as usize)
.copied();
match index.flatten() {
None => return Err(Error::NotConvertBitmap(string.clone())),
Some(i) => bytes.push(i),
}
.copied()
.flatten()
.ok_or(Error::NotConvertBitmap(string.clone()))?;
bytes.push(index);
}
let value = U256::from_radix_le(&bytes, RADIX)
.ok_or_else(|| Error::NotConvertBitmap(string.clone()))?;
Expand Down

0 comments on commit 551b8b5

Please sign in to comment.