Use FileIDType::from() and remove select_id_type_from_str()

This commit is contained in:
Matthias Beyer 2015-12-03 17:37:13 +01:00
parent ce4d99384b
commit 1b0f4894ac

View file

@ -151,7 +151,7 @@ impl<'a> From<&'a String> for FileID {
debug!(" Hash Name: {:?}", hashname); debug!(" Hash Name: {:?}", hashname);
debug!(" Hash: {:?}", hash); debug!(" Hash: {:?}", hash);
let idtype = select_id_type_from_str(hashname); let idtype = FileIDType::from(hashname);
match idtype { match idtype {
FileIDType::NONE => hash = "INVALID", FileIDType::NONE => hash = "INVALID",
_ => {}, _ => {},
@ -231,13 +231,6 @@ impl<'a> Display for FileIDError {
} }
fn select_id_type_from_str(s: &str) -> FileIDType {
match s {
"UUID" => FileIDType::UUID,
_ => FileIDType::NONE,
}
}
pub type FileIDResult = Result<FileID, FileIDError>; pub type FileIDResult = Result<FileID, FileIDError>;
#[cfg(test)] #[cfg(test)]