diff --git a/src/bin/raptor.rs b/src/bin/raptor.rs index f9fe6eca7..20394208e 100644 --- a/src/bin/raptor.rs +++ b/src/bin/raptor.rs @@ -66,9 +66,14 @@ impl<'a> Service for MainService<'a> { body.push_str("
"); while let Some((key, values, state)) = stream.next() { - let values = &values[..values.len().min(10)]; - let distance = lev.distance(state); - body.push_str(&format!("{:?} (dist: {:?}) {:?}
", key, distance, values)); + match std::str::from_utf8(key) { + Ok(key) => { + let values = &values[..values.len().min(10)]; + let distance = lev.distance(state); + body.push_str(&format!("{:?} (dist: {:?}) {:?}
", key, distance, values)); + }, + Err(e) => eprintln!("{:?}", e), + } } body.push_str(""); diff --git a/src/lib.rs b/src/lib.rs index b50846144..e8eb1397d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -9,7 +9,6 @@ use std::ops::Range; use std::io::{Write, BufReader}; use std::fs::File; use std::path::Path; -use std::str::from_utf8_unchecked; use fst::Automaton; pub use self::fst_map::{FstMap, FstMapBuilder};