mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-03 03:47:02 +02:00
clippy fix change
This commit is contained in:
parent
9c28632498
commit
bf96b6df93
4 changed files with 71 additions and 118 deletions
|
@ -1065,7 +1065,7 @@ impl IndexScheduler {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::io::{Seek, Write, BufWriter};
|
||||
use std::io::{BufWriter, Seek, Write};
|
||||
use std::time::Instant;
|
||||
|
||||
use big_s::S;
|
||||
|
@ -1079,7 +1079,7 @@ mod tests {
|
|||
};
|
||||
use meilisearch_types::tasks::IndexSwap;
|
||||
use meilisearch_types::VERSION_FILE_NAME;
|
||||
use tempfile::{TempDir, NamedTempFile};
|
||||
use tempfile::{NamedTempFile, TempDir};
|
||||
use time::Duration;
|
||||
use uuid::Uuid;
|
||||
use Breakpoint::*;
|
||||
|
@ -1187,7 +1187,10 @@ mod tests {
|
|||
}
|
||||
|
||||
/// Adapting to the new json reading interface
|
||||
pub fn read_json(bytes: &[u8], write: impl Write + Seek) -> std::result::Result<usize, DocumentFormatError> {
|
||||
pub fn read_json(
|
||||
bytes: &[u8],
|
||||
write: impl Write + Seek,
|
||||
) -> std::result::Result<usize, DocumentFormatError> {
|
||||
let temp_file = NamedTempFile::new().unwrap();
|
||||
let mut buffer = BufWriter::new(temp_file.reopen().unwrap());
|
||||
buffer.write(bytes).unwrap();
|
||||
|
@ -1213,9 +1216,7 @@ mod tests {
|
|||
);
|
||||
|
||||
let (_uuid, mut file) = index_scheduler.create_update_file_with_uuid(file_uuid).unwrap();
|
||||
let documents_count =
|
||||
read_json(content.as_bytes(), file.as_file_mut())
|
||||
.unwrap() as u64;
|
||||
let documents_count = read_json(content.as_bytes(), file.as_file_mut()).unwrap() as u64;
|
||||
(file, documents_count)
|
||||
}
|
||||
|
||||
|
@ -1595,9 +1596,7 @@ mod tests {
|
|||
}"#;
|
||||
|
||||
let (uuid, mut file) = index_scheduler.create_update_file_with_uuid(0).unwrap();
|
||||
let documents_count =
|
||||
read_json(content.as_bytes(), file.as_file_mut())
|
||||
.unwrap() as u64;
|
||||
let documents_count = read_json(content.as_bytes(), file.as_file_mut()).unwrap() as u64;
|
||||
file.persist().unwrap();
|
||||
index_scheduler
|
||||
.register(KindWithContent::DocumentAdditionOrUpdate {
|
||||
|
@ -1634,9 +1633,7 @@ mod tests {
|
|||
snapshot!(snapshot_index_scheduler(&index_scheduler), name: "registered_the_first_task");
|
||||
|
||||
let (uuid, mut file) = index_scheduler.create_update_file_with_uuid(0).unwrap();
|
||||
let documents_count =
|
||||
read_json(content.as_bytes(), file.as_file_mut())
|
||||
.unwrap() as u64;
|
||||
let documents_count = read_json(content.as_bytes(), file.as_file_mut()).unwrap() as u64;
|
||||
file.persist().unwrap();
|
||||
index_scheduler
|
||||
.register(KindWithContent::DocumentAdditionOrUpdate {
|
||||
|
@ -1803,9 +1800,7 @@ mod tests {
|
|||
}"#;
|
||||
|
||||
let (uuid, mut file) = index_scheduler.create_update_file_with_uuid(0).unwrap();
|
||||
let documents_count =
|
||||
read_json(content.as_bytes(), file.as_file_mut())
|
||||
.unwrap() as u64;
|
||||
let documents_count = read_json(content.as_bytes(), file.as_file_mut()).unwrap() as u64;
|
||||
file.persist().unwrap();
|
||||
index_scheduler
|
||||
.register(KindWithContent::DocumentAdditionOrUpdate {
|
||||
|
@ -1963,11 +1958,7 @@ mod tests {
|
|||
);
|
||||
|
||||
let (uuid, mut file) = index_scheduler.create_update_file_with_uuid(i).unwrap();
|
||||
let documents_count = read_json(
|
||||
content.as_bytes(),
|
||||
file.as_file_mut(),
|
||||
)
|
||||
.unwrap() as u64;
|
||||
let documents_count = read_json(content.as_bytes(), file.as_file_mut()).unwrap() as u64;
|
||||
file.persist().unwrap();
|
||||
index_scheduler
|
||||
.register(KindWithContent::DocumentAdditionOrUpdate {
|
||||
|
@ -2014,11 +2005,7 @@ mod tests {
|
|||
);
|
||||
|
||||
let (uuid, mut file) = index_scheduler.create_update_file_with_uuid(i).unwrap();
|
||||
let documents_count = read_json(
|
||||
content.as_bytes(),
|
||||
file.as_file_mut(),
|
||||
)
|
||||
.unwrap() as u64;
|
||||
let documents_count = read_json(content.as_bytes(), file.as_file_mut()).unwrap() as u64;
|
||||
file.persist().unwrap();
|
||||
index_scheduler
|
||||
.register(KindWithContent::DocumentAdditionOrUpdate {
|
||||
|
@ -2067,11 +2054,7 @@ mod tests {
|
|||
);
|
||||
|
||||
let (uuid, mut file) = index_scheduler.create_update_file_with_uuid(i).unwrap();
|
||||
let documents_count = read_json(
|
||||
content.as_bytes(),
|
||||
file.as_file_mut(),
|
||||
)
|
||||
.unwrap() as u64;
|
||||
let documents_count = read_json(content.as_bytes(), file.as_file_mut()).unwrap() as u64;
|
||||
file.persist().unwrap();
|
||||
index_scheduler
|
||||
.register(KindWithContent::DocumentAdditionOrUpdate {
|
||||
|
@ -2121,11 +2104,7 @@ mod tests {
|
|||
);
|
||||
|
||||
let (uuid, mut file) = index_scheduler.create_update_file_with_uuid(i).unwrap();
|
||||
let documents_count = read_json(
|
||||
content.as_bytes(),
|
||||
file.as_file_mut(),
|
||||
)
|
||||
.unwrap() as u64;
|
||||
let documents_count = read_json(content.as_bytes(), file.as_file_mut()).unwrap() as u64;
|
||||
file.persist().unwrap();
|
||||
index_scheduler
|
||||
.register(KindWithContent::DocumentAdditionOrUpdate {
|
||||
|
@ -2176,11 +2155,7 @@ mod tests {
|
|||
);
|
||||
|
||||
let (uuid, mut file) = index_scheduler.create_update_file_with_uuid(i).unwrap();
|
||||
let documents_count = read_json(
|
||||
content.as_bytes(),
|
||||
file.as_file_mut(),
|
||||
)
|
||||
.unwrap() as u64;
|
||||
let documents_count = read_json(content.as_bytes(), file.as_file_mut()).unwrap() as u64;
|
||||
file.persist().unwrap();
|
||||
index_scheduler
|
||||
.register(KindWithContent::DocumentAdditionOrUpdate {
|
||||
|
@ -2627,9 +2602,7 @@ mod tests {
|
|||
}"#;
|
||||
|
||||
let (uuid, mut file) = index_scheduler.create_update_file_with_uuid(0).unwrap();
|
||||
let documents_count =
|
||||
read_json(content.as_bytes(), file.as_file_mut())
|
||||
.unwrap() as u64;
|
||||
let documents_count = read_json(content.as_bytes(), file.as_file_mut()).unwrap() as u64;
|
||||
file.persist().unwrap();
|
||||
index_scheduler
|
||||
.register(KindWithContent::DocumentAdditionOrUpdate {
|
||||
|
@ -2667,9 +2640,7 @@ mod tests {
|
|||
}"#;
|
||||
|
||||
let (uuid, mut file) = index_scheduler.create_update_file_with_uuid(0).unwrap();
|
||||
let documents_count =
|
||||
read_json(content.as_bytes(), file.as_file_mut())
|
||||
.unwrap() as u64;
|
||||
let documents_count = read_json(content.as_bytes(), file.as_file_mut()).unwrap() as u64;
|
||||
file.persist().unwrap();
|
||||
index_scheduler
|
||||
.register(KindWithContent::DocumentAdditionOrUpdate {
|
||||
|
@ -2725,11 +2696,7 @@ mod tests {
|
|||
);
|
||||
|
||||
let (uuid, mut file) = index_scheduler.create_update_file_with_uuid(i).unwrap();
|
||||
let documents_count = read_json(
|
||||
content.as_bytes(),
|
||||
file.as_file_mut(),
|
||||
)
|
||||
.unwrap() as u64;
|
||||
let documents_count = read_json(content.as_bytes(), file.as_file_mut()).unwrap() as u64;
|
||||
file.persist().unwrap();
|
||||
index_scheduler
|
||||
.register(KindWithContent::DocumentAdditionOrUpdate {
|
||||
|
@ -2777,11 +2744,7 @@ mod tests {
|
|||
);
|
||||
|
||||
let (uuid, mut file) = index_scheduler.create_update_file_with_uuid(i).unwrap();
|
||||
let documents_count = read_json(
|
||||
content.as_bytes(),
|
||||
file.as_file_mut(),
|
||||
)
|
||||
.unwrap() as u64;
|
||||
let documents_count = read_json(content.as_bytes(), file.as_file_mut()).unwrap() as u64;
|
||||
file.persist().unwrap();
|
||||
index_scheduler
|
||||
.register(KindWithContent::DocumentAdditionOrUpdate {
|
||||
|
@ -2835,11 +2798,7 @@ mod tests {
|
|||
);
|
||||
|
||||
let (uuid, mut file) = index_scheduler.create_update_file_with_uuid(i).unwrap();
|
||||
let documents_count = read_json(
|
||||
content.as_bytes(),
|
||||
file.as_file_mut(),
|
||||
)
|
||||
.unwrap() as u64;
|
||||
let documents_count = read_json(content.as_bytes(), file.as_file_mut()).unwrap() as u64;
|
||||
file.persist().unwrap();
|
||||
index_scheduler
|
||||
.register(KindWithContent::DocumentAdditionOrUpdate {
|
||||
|
@ -2898,11 +2857,7 @@ mod tests {
|
|||
);
|
||||
|
||||
let (uuid, mut file) = index_scheduler.create_update_file_with_uuid(i).unwrap();
|
||||
let documents_count = read_json(
|
||||
content.as_bytes(),
|
||||
file.as_file_mut(),
|
||||
)
|
||||
.unwrap() as u64;
|
||||
let documents_count = read_json(content.as_bytes(), file.as_file_mut()).unwrap() as u64;
|
||||
file.persist().unwrap();
|
||||
index_scheduler
|
||||
.register(KindWithContent::DocumentAdditionOrUpdate {
|
||||
|
@ -2966,11 +2921,7 @@ mod tests {
|
|||
let allow_index_creation = i % 2 != 0;
|
||||
|
||||
let (uuid, mut file) = index_scheduler.create_update_file_with_uuid(i).unwrap();
|
||||
let documents_count = read_json(
|
||||
content.as_bytes(),
|
||||
file.as_file_mut(),
|
||||
)
|
||||
.unwrap() as u64;
|
||||
let documents_count = read_json(content.as_bytes(), file.as_file_mut()).unwrap() as u64;
|
||||
file.persist().unwrap();
|
||||
index_scheduler
|
||||
.register(KindWithContent::DocumentAdditionOrUpdate {
|
||||
|
@ -3023,11 +2974,7 @@ mod tests {
|
|||
let allow_index_creation = i % 2 != 0;
|
||||
|
||||
let (uuid, mut file) = index_scheduler.create_update_file_with_uuid(i).unwrap();
|
||||
let documents_count = read_json(
|
||||
content.as_bytes(),
|
||||
file.as_file_mut(),
|
||||
)
|
||||
.unwrap() as u64;
|
||||
let documents_count = read_json(content.as_bytes(), file.as_file_mut()).unwrap() as u64;
|
||||
file.persist().unwrap();
|
||||
index_scheduler
|
||||
.register(KindWithContent::DocumentAdditionOrUpdate {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue