[Auto] lib/entry/ref: Fix Clippy warnings

Signed-off-by: flip1995 <hello@philkrones.com>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
flip1995 2019-08-27 10:50:30 +02:00 committed by Matthias Beyer
parent 3215c6351c
commit c02e6580be

View file

@ -246,7 +246,7 @@ impl<'a, H: Hasher> Ref for RefWithHasher<'a, H> {
.ok_or_else(|| Error::from(EM::EntryHeaderTypeError2("ref.hash.<hash>", "string")))?; .ok_or_else(|| Error::from(EM::EntryHeaderTypeError2("ref.hash.<hash>", "string")))?;
let file_path = get_file_path(config, basepath_name.as_ref(), &path)?; let file_path = get_file_path(config, basepath_name, &path)?;
ref_header ref_header
.read(H::NAME) .read(H::NAME)
@ -332,18 +332,18 @@ impl<'a, H> MutRef for MutRefWithHasher<'a, H>
if self.0.get_header().read("ref.is_ref")?.is_some() && !force { if self.0.get_header().read("ref.is_ref")?.is_some() && !force {
debug!("Entry is already a Ref!"); debug!("Entry is already a Ref!");
let _ = Err(err_msg("Entry is already a reference")).context("Making ref out of entry")?; Err(err_msg("Entry is already a reference")).context("Making ref out of entry")?;
} }
let file_path = get_file_path(config, basepath_name.as_ref(), &path)?; let file_path = get_file_path(config, basepath_name.as_ref(), &path)?;
if !file_path.exists() { if !file_path.exists() {
let msg = format_err!("File '{:?}' does not exist", file_path); let msg = format_err!("File '{:?}' does not exist", file_path);
let _ = Err(msg).context("Making ref out of entry")?; Err(msg).context("Making ref out of entry")?;
} }
debug!("Entry hashing = {}", file_path.display()); debug!("Entry hashing = {}", file_path.display());
let _ = H::hash(&file_path) H::hash(&file_path)
.and_then(|hash| { .and_then(|hash| {
trace!("hash = {}", hash); trace!("hash = {}", hash);
@ -391,7 +391,7 @@ pub(crate) fn make_header_section<P, C, H>(hash: String, hashname: H, relpath: P
.map(String::from) .map(String::from)
.ok_or_else(|| { .ok_or_else(|| {
let msg = format_err!("UTF Error in '{:?}'", relpath.as_ref()); let msg = format_err!("UTF Error in '{:?}'", relpath.as_ref());
Error::from(msg) msg
})?; })?;
let _ = header_section.insert("relpath", Value::String(relpath))?; let _ = header_section.insert("relpath", Value::String(relpath))?;
@ -460,7 +460,7 @@ mod test {
path.as_ref() path.as_ref()
.to_str() .to_str()
.map(String::from) .map(String::from)
.ok_or_else(|| Error::from(err_msg("Failed to create test hash"))) .ok_or_else(|| err_msg("Failed to create test hash"))
} }
} }