From 57fb2610ad274dff1d2f2e4d43dfce05ca9c4835 Mon Sep 17 00:00:00 2001 From: Federico Pasqua Date: Sat, 14 Mar 2020 15:46:36 +0100 Subject: General upgrade for clippy fix and remove of deprecated methods for errors --- src/file/format/hjson.rs | 2 +- src/file/format/ini.rs | 2 +- src/file/format/json.rs | 2 +- src/file/format/mod.rs | 10 +++++----- src/file/format/toml.rs | 2 +- src/file/format/yaml.rs | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src/file/format') diff --git a/src/file/format/hjson.rs b/src/file/format/hjson.rs index cb0a064..457cfbf 100644 --- a/src/file/format/hjson.rs +++ b/src/file/format/hjson.rs @@ -7,7 +7,7 @@ use value::{Value, ValueKind}; pub fn parse( uri: Option<&String>, text: &str, -) -> Result, Box> { +) -> Result, Box> { // Parse a JSON object value from the text // TODO: Have a proper error fire if the root of a file is ever not a Table let value = from_hjson_value(uri, &serde_hjson::from_str(text)?); diff --git a/src/file/format/ini.rs b/src/file/format/ini.rs index 845de3a..e5e5950 100644 --- a/src/file/format/ini.rs +++ b/src/file/format/ini.rs @@ -7,7 +7,7 @@ use value::{Value, ValueKind}; pub fn parse( uri: Option<&String>, text: &str, -) -> Result, Box> { +) -> Result, Box> { let mut map: HashMap = HashMap::new(); let i = Ini::load_from_str(text)?; for (sec, prop) in i.iter() { diff --git a/src/file/format/json.rs b/src/file/format/json.rs index 87240a3..0d15070 100644 --- a/src/file/format/json.rs +++ b/src/file/format/json.rs @@ -7,7 +7,7 @@ use value::{Value, ValueKind}; pub fn parse( uri: Option<&String>, text: &str, -) -> Result, Box> { +) -> Result, Box> { // Parse a JSON object value from the text // TODO: Have a proper error fire if the root of a file is ever not a Table let value = from_json_value(uri, &serde_json::from_str(text)?); diff --git a/src/file/format/mod.rs b/src/file/format/mod.rs index 39b3813..f46ae13 100644 --- a/src/file/format/mod.rs +++ b/src/file/format/mod.rs @@ -72,22 +72,22 @@ lazy_static! { impl FileFormat { // TODO: pub(crate) #[doc(hidden)] - pub fn extensions(&self) -> &'static Vec<&'static str> { + 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() + ALL_EXTENSIONS.get(&self).unwrap() } // TODO: pub(crate) #[doc(hidden)] #[allow(unused_variables)] pub fn parse( - &self, + self, uri: Option<&String>, text: &str, - ) -> Result, Box> { - match *self { + ) -> Result, Box> { + match self { #[cfg(feature = "toml")] FileFormat::Toml => toml::parse(uri, text), diff --git a/src/file/format/toml.rs b/src/file/format/toml.rs index 26dcb2a..a40104e 100644 --- a/src/file/format/toml.rs +++ b/src/file/format/toml.rs @@ -7,7 +7,7 @@ use value::{Value, ValueKind}; pub fn parse( uri: Option<&String>, text: &str, -) -> Result, Box> { +) -> Result, Box> { // Parse a TOML value from the provided text // TODO: Have a proper error fire if the root of a file is ever not a Table let value = from_toml_value(uri, &toml::from_str(text)?); diff --git a/src/file/format/yaml.rs b/src/file/format/yaml.rs index c2b26cb..c458c3c 100644 --- a/src/file/format/yaml.rs +++ b/src/file/format/yaml.rs @@ -9,7 +9,7 @@ use yaml_rust as yaml; pub fn parse( uri: Option<&String>, text: &str, -) -> Result, Box> { +) -> Result, Box> { // Parse a YAML object from file let mut docs = yaml::YamlLoader::load_from_str(text)?; let root = match docs.len() { -- cgit v1.2.3