use super::{Algorithm, CandidateHash, Hash, MatchLevel, MessageLevel, VerificationSource};
-use std::borrow::Borrow;
use std::error::Error;
use std::io::Write;
use termcolor::{Color, ColorChoice, ColorSpec, StandardStream, WriteColor};
VerificationSource::Clipboard => {
writeln!(&mut stdout, "pasted from clipboard")?;
}
- VerificationSource::RawFile(raw_path) => match raw_path.to_string_lossy().borrow() {
+ VerificationSource::RawFile(raw_path) => match raw_path.as_str() {
"-" => {
writeln!(&mut stdout, "from standard input")?;
}
writeln!(&mut stdout, "from file '{}' containing raw hash", path)?;
}
},
- VerificationSource::DigestsFile(digest_path) => {
- match digest_path.to_string_lossy().borrow() {
- "-" => {
- writeln!(
- &mut stdout,
- "'{}' from digests on standard input",
- candidate_filename.as_ref().unwrap()
- )?;
- }
- path => {
- writeln!(
- &mut stdout,
- "'{}' in digests file '{}'",
- candidate_filename.as_ref().unwrap(),
- path
- )?;
- }
+ VerificationSource::DigestsFile(digest_path) => match digest_path.as_str() {
+ "-" => {
+ writeln!(
+ &mut stdout,
+ "'{}' from digests on standard input",
+ candidate_filename.as_ref().unwrap()
+ )?;
}
- }
+ path => {
+ writeln!(
+ &mut stdout,
+ "'{}' in digests file '{}'",
+ candidate_filename.as_ref().unwrap(),
+ path
+ )?;
+ }
+ },
}
stdout.reset()?;
Ok(())