summaryrefslogtreecommitdiffstats
path: root/src/schema
diff options
context:
space:
mode:
Diffstat (limited to 'src/schema')
-rw-r--r--src/schema/field_entry.rs2
-rw-r--r--src/schema/field_type.rs25
-rw-r--r--src/schema/term.rs2
3 files changed, 13 insertions, 16 deletions
diff --git a/src/schema/field_entry.rs b/src/schema/field_entry.rs
index fcce0aa..380ecf8 100644
--- a/src/schema/field_entry.rs
+++ b/src/schema/field_entry.rs
@@ -191,7 +191,7 @@ impl<'de> Deserialize<'de> for FieldEntry {
"text" | "u64" | "i64" => {
// These types require additional options to create a field_type
}
- _ => panic!("unhandled type")
+ _ => panic!("unhandled type"),
}
ty = Some(type_string);
}
diff --git a/src/schema/field_type.rs b/src/schema/field_type.rs
index 209d499..092f7be 100644
--- a/src/schema/field_type.rs
+++ b/src/schema/field_type.rs
@@ -114,13 +114,12 @@ impl FieldType {
format!("Expected an integer, got {:?}", json),
)),
FieldType::HierarchicalFacet => Ok(Value::Facet(Facet::from(field_text))),
- FieldType::Bytes => {
- decode(field_text)
- .map(Value::Bytes)
- .map_err(|_| ValueParsingError::InvalidBase64(
- format!("Expected base64 string, got {:?}", field_text)
- ))
- }
+ FieldType::Bytes => decode(field_text).map(Value::Bytes).map_err(|_| {
+ ValueParsingError::InvalidBase64(format!(
+ "Expected base64 string, got {:?}",
+ field_text
+ ))
+ }),
},
JsonValue::Number(ref field_val_num) => match *self {
FieldType::I64(_) => {
@@ -158,8 +157,8 @@ impl FieldType {
#[cfg(test)]
mod tests {
use super::FieldType;
- use schema::Value;
use schema::field_type::ValueParsingError;
+ use schema::Value;
#[test]
fn test_bytes_value_from_json() {
@@ -168,18 +167,16 @@ mod tests {
.unwrap();
assert_eq!(result, Value::Bytes("this is a test".as_bytes().to_vec()));
- let result = FieldType::Bytes
- .value_from_json(&json!(521));
+ let result = FieldType::Bytes.value_from_json(&json!(521));
match result {
Err(ValueParsingError::TypeError(_)) => {}
- _ => panic!("Expected parse failure for wrong type")
+ _ => panic!("Expected parse failure for wrong type"),
}
- let result = FieldType::Bytes
- .value_from_json(&json!("-"));
+ let result = FieldType::Bytes.value_from_json(&json!("-"));
match result {
Err(ValueParsingError::InvalidBase64(_)) => {}
- _ => panic!("Expected parse failure for invalid base64")
+ _ => panic!("Expected parse failure for invalid base64"),
}
}
}
diff --git a/src/schema/term.rs b/src/schema/term.rs
index 209f1eb..eac870f 100644
--- a/src/schema/term.rs
+++ b/src/schema/term.rs
@@ -3,8 +3,8 @@ use std::fmt;
use super::Field;
use byteorder::{BigEndian, ByteOrder};
use common;
-use std::str;
use schema::Facet;
+use std::str;
/// Size (in bytes) of the buffer of a int field.
const INT_TERM_LEN: usize = 4 + 8;