Skip to content

Commit f6999c6

Browse files
committed
Fixes rust fmt issues
1 parent 257972f commit f6999c6

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

charabia/src/segmenter/german.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ pub struct GermanSegmenter;
1212
static WORDS_FST: Lazy<Fst<&[u8]>> =
1313
Lazy::new(|| Fst::new(&include_bytes!("../../dictionaries/fst/german/words.fst")[..]).unwrap());
1414

15-
static FST_SEGMENTER: Lazy<FstSegmenter> = Lazy::new(|| FstSegmenter::new(&WORDS_FST, Some(4), true));
15+
static FST_SEGMENTER: Lazy<FstSegmenter> =
16+
Lazy::new(|| FstSegmenter::new(&WORDS_FST, Some(4), true));
1617

1718
impl Segmenter for GermanSegmenter {
1819
fn segment_str<'o>(&self, to_segment: &'o str) -> Box<dyn Iterator<Item = &'o str> + 'o> {

charabia/src/segmenter/utils.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@ use fst::raw::{Fst, Output};
33
/// Final-state-transducer (FST) Segmenter
44
pub(crate) struct FstSegmenter<'fst> {
55
words_fst: &'fst Fst<&'fst [u8]>,
6-
min_length: Option<usize>, // Optional minimum length for a word to be segmented
7-
allow_char_split: bool, // Flag to allow or disallow splitting words into characters
6+
min_length: Option<usize>, // Optional minimum length for a word to be segmented
7+
allow_char_split: bool, // Flag to allow or disallow splitting words into characters
88
}
99

1010
impl<'fst> FstSegmenter<'fst> {
11-
pub(crate) fn new(words_fst: &'fst Fst<&'fst [u8]>, min_length: Option<usize>, allow_char_split: bool) -> Self {
11+
pub(crate) fn new(
12+
words_fst: &'fst Fst<&'fst [u8]>,
13+
min_length: Option<usize>,
14+
allow_char_split: bool,
15+
) -> Self {
1216
Self { words_fst, min_length, allow_char_split }
1317
}
1418

@@ -66,7 +70,8 @@ impl<'fst> FstSegmenter<'fst> {
6670

6771
Box::new(iter)
6872
}
69-
}/// find the longest key that is prefix of the given value.
73+
}
74+
/// find the longest key that is prefix of the given value.
7075
#[inline]
7176
fn find_longest_prefix(fst: &Fst<&[u8]>, value: &[u8]) -> Option<(u64, usize)> {
7277
let mut node = fst.root();
@@ -85,4 +90,4 @@ fn find_longest_prefix(fst: &Fst<&[u8]>, value: &[u8]) -> Option<(u64, usize)> {
8590
}
8691
}
8792
last_match
88-
}
93+
}

0 commit comments

Comments
 (0)