Skip to content

Commit

Permalink
clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
liuchengxu committed Apr 30, 2024
1 parent efb3b30 commit f3d26c6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 18 deletions.
6 changes: 3 additions & 3 deletions crates/maple_core/src/searcher/grep/stoppable_searcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ impl StoppableSearchImpl {
let total = search_info.total_matched.fetch_add(1, Ordering::Relaxed);

// Always send over the result when the queue is not yet full.
if total < best_queue_capacity {
return Ok(sender.send(file_result).is_ok());
} else if file_result.rank > *search_info.lowest_rank.read() {
if total < best_queue_capacity
|| file_result.rank > *search_info.lowest_rank.read()
{
// Discontinue if the sender has been dropped.
return Ok(sender.send(file_result).is_ok());
}
Expand Down
21 changes: 6 additions & 15 deletions crates/maple_core/src/stdio_server/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,24 +89,15 @@ impl ProviderSession {
while let Some(event) = origin_provider_event_receiver.recv().await {
tracing::debug!("Recv origin event: {event:?}");

let (should_emit, debounced_event) = match event {
ProviderEvent::OnMove(params) => {
(on_move_timer.should_emit(), ProviderEvent::OnMove(params))
}
ProviderEvent::OnTyped(params) => {
(on_typed_timer.should_emit(), ProviderEvent::OnTyped(params))
}
undebounced_event => (true, undebounced_event),
let should_emit = match &event {
ProviderEvent::OnMove(..) => on_move_timer.should_emit(),
ProviderEvent::OnTyped(..) => on_typed_timer.should_emit(),
_ => true,
};

// Send event after debounce period
if should_emit {
if debounced_provider_event_sender
.send(debounced_event)
.is_err()
{
return;
}
if should_emit && debounced_provider_event_sender.send(event).is_err() {
return;
}
}
});
Expand Down

0 comments on commit f3d26c6

Please sign in to comment.