diff --git a/fastfield_codecs/src/ip_codec.rs b/fastfield_codecs/src/ip_codec.rs index 93347a309..61169bd57 100644 --- a/fastfield_codecs/src/ip_codec.rs +++ b/fastfield_codecs/src/ip_codec.rs @@ -10,7 +10,6 @@ /// Compact space 0..6 requires much less bits than 100..50001 /// /// The codec is created to compress ip addresses, but may be employed in other use cases. -/// use std::{ cmp::Ordering, collections::BinaryHeap, @@ -156,8 +155,9 @@ fn get_compact_space(ip_addrs_sorted: &[u128], cost_per_interval: usize) -> Comp // Continue here, since although we walk over the deltas by size, // we can potentially save a lot at the last bits, which are smaller deltas // - // E.g. if the first range reduces the compact space by 1000 from 2000 to 1000, which saves 11-10=1 bit - // and the next range reduces the compact space by 950 to 50, which saves 10-6=4 bit + // E.g. if the first range reduces the compact space by 1000 from 2000 to 1000, which + // saves 11-10=1 bit and the next range reduces the compact space by 950 to + // 50, which saves 10-6=4 bit continue; } @@ -521,8 +521,8 @@ impl IntervallDecompressor { Ok(decompressor) } - /// Converting to compact space for the decompressor is more complex, since we may get values which are - /// outside the compact space. e.g. if we map + /// Converting to compact space for the decompressor is more complex, since we may get values + /// which are outside the compact space. e.g. if we map /// 1000 => 5 /// 2000 => 6 /// @@ -587,7 +587,8 @@ impl IntervallDecompressor { #[inline] pub fn iter<'a>(&'a self, data: &'a [u8]) -> impl Iterator + 'a { - // TODO: Performance. It would be better to iterate on the ranges and check existence via the bit_unpacker. + // TODO: Performance. It would be better to iterate on the ranges and check existence via + // the bit_unpacker. self.iter_compact(data) .map(|compact| self.compact_to_ip_addr(compact)) } diff --git a/src/fastfield/writer.rs b/src/fastfield/writer.rs index 06f110071..56777eab6 100644 --- a/src/fastfield/writer.rs +++ b/src/fastfield/writer.rs @@ -306,7 +306,6 @@ impl U128FastFieldWriter { /// /// Extract the value associated to the fast field for /// this document. - /// pub fn add_document(&mut self, doc: &Document) { match doc.get_first(self.field) { Some(v) => { diff --git a/src/schema/field_entry.rs b/src/schema/field_entry.rs index fd1f3fb7b..e3c23687e 100644 --- a/src/schema/field_entry.rs +++ b/src/schema/field_entry.rs @@ -1,13 +1,12 @@ use serde::{Deserialize, Serialize}; +use super::ip_options::IpOptions; use crate::schema::bytes_options::BytesOptions; use crate::schema::{ is_valid_field_name, DateOptions, FacetOptions, FieldType, JsonObjectOptions, NumericOptions, TextOptions, }; -use super::ip_options::IpOptions; - /// A `FieldEntry` represents a field and its configuration. /// `Schema` are a collection of `FieldEntry` /// diff --git a/src/schema/field_type.rs b/src/schema/field_type.rs index 9ed9cbcfa..1bf1577e7 100644 --- a/src/schema/field_type.rs +++ b/src/schema/field_type.rs @@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize}; use serde_json::Value as JsonValue; use thiserror::Error; +use super::ip_options::IpOptions; use crate::schema::bytes_options::BytesOptions; use crate::schema::facet_options::FacetOptions; use crate::schema::{ @@ -16,8 +17,6 @@ use crate::time::OffsetDateTime; use crate::tokenizer::PreTokenizedString; use crate::DateTime; -use super::ip_options::IpOptions; - /// Possible error that may occur while parsing a field value /// At this point the JSON is known to be valid. #[derive(Debug, PartialEq, Error)] diff --git a/src/schema/schema.rs b/src/schema/schema.rs index a7483aaaf..fe070c615 100644 --- a/src/schema/schema.rs +++ b/src/schema/schema.rs @@ -390,9 +390,7 @@ impl Schema { impl Serialize for Schema { fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { + where S: Serializer { let mut seq = serializer.serialize_seq(Some(self.0.fields.len()))?; for e in &self.0.fields { seq.serialize_element(e)?; @@ -403,9 +401,7 @@ impl Serialize for Schema { impl<'de> Deserialize<'de> for Schema { fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { + where D: Deserializer<'de> { struct SchemaVisitor; impl<'de> Visitor<'de> for SchemaVisitor { @@ -416,9 +412,7 @@ impl<'de> Deserialize<'de> for Schema { } fn visit_seq(self, mut seq: A) -> Result - where - A: SeqAccess<'de>, - { + where A: SeqAccess<'de> { let mut schema = SchemaBuilder { fields: Vec::with_capacity(seq.size_hint().unwrap_or(0)), fields_map: HashMap::with_capacity(seq.size_hint().unwrap_or(0)), diff --git a/src/schema/term.rs b/src/schema/term.rs index b4e064af5..a7f867451 100644 --- a/src/schema/term.rs +++ b/src/schema/term.rs @@ -34,8 +34,7 @@ pub const JSON_END_OF_PATH: u8 = 0u8; /// It actually wraps a `Vec`. #[derive(Clone)] pub struct Term>(B) -where - B: AsRef<[u8]>; +where B: AsRef<[u8]>; impl AsMut> for Term { fn as_mut(&mut self) -> &mut Vec { @@ -175,8 +174,7 @@ impl Term { } impl Ord for Term -where - B: AsRef<[u8]>, +where B: AsRef<[u8]> { fn cmp(&self, other: &Self) -> std::cmp::Ordering { self.as_slice().cmp(other.as_slice()) @@ -184,8 +182,7 @@ where } impl PartialOrd for Term -where - B: AsRef<[u8]>, +where B: AsRef<[u8]> { fn partial_cmp(&self, other: &Self) -> Option { Some(self.cmp(other)) @@ -193,8 +190,7 @@ where } impl PartialEq for Term -where - B: AsRef<[u8]>, +where B: AsRef<[u8]> { fn eq(&self, other: &Self) -> bool { self.as_slice() == other.as_slice() @@ -204,8 +200,7 @@ where impl Eq for Term where B: AsRef<[u8]> {} impl Hash for Term -where - B: AsRef<[u8]>, +where B: AsRef<[u8]> { fn hash(&self, state: &mut H) { self.0.as_ref().hash(state) @@ -213,8 +208,7 @@ where } impl Term -where - B: AsRef<[u8]>, +where B: AsRef<[u8]> { /// Wraps a object holding bytes pub fn wrap(data: B) -> Term { @@ -430,8 +424,7 @@ fn debug_value_bytes(typ: Type, bytes: &[u8], f: &mut fmt::Formatter) -> fmt::Re } impl fmt::Debug for Term -where - B: AsRef<[u8]>, +where B: AsRef<[u8]> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let field_id = self.field().field_id(); diff --git a/src/schema/value.rs b/src/schema/value.rs index 882d99c62..5b338793c 100644 --- a/src/schema/value.rs +++ b/src/schema/value.rs @@ -41,9 +41,7 @@ impl Eq for Value {} impl Serialize for Value { fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { + where S: Serializer { match *self { Value::Str(ref v) => serializer.serialize_str(v), Value::PreTokStr(ref v) => v.serialize(serializer), @@ -62,9 +60,7 @@ impl Serialize for Value { impl<'de> Deserialize<'de> for Value { fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { + where D: Deserializer<'de> { struct ValueVisitor; impl<'de> Visitor<'de> for ValueVisitor {