Skip to content

Commit

Permalink
Pleasing clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
fulmicoton committed Mar 18, 2022
1 parent 7f0ebdc commit a51f15d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
12 changes: 6 additions & 6 deletions src/core/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -781,24 +781,24 @@ mod tests {
for i in 0u64..8_000u64 {
writer.add_document(doc!(field => i))?;
}
let (sender, receiver) = crossbeam::channel::unbounded();
let _handle = directory.watch(WatchCallback::new(move || {
let _ = sender.send(());
}));

writer.commit()?;
let mem_right_after_commit = directory.total_mem_usage();
assert!(receiver.recv().is_ok());

let reader = index
.reader_builder()
.reload_policy(ReloadPolicy::Manual)
.try_into()?;

assert_eq!(reader.searcher().num_docs(), 8_000);
assert_eq!(reader.searcher().segment_readers().len(), 8);

writer.wait_merging_threads()?;

let mem_right_after_merge_finished = directory.total_mem_usage();

reader.reload().unwrap();
let searcher = reader.searcher();
assert_eq!(searcher.segment_readers().len(), 1);
assert_eq!(searcher.num_docs(), 8_000);
assert!(
mem_right_after_merge_finished < mem_right_after_commit,
Expand Down
1 change: 1 addition & 0 deletions src/future_result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ mod tests {
}

#[test]

fn test_scheduled_result_error() {
let (scheduled_result, tx): (FutureResult<()>, _) = FutureResult::create("failed");
drop(tx);
Expand Down
10 changes: 5 additions & 5 deletions src/indexer/segment_updater.rs
Original file line number Diff line number Diff line change
Expand Up @@ -539,17 +539,17 @@ impl SegmentUpdater {
merge_operation.target_opstamp(),
) {
Ok(after_merge_segment_entry) => {
let segment_meta =
let segment_meta_res =
segment_updater.end_merge(merge_operation, after_merge_segment_entry);
let _send_result = merging_future_send.send(segment_meta);
let _send_result = merging_future_send.send(segment_meta_res);
}
Err(e) => {
Err(merge_error) => {
warn!(
"Merge of {:?} was cancelled: {:?}",
merge_operation.segment_ids().to_vec(),
e
merge_error
);
// ... cancel merge
let _send_result = merging_future_send.send(Err(merge_error));
assert!(!cfg!(test), "Merge failed.");
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/tokenizer/ascii_folding_filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1625,9 +1625,9 @@ mod tests {

#[test]
fn test_to_ascii() {
let mut input = "Rámon".to_string();
let input = "Rámon".to_string();
let mut buffer = String::new();
to_ascii(&mut input, &mut buffer);
to_ascii(&input, &mut buffer);
assert_eq!("Ramon", buffer);
}

Expand Down

0 comments on commit a51f15d

Please sign in to comment.