mirror of
https://github.com/solaeus/nucleo.git
synced 2024-12-22 01:47:49 +00:00
reformat with rustfmt 1.71
This commit is contained in:
parent
b38fdfa8d7
commit
14014ed883
@ -21,7 +21,7 @@ impl Matcher {
|
|||||||
if c.normalize(&self.config) == needle_char {
|
if c.normalize(&self.config) == needle_char {
|
||||||
let Some(next_needle_char) = needle_iter.next() else {
|
let Some(next_needle_char) = needle_iter.next() else {
|
||||||
// we found a match so we are now in the same state
|
// we found a match so we are now in the same state
|
||||||
// as the prefilter would produce
|
// as the prefilter would produce
|
||||||
end = first_char_end + i + 1;
|
end = first_char_end + i + 1;
|
||||||
break 'nonascii;
|
break 'nonascii;
|
||||||
};
|
};
|
||||||
|
@ -23,11 +23,7 @@ impl Matcher {
|
|||||||
// us to treat needle indices as u16
|
// us to treat needle indices as u16
|
||||||
let Some(mut matrix) = self.slab.alloc(&haystack[start..end], needle.len()) else {
|
let Some(mut matrix) = self.slab.alloc(&haystack[start..end], needle.len()) else {
|
||||||
return self.fuzzy_match_greedy_::<INDICES, H, N>(
|
return self.fuzzy_match_greedy_::<INDICES, H, N>(
|
||||||
haystack,
|
haystack, needle, start, greedy_end, indices,
|
||||||
needle,
|
|
||||||
start,
|
|
||||||
greedy_end,
|
|
||||||
indices,
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -339,7 +335,7 @@ impl<H: Char> MatcherDataView<'_, H> {
|
|||||||
}
|
}
|
||||||
let next_matched = row[col as usize].get(matched);
|
let next_matched = row[col as usize].get(matched);
|
||||||
if matched {
|
if matched {
|
||||||
let Some((next_row_idx, next_row_off, next_row)) = row_iter.next() else{
|
let Some((next_row_idx, next_row_off, next_row)) = row_iter.next() else {
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
col += row_off - next_row_off;
|
col += row_off - next_row_off;
|
||||||
|
@ -148,7 +148,7 @@ impl MatrixSlab {
|
|||||||
let layout = Layout::new::<MatcherData>();
|
let layout = Layout::new::<MatcherData>();
|
||||||
// safety: the matrix is never zero sized (hardcoded constants)
|
// safety: the matrix is never zero sized (hardcoded constants)
|
||||||
let ptr = unsafe { alloc_zeroed(layout) };
|
let ptr = unsafe { alloc_zeroed(layout) };
|
||||||
let Some(ptr) = NonNull::new(ptr) else{
|
let Some(ptr) = NonNull::new(ptr) else {
|
||||||
handle_alloc_error(layout)
|
handle_alloc_error(layout)
|
||||||
};
|
};
|
||||||
MatrixSlab(ptr.cast())
|
MatrixSlab(ptr.cast())
|
||||||
|
@ -278,7 +278,10 @@ impl<T: Sync + Send + 'static> Nucleo<T> {
|
|||||||
} else {
|
} else {
|
||||||
let Some(worker) = self.worker.try_lock_arc_for(Duration::from_millis(timeout)) else {
|
let Some(worker) = self.worker.try_lock_arc_for(Duration::from_millis(timeout)) else {
|
||||||
self.should_notify.store(true, Ordering::Release);
|
self.should_notify.store(true, Ordering::Release);
|
||||||
return Status{ changed: false, running: true };
|
return Status {
|
||||||
|
changed: false,
|
||||||
|
running: true,
|
||||||
|
};
|
||||||
};
|
};
|
||||||
worker
|
worker
|
||||||
};
|
};
|
||||||
|
@ -102,14 +102,20 @@ impl<T: Sync + Send + 'static> Worker<T> {
|
|||||||
let Some(item) = item else {
|
let Some(item) = item else {
|
||||||
in_flight.lock().push(idx);
|
in_flight.lock().push(idx);
|
||||||
unmatched.fetch_add(1, atomic::Ordering::Relaxed);
|
unmatched.fetch_add(1, atomic::Ordering::Relaxed);
|
||||||
return Match { score: 0, idx: u32::MAX };
|
return Match {
|
||||||
|
score: 0,
|
||||||
|
idx: u32::MAX,
|
||||||
|
};
|
||||||
};
|
};
|
||||||
if self.canceled.load(atomic::Ordering::Relaxed) {
|
if self.canceled.load(atomic::Ordering::Relaxed) {
|
||||||
return Match { score: 0, idx };
|
return Match { score: 0, idx };
|
||||||
}
|
}
|
||||||
let Some(score) = pattern.score(item.matcher_columns, matchers.get()) else {
|
let Some(score) = pattern.score(item.matcher_columns, matchers.get()) else {
|
||||||
unmatched.fetch_add(1, atomic::Ordering::Relaxed);
|
unmatched.fetch_add(1, atomic::Ordering::Relaxed);
|
||||||
return Match { score: 0, idx: u32::MAX };
|
return Match {
|
||||||
|
score: 0,
|
||||||
|
idx: u32::MAX,
|
||||||
|
};
|
||||||
};
|
};
|
||||||
Match { score, idx }
|
Match { score, idx }
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user