summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2018-09-07 11:57:07 -0400
committerAndrew Gallant <jamslam@gmail.com>2018-09-07 12:06:05 -0400
commit54b3e9eb10bebb33de799bc14616a0d72165583a (patch)
tree510401c43b716687589106dd268496c5b8a33781
parent56e8864426229de7b181c141baddf788c22b4925 (diff)
grep-printer: delete unused code
-rw-r--r--grep-printer/src/jsont.rs66
-rw-r--r--grep-searcher/src/lib.rs3
2 files changed, 0 insertions, 69 deletions
diff --git a/grep-printer/src/jsont.rs b/grep-printer/src/jsont.rs
index 5028349a..f98dabbb 100644
--- a/grep-printer/src/jsont.rs
+++ b/grep-printer/src/jsont.rs
@@ -114,39 +114,6 @@ impl<'a> Data<'a> {
// so we do the easy thing for now.
Data::Text { text: path.to_string_lossy() }
}
-
- // Unused deserialization routines.
-
- /*
- fn into_bytes(self) -> Vec<u8> {
- match self {
- Data::Text { text } => text.into_bytes(),
- Data::Bytes { bytes } => bytes,
- }
- }
-
- #[cfg(unix)]
- fn into_path_buf(&self) -> PathBuf {
- use std::os::unix::ffi::OsStrExt;
-
- match self {
- Data::Text { text } => PathBuf::from(text),
- Data::Bytes { bytes } => {
- PathBuf::from(OsStr::from_bytes(bytes))
- }
- }
- }
-
- #[cfg(not(unix))]
- fn into_path_buf(&self) -> PathBuf {
- match self {
- Data::Text { text } => PathBuf::from(text),
- Data::Bytes { bytes } => {
- PathBuf::from(String::from_utf8_lossy(&bytes).into_owned())
- }
- }
- }
- */
}
fn to_base64<T, S>(
@@ -178,36 +145,3 @@ where P: AsRef<Path>,
{
path.as_ref().map(|p| Data::from_path(p.as_ref())).serialize(ser)
}
-
-// The following are some deserialization helpers, in case we decide to support
-// deserialization of the above types.
-
-/*
-fn from_base64<'de, D>(
- de: D,
-) -> Result<Vec<u8>, D::Error>
-where D: Deserializer<'de>
-{
- let encoded = String::deserialize(de)?;
- let decoded = base64::decode(encoded.as_bytes())
- .map_err(D::Error::custom)?;
- Ok(decoded)
-}
-
-fn deser_bytes<'de, D>(
- de: D,
-) -> Result<Vec<u8>, D::Error>
-where D: Deserializer<'de>
-{
- Data::deserialize(de).map(|datum| datum.into_bytes())
-}
-
-fn deser_path<'de, D>(
- de: D,
-) -> Result<Option<PathBuf>, D::Error>
-where D: Deserializer<'de>
-{
- Option::<Data>::deserialize(de)
- .map(|opt| opt.map(|datum| datum.into_path_buf()))
-}
-*/
diff --git a/grep-searcher/src/lib.rs b/grep-searcher/src/lib.rs
index 4874b996..f3ec02f2 100644
--- a/grep-searcher/src/lib.rs
+++ b/grep-searcher/src/lib.rs
@@ -74,14 +74,11 @@ fn example() -> Result<(), Box<Error>> {
let mut matches: Vec<(u64, String)> = vec![];
Searcher::new().search_slice(&matcher, SHERLOCK, UTF8(|lnum, line| {
// We are guaranteed to find a match, so the unwrap is OK.
- eprintln!("LINE: {:?}", line);
let mymatch = matcher.find(line.as_bytes())?.unwrap();
matches.push((lnum, line[mymatch].to_string()));
Ok(true)
}))?;
- eprintln!("MATCHES: {:?}", matches);
-
assert_eq!(matches.len(), 2);
assert_eq!(
matches[0],