From 7df56a5a047056e9b45d15a188e6634c95ba9df5 Mon Sep 17 00:00:00 2001 From: Joe Thornber Date: Fri, 26 Jun 2020 08:00:53 +0100 Subject: [PATCH] [thin_shrink] Squash some warnings --- src/shrink/copier.rs | 2 +- src/shrink/toplevel.rs | 15 +++------------ src/shrink/xml.rs | 19 ------------------- 3 files changed, 4 insertions(+), 32 deletions(-) diff --git a/src/shrink/copier.rs b/src/shrink/copier.rs index 9fca58a..83e3c51 100644 --- a/src/shrink/copier.rs +++ b/src/shrink/copier.rs @@ -1,7 +1,7 @@ use anyhow::Result; use std::fs::OpenOptions; use std::io::{Seek, SeekFrom, Write, Read}; -use std::os::unix::fs::OpenOptionsExt; +//use std::os::unix::fs::OpenOptionsExt; pub type Sector = u64; diff --git a/src/shrink/toplevel.rs b/src/shrink/toplevel.rs index bddc448..796110e 100644 --- a/src/shrink/toplevel.rs +++ b/src/shrink/toplevel.rs @@ -1,5 +1,5 @@ use anyhow::Result; -use fixedbitset::{FixedBitSet, IndexRange}; +use fixedbitset::{FixedBitSet}; use std::fs::OpenOptions; use std::io::Write; use std::os::unix::fs::OpenOptionsExt; @@ -84,15 +84,6 @@ impl Pass2 { remaps, } } - - fn remap(&self, r: BlockRange) -> Vec { - let mut rmap = Vec::new(); - - // id - rmap.push(r.clone()); - - rmap - } } impl xml::MetadataVisitor for Pass2 { @@ -288,7 +279,7 @@ fn find_first(r: &BlockRange, remaps: &Vec<(BlockRange, BlockRange)>) -> Option< // Need to check the previous entry let (from, _) = &remaps[n - 1]; overlaps(&r, &from, n - 1).or_else(|| { - let (from, to) = &remaps[n]; + let (from, _) = &remaps[n]; overlaps(&r, &from, n) }) } @@ -444,7 +435,7 @@ fn process_xml(input_path: &str, pass: &mut MV) -> Res pub fn shrink(input_path: &str, output_path: &str, data_path: &str, nr_blocks: u64) -> Result<()> { let mut pass1 = Pass1::new(nr_blocks); - process_xml(input_path, &mut pass1); + process_xml(input_path, &mut pass1)?; eprintln!("{} blocks need moving", pass1.nr_high_blocks); let mut free_blocks = 0u64; diff --git a/src/shrink/xml.rs b/src/shrink/xml.rs index 6a70f31..46c3f3b 100644 --- a/src/shrink/xml.rs +++ b/src/shrink/xml.rs @@ -51,25 +51,6 @@ pub trait MetadataVisitor { fn eof(&mut self) -> Result<()>; } -pub struct NoopVisitor { -} - -impl NoopVisitor { - pub fn new() -> NoopVisitor { NoopVisitor {} } -} - -impl MetadataVisitor for NoopVisitor { - fn superblock_b(&mut self, _sb: &Superblock) -> Result<()> {Ok(())} - fn superblock_e(&mut self) -> Result<()> {Ok(())} - - fn device_b(&mut self, _d: &Device) -> Result<()> {Ok(())} - fn device_e(&mut self) -> Result<()> {Ok(())} - - fn map(&mut self, m: &Map) -> Result<()> {Ok(())} - - fn eof(&mut self) -> Result<()> {Ok(())} -} - pub struct XmlWriter { w: Writer, }