chore: Do a little clippy pass

This commit is contained in:
Clément Renault
2019-05-22 11:00:58 +02:00
parent 34ba520f44
commit 102fb506db
7 changed files with 15 additions and 24 deletions

View File

@ -95,7 +95,7 @@ impl Index {
let fields = fields
.map(|fields| {
fields
.into_iter()
.iter()
.filter_map(|name| schema.attribute(name))
.collect()
});

View File

@ -134,9 +134,9 @@ fn token_to_docindex(id: DocumentId, attr: SchemaAttr, token: Token) -> Option<D
let docindex = DocIndex {
document_id: id,
attribute: attr.0,
word_index: word_index,
char_index: char_index,
char_length: char_length,
word_index,
char_index,
char_length,
};
Some(docindex)

View File

@ -61,7 +61,7 @@ impl ser::Serializer for ConvertToNumber {
}
fn serialize_f32(self, value: f32) -> Result<Self::Ok, Self::Error> {
Ok(Number::Float(OrderedFloat(value as f64)))
Ok(Number::Float(OrderedFloat(f64::from(value))))
}
fn serialize_f64(self, value: f64) -> Result<Self::Ok, Self::Error> {

View File

@ -266,26 +266,22 @@ fn serialize_value<T: ?Sized>(
) -> Result<(), SerializerError>
where T: ser::Serialize,
{
if let Some(attr) = schema.attribute(key) {
let props = schema.props(attr);
if let Some(attribute) = schema.attribute(key) {
let props = schema.props(attribute);
if props.is_stored() {
let value = rmp_serde::to_vec_named(value)?;
document_store.set_document_field(document_id, attr, value);
document_store.set_document_field(document_id, attribute, value);
}
if props.is_indexed() {
let indexer = Indexer {
attribute: attr,
indexer: indexer,
document_id: document_id,
};
let indexer = Indexer { attribute, indexer, document_id };
value.serialize(indexer)?;
}
if props.is_ranked() {
let number = value.serialize(ConvertToNumber)?;
ranked_map.insert(document_id, attr, number);
ranked_map.insert(document_id, attribute, number);
}
}