mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-12-23 05:00:06 +01:00
make clippy happy
This commit is contained in:
parent
952e742321
commit
4d5005b01a
@ -615,6 +615,8 @@ fn some_documents<'a, 't: 'a>(
|
|||||||
document.remove("_vectors");
|
document.remove("_vectors");
|
||||||
}
|
}
|
||||||
RetrieveVectors::Retrieve => {
|
RetrieveVectors::Retrieve => {
|
||||||
|
// Clippy is simply wrong
|
||||||
|
#[allow(clippy::manual_unwrap_or_default)]
|
||||||
let mut vectors = match document.remove("_vectors") {
|
let mut vectors = match document.remove("_vectors") {
|
||||||
Some(Value::Object(map)) => map,
|
Some(Value::Object(map)) => map,
|
||||||
_ => Default::default(),
|
_ => Default::default(),
|
||||||
|
@ -1150,6 +1150,8 @@ fn make_hits(
|
|||||||
permissive_json_pointer::select_values(&displayed_document, attributes_to_retrieve);
|
permissive_json_pointer::select_values(&displayed_document, attributes_to_retrieve);
|
||||||
|
|
||||||
if retrieve_vectors == RetrieveVectors::Retrieve {
|
if retrieve_vectors == RetrieveVectors::Retrieve {
|
||||||
|
// Clippy is wrong
|
||||||
|
#[allow(clippy::manual_unwrap_or_default)]
|
||||||
let mut vectors = match document.remove("_vectors") {
|
let mut vectors = match document.remove("_vectors") {
|
||||||
Some(Value::Object(map)) => map,
|
Some(Value::Object(map)) => map,
|
||||||
_ => Default::default(),
|
_ => Default::default(),
|
||||||
|
@ -25,7 +25,7 @@ impl RoaringBitmapLenCodec {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if size > u16::max_value() as usize + 1 {
|
if size > u16::MAX as usize + 1 {
|
||||||
return Err(io::Error::new(io::ErrorKind::Other, "size is greater than supported"));
|
return Err(io::Error::new(io::ErrorKind::Other, "size is greater than supported"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -316,7 +316,7 @@ impl QueryGraph {
|
|||||||
term_docids
|
term_docids
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|(idx, docids)| match docids.len() {
|
.map(|(idx, docids)| match docids.len() {
|
||||||
0 => (idx, u64::max_value()),
|
0 => (idx, u64::MAX),
|
||||||
frequency => (idx, frequency),
|
frequency => (idx, frequency),
|
||||||
})
|
})
|
||||||
.collect()
|
.collect()
|
||||||
|
@ -15,7 +15,7 @@ impl AvailableDocumentsIds {
|
|||||||
available -= docids;
|
available -= docids;
|
||||||
|
|
||||||
let iter = match last_id.checked_add(1) {
|
let iter = match last_id.checked_add(1) {
|
||||||
Some(id) => id..=u32::max_value(),
|
Some(id) => id..=u32::MAX,
|
||||||
#[allow(clippy::reversed_empty_ranges)]
|
#[allow(clippy::reversed_empty_ranges)]
|
||||||
None => 1..=0, // empty range iterator
|
None => 1..=0, // empty range iterator
|
||||||
};
|
};
|
||||||
@ -24,7 +24,7 @@ impl AvailableDocumentsIds {
|
|||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
let empty = RoaringBitmap::new().into_iter();
|
let empty = RoaringBitmap::new().into_iter();
|
||||||
AvailableDocumentsIds { iter: empty.chain(0..=u32::max_value()) }
|
AvailableDocumentsIds { iter: empty.chain(0..=u32::MAX) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -46,7 +46,7 @@ mod tests {
|
|||||||
fn empty() {
|
fn empty() {
|
||||||
let base = RoaringBitmap::new();
|
let base = RoaringBitmap::new();
|
||||||
let left = AvailableDocumentsIds::from_documents_ids(&base);
|
let left = AvailableDocumentsIds::from_documents_ids(&base);
|
||||||
let right = 0..=u32::max_value();
|
let right = 0..=u32::MAX;
|
||||||
left.zip(right).take(500).for_each(|(l, r)| assert_eq!(l, r));
|
left.zip(right).take(500).for_each(|(l, r)| assert_eq!(l, r));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ mod tests {
|
|||||||
base.insert(405);
|
base.insert(405);
|
||||||
|
|
||||||
let left = AvailableDocumentsIds::from_documents_ids(&base);
|
let left = AvailableDocumentsIds::from_documents_ids(&base);
|
||||||
let right = (0..=u32::max_value()).filter(|&n| n != 0 && n != 10 && n != 100 && n != 405);
|
let right = (0..=u32::MAX).filter(|&n| n != 0 && n != 10 && n != 100 && n != 405);
|
||||||
left.zip(right).take(500).for_each(|(l, r)| assert_eq!(l, r));
|
left.zip(right).take(500).for_each(|(l, r)| assert_eq!(l, r));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user