Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
junkurihara committed Jul 3, 2023
1 parent 670170f commit 1247336
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
5 changes: 3 additions & 2 deletions src/dict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ where
fn usize_id_to_bitvec_id(&self, id: &usize) -> IdRep {
let bs_id: BitVec<usize, Msb0> = BitVec::from_element(id.to_owned());
let mut res = BVRep::new();
res.extend_from_bitslice(&bs_id[bs_id.len() - self.id_bitlen as usize..]);
res.extend_from_bitslice(&bs_id[bs_id.len() - self.id_bitlen..]);
res
}

Expand Down Expand Up @@ -143,7 +143,8 @@ where
#[cfg(test)]
mod tests {
use super::*;
const WORD_STR: &str = "寿限無(じゅげむ)寿限無(じゅげむ)五劫(ごこう)のすりきれ海砂利(かいじゃり)水魚(すいぎょ)の水行末(すいぎょうまつ) ";
const WORD_STR: &str =
"寿限無(じゅげむ)寿限無(じゅげむ)五劫(ごこう)のすりきれ海砂利(かいじゃり)水魚(すいぎょ)の水行末(すいぎょうまつ) ";
const MSG_BYTELEN: usize = 3;
const CODE_BYTELEN: usize = 4;
const DICT_SIZE: usize = 10;
Expand Down
7 changes: 2 additions & 5 deletions src/gd_byte_unit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@ where
C: Code + ByteUnitCode + Clone,
{
pub async fn set_error_alignment(&mut self, mat_slice: &[U8VRep]) -> Result<()> {
ensure!(
mat_slice.len() == self.code.code_byte_len(),
"Invalid matrix size"
);
ensure!(mat_slice.len() == self.code.code_byte_len(), "Invalid matrix size");
self.code.set_precoding(mat_slice)
}
}
Expand Down Expand Up @@ -128,7 +125,7 @@ where
bitptr += info_bitlen;
let mut bv = deduped_bs[bitptr..bitptr + dev_bitlen].to_bitvec().clone();
bv.force_align();
((&part).to_owned(), bv.as_raw_slice().to_owned())
(part.to_owned(), bv.as_raw_slice().to_owned())
}
Separator::Deduped => {
let id = deduped_bs[bitptr..bitptr + id_bitlen].to_owned();
Expand Down

0 comments on commit 1247336

Please sign in to comment.