Fixing compilation warnings & clippy comments.

This commit is contained in:
Paul Masurel
2021-12-10 16:47:59 +09:00
parent c980b19dd9
commit ebdbb6bd2e
6 changed files with 10 additions and 8 deletions

View File

@@ -727,7 +727,7 @@ mod bench {
let mut index_writer = index.writer_for_tests().unwrap();
for doc in docs {
index_writer.add_document(doc);
index_writer.add_document(doc).unwrap();
}
index_writer.commit().unwrap();
let reader = index.reader().unwrap();

View File

@@ -516,7 +516,7 @@ mod bench_sorted_index_merge {
let index_doc = |index_writer: &mut IndexWriter, val: u64| {
let mut doc = Document::default();
doc.add_u64(int_field, val);
index_writer.add_document(doc);
index_writer.add_document(doc).unwrap();
};
// 3 segments with 10_000 values in the fast fields
for _ in 0..3 {

View File

@@ -617,7 +617,7 @@ mod bench {
doc.add_text(text_field, "c");
}
doc.add_text(text_field, "d");
index_writer.add_document(doc);
index_writer.add_document(doc).unwrap();
}
assert!(index_writer.commit().is_ok());
}

View File

@@ -2,8 +2,10 @@ use std::io;
#[inline]
pub fn compress(mut uncompressed: &[u8], compressed: &mut Vec<u8>) -> io::Result<()> {
let mut params = brotli::enc::BrotliEncoderParams::default();
params.quality = 5;
let params = brotli::enc::BrotliEncoderParams {
quality: 5,
..Default::default()
};
compressed.clear();
brotli::BrotliCompress(&mut uncompressed, compressed, &params)?;
Ok(())

View File

@@ -4,7 +4,7 @@ use std::io::{self, Read, Write};
pub fn compress(uncompressed: &[u8], compressed: &mut Vec<u8>) -> io::Result<()> {
compressed.clear();
let mut encoder = snap::write::FrameEncoder::new(compressed);
encoder.write_all(&uncompressed)?;
encoder.write_all(uncompressed)?;
encoder.flush()?;
Ok(())
}

View File

@@ -259,11 +259,11 @@ pub mod tests {
let mut index_writer = index.writer_for_tests().unwrap();
// put enough data create enough blocks in the doc store to be considered for stacking
for _ in 0..200 {
index_writer.add_document(doc!(text_field=> LOREM));
index_writer.add_document(doc!(text_field=> LOREM))?;
}
assert!(index_writer.commit().is_ok());
for _ in 0..200 {
index_writer.add_document(doc!(text_field=> LOREM));
index_writer.add_document(doc!(text_field=> LOREM))?;
}
assert!(index_writer.commit().is_ok());
}