reformat with rustfmt 1.71

This commit is contained in:
Pascal Kuthe 2023-08-27 17:22:21 +02:00
parent b38fdfa8d7
commit 14014ed883
No known key found for this signature in database
GPG Key ID: D715E8655AE166A6
5 changed files with 16 additions and 11 deletions

View File

@ -23,11 +23,7 @@ impl Matcher {
// us to treat needle indices as u16
let Some(mut matrix) = self.slab.alloc(&haystack[start..end], needle.len()) else {
return self.fuzzy_match_greedy_::<INDICES, H, N>(
haystack,
needle,
start,
greedy_end,
indices,
haystack, needle, start, greedy_end, indices,
);
};
@ -339,7 +335,7 @@ impl<H: Char> MatcherDataView<'_, H> {
}
let next_matched = row[col as usize].get(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;
};
col += row_off - next_row_off;

View File

@ -148,7 +148,7 @@ impl MatrixSlab {
let layout = Layout::new::<MatcherData>();
// safety: the matrix is never zero sized (hardcoded constants)
let ptr = unsafe { alloc_zeroed(layout) };
let Some(ptr) = NonNull::new(ptr) else{
let Some(ptr) = NonNull::new(ptr) else {
handle_alloc_error(layout)
};
MatrixSlab(ptr.cast())

View File

@ -278,7 +278,10 @@ impl<T: Sync + Send + 'static> Nucleo<T> {
} else {
let Some(worker) = self.worker.try_lock_arc_for(Duration::from_millis(timeout)) else {
self.should_notify.store(true, Ordering::Release);
return Status{ changed: false, running: true };
return Status {
changed: false,
running: true,
};
};
worker
};

View File

@ -102,14 +102,20 @@ impl<T: Sync + Send + 'static> Worker<T> {
let Some(item) = item else {
in_flight.lock().push(idx);
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) {
return Match { score: 0, idx };
}
let Some(score) = pattern.score(item.matcher_columns, matchers.get()) else {
unmatched.fetch_add(1, atomic::Ordering::Relaxed);
return Match { score: 0, idx: u32::MAX };
return Match {
score: 0,
idx: u32::MAX,
};
};
Match { score, idx }
});