diff options
author | Ryan Leckey <ryan@launchbadge.com> | 2019-12-07 18:14:13 -0800 |
---|---|---|
committer | Ryan Leckey <ryan@launchbadge.com> | 2019-12-07 18:14:13 -0800 |
commit | 8fb71a3051c0c09f37129d9c1884c778a4ea4cea (patch) | |
tree | 39e5f98f19b0633314ed9aca750e6b0263bf19a6 /src | |
parent | 51ae442e74f0a9d99707a5887afa9159985ad104 (diff) |
Remove automatic lowercase
Diffstat (limited to 'src')
-rw-r--r-- | src/config.rs | 6 | ||||
-rw-r--r-- | src/de.rs | 2 | ||||
-rw-r--r-- | src/file/format/hjson.rs | 2 | ||||
-rw-r--r-- | src/file/format/ini.rs | 6 | ||||
-rw-r--r-- | src/file/format/json.rs | 2 | ||||
-rw-r--r-- | src/file/format/toml.rs | 2 | ||||
-rw-r--r-- | src/file/format/yaml.rs | 2 | ||||
-rw-r--r-- | src/ser.rs | 10 |
8 files changed, 16 insertions, 16 deletions
diff --git a/src/config.rs b/src/config.rs index 7e031d0..e54daa2 100644 --- a/src/config.rs +++ b/src/config.rs @@ -125,7 +125,7 @@ impl Config { ConfigKind::Mutable { ref mut defaults, .. } => { - defaults.insert(key.to_lowercase().parse()?, value.into()); + defaults.insert(key.parse()?, value.into()); } ConfigKind::Frozen => return Err(ConfigError::Frozen), @@ -142,7 +142,7 @@ impl Config { ConfigKind::Mutable { ref mut overrides, .. } => { - overrides.insert(key.to_lowercase().parse()?, value.into()); + overrides.insert(key.parse()?, value.into()); } ConfigKind::Frozen => return Err(ConfigError::Frozen), @@ -153,7 +153,7 @@ impl Config { pub fn get<'de, T: Deserialize<'de>>(&self, key: &str) -> Result<T> { // Parse the key into a path expression - let expr: path::Expression = key.to_lowercase().parse()?; + let expr: path::Expression = key.parse()?; // Traverse the cache using the path to (possibly) retrieve a value let value = expr.get(&self.cache).cloned(); @@ -244,7 +244,7 @@ impl EnumAccess { fn variant_deserializer(&self, name: &String) -> Result<StrDeserializer> { self.variants .iter() - .find(|&s| s.to_lowercase() == name.to_lowercase()) + .find(|&s| s == name) .map(|&s| StrDeserializer(s)) .ok_or(self.no_constructor_error(name)) } diff --git a/src/file/format/hjson.rs b/src/file/format/hjson.rs index bb21e38..cb0a064 100644 --- a/src/file/format/hjson.rs +++ b/src/file/format/hjson.rs @@ -34,7 +34,7 @@ fn from_hjson_value(uri: Option<&String>, value: &serde_hjson::Value) -> Value { let mut m = HashMap::new(); for (key, value) in table { - m.insert(key.to_lowercase().clone(), from_hjson_value(uri, value)); + m.insert(key.clone(), from_hjson_value(uri, value)); } Value::new(uri, ValueKind::Table(m)) diff --git a/src/file/format/ini.rs b/src/file/format/ini.rs index b4b4ada..845de3a 100644 --- a/src/file/format/ini.rs +++ b/src/file/format/ini.rs @@ -16,19 +16,19 @@ pub fn parse( let mut sec_map: HashMap<String, Value> = HashMap::new(); for (k, v) in prop.iter() { sec_map.insert( - k.to_lowercase().clone(), + k.clone(), Value::new(uri, ValueKind::String(v.clone())), ); } map.insert( - sec.to_lowercase().clone(), + sec.clone(), Value::new(uri, ValueKind::Table(sec_map)), ); } None => { for (k, v) in prop.iter() { map.insert( - k.to_lowercase().clone(), + k.clone(), Value::new(uri, ValueKind::String(v.clone())), ); } diff --git a/src/file/format/json.rs b/src/file/format/json.rs index caf62f5..87240a3 100644 --- a/src/file/format/json.rs +++ b/src/file/format/json.rs @@ -36,7 +36,7 @@ fn from_json_value(uri: Option<&String>, value: &serde_json::Value) -> Value { let mut m = HashMap::new(); for (key, value) in table { - m.insert(key.to_lowercase().clone(), from_json_value(uri, value)); + m.insert(key.clone(), from_json_value(uri, value)); } Value::new(uri, ValueKind::Table(m)) diff --git a/src/file/format/toml.rs b/src/file/format/toml.rs index da7782f..26dcb2a 100644 --- a/src/file/format/toml.rs +++ b/src/file/format/toml.rs @@ -29,7 +29,7 @@ fn from_toml_value(uri: Option<&String>, value: &toml::Value) -> Value { let mut m = HashMap::new(); for (key, value) in table { - m.insert(key.to_lowercase().clone(), from_toml_value(uri, value)); + m.insert(key.clone(), from_toml_value(uri, value)); } Value::new(uri, m) diff --git a/src/file/format/yaml.rs b/src/file/format/yaml.rs index 5ec8ca6..c2b26cb 100644 --- a/src/file/format/yaml.rs +++ b/src/file/format/yaml.rs @@ -42,7 +42,7 @@ fn from_yaml_value(uri: Option<&String>, value: &yaml::Yaml) -> Value { let mut m = HashMap::new(); for (key, value) in table { if let Some(k) = key.as_str() { - m.insert(k.to_lowercase().to_owned(), from_yaml_value(uri, value)); + m.insert(k.to_owned(), from_yaml_value(uri, value)); } // TODO: should we do anything for non-string keys? } @@ -186,7 +186,7 @@ impl<'a> ser::Serializer for &'a mut ConfigSerializer { _variant_index: u32, variant: &'static str, ) -> Result<Self::Ok> { - self.serialize_str(&variant.to_lowercase()) + self.serialize_str(&variant) } fn serialize_newtype_struct<T>(self, _name: &'static str, value: &T) -> Result<Self::Ok> @@ -206,7 +206,7 @@ impl<'a> ser::Serializer for &'a mut ConfigSerializer { where T: ?Sized + ser::Serialize, { - self.push_key(&variant.to_lowercase()); + self.push_key(&variant); value.serialize(&mut *self)?; self.pop_key(); Ok(()) @@ -235,7 +235,7 @@ impl<'a> ser::Serializer for &'a mut ConfigSerializer { variant: &'static str, _len: usize, ) -> Result<Self::SerializeTupleVariant> { - self.push_key(&variant.to_lowercase()); + self.push_key(&variant); Ok(self) } @@ -254,7 +254,7 @@ impl<'a> ser::Serializer for &'a mut ConfigSerializer { variant: &'static str, len: usize, ) -> Result<Self::SerializeStructVariant> { - self.push_key(&variant.to_lowercase()); + self.push_key(&variant); Ok(self) } } @@ -493,7 +493,7 @@ impl ser::Serializer for StringKeySerializer { _variant_index: u32, variant: &str, ) -> Result<Self::Ok> { - Ok(variant.to_lowercase()) + Ok(variant.to_string()) } fn serialize_newtype_struct<T>(self, _name: &str, value: &T) -> Result<Self::Ok> |