mirror of
https://github.com/quickwit-oss/tantivy.git
synced 2026-05-15 15:50:41 +00:00
expect instead of unwrap
This commit is contained in:
@@ -317,7 +317,9 @@ impl MultiValueU128FastFieldWriter {
|
||||
for field_value in doc.field_values() {
|
||||
if field_value.field == self.field {
|
||||
let value = field_value.value();
|
||||
let ip_addr = value.as_ip().unwrap();
|
||||
let ip_addr = value
|
||||
.as_ip()
|
||||
.expect(&format!("expected and ip, but got {:?}", value));
|
||||
let value = ip_addr.to_u128();
|
||||
self.add_val(value);
|
||||
}
|
||||
|
||||
@@ -329,7 +329,10 @@ impl U128FastFieldWriter {
|
||||
pub fn add_document(&mut self, doc: &Document) {
|
||||
match doc.get_first(self.field) {
|
||||
Some(v) => {
|
||||
let ip_addr = v.as_ip().unwrap();
|
||||
let ip_addr = v
|
||||
.as_ip()
|
||||
.expect(&format!("expected and ip, but got {:?}", v));
|
||||
|
||||
let value = ip_addr.to_u128();
|
||||
self.add_val(value);
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ use serde::{Deserialize, Serialize};
|
||||
use serde_json::Value as JsonValue;
|
||||
use thiserror::Error;
|
||||
|
||||
use super::Cardinality;
|
||||
use super::ip_options::IpOptions;
|
||||
use super::Cardinality;
|
||||
use crate::schema::bytes_options::BytesOptions;
|
||||
use crate::schema::facet_options::FacetOptions;
|
||||
use crate::schema::{
|
||||
|
||||
Reference in New Issue
Block a user