Use UTF8Error in default hasher impl

This commit is contained in:
Matthias Beyer 2016-08-11 13:08:09 +02:00
parent 70c015f73d
commit 39bb36f023

View file

@ -37,9 +37,9 @@ impl Hasher for DefaultHasher {
"default"
}
fn create_hash<R: Read>(&mut self, _: &PathBuf, contents: &mut R) -> Result<String> {
fn create_hash<R: Read>(&mut self, _: &PathBuf, c: &mut R) -> Result<String> {
let mut s = String::new();
try!(contents.read_to_string(&mut s).map_err_into(REK::IOError));
try!(c.read_to_string(&mut s).map_err_into(REK::UTF8Error).map_err_into(REK::IOError));
self.hasher.input_str(&s[..]);
Ok(self.hasher.result_str())
}