From de8b0ebf3054031156ea2412f4e16c74d47cb3ab Mon Sep 17 00:00:00 2001 From: Ryan Leckey Date: Thu, 22 Jun 2017 23:16:52 -0700 Subject: :memo: on remaining unwraps --- src/file/format/mod.rs | 3 +++ src/file/format/yaml.rs | 1 + 2 files changed, 4 insertions(+) (limited to 'src/file/format') diff --git a/src/file/format/mod.rs b/src/file/format/mod.rs index 366fa45..b3cf279 100644 --- a/src/file/format/mod.rs +++ b/src/file/format/mod.rs @@ -54,6 +54,9 @@ impl FileFormat { // TODO: pub(crate) #[doc(hidden)] pub fn extensions(&self) -> &'static Vec<&'static str> { + // It should not be possible for this to fail + // A FileFormat would need to be declared without being added to the + // ALL_EXTENSIONS map. ALL_EXTENSIONS.get(self).unwrap() } diff --git a/src/file/format/yaml.rs b/src/file/format/yaml.rs index 4911679..4040ea6 100644 --- a/src/file/format/yaml.rs +++ b/src/file/format/yaml.rs @@ -30,6 +30,7 @@ fn from_yaml_value(uri: Option<&String>, value: &yaml::Yaml) -> Value { match *value { yaml::Yaml::String(ref value) => Value::new(uri, ValueKind::String(value.clone())), yaml::Yaml::Real(ref value) => { + // TODO: Figure out in what cases this can panic? Value::new(uri, ValueKind::Float(value.parse::().unwrap())) } yaml::Yaml::Integer(value) => Value::new(uri, ValueKind::Integer(value)), -- cgit v1.2.3