Skip to content

Commit

Permalink
fixup! Add support for different sized integers
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasbeyer committed Jun 3, 2021
1 parent fe35759 commit 5ac94c9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ impl Source for Environment {
if let Ok(parsed) = value.to_lowercase().parse::<bool>() {
ValueKind::Boolean(parsed)
} else if let Ok(parsed) = value.parse::<i64>() {
ValueKind::Integer(parsed)
ValueKind::I64(parsed)
} else if let Ok(parsed) = value.parse::<f64>() {
ValueKind::Float(parsed)
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/file/format/json5.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub fn parse(
) -> Result<HashMap<String, Value>, Box<dyn Error + Send + Sync>> {
match json5_rs::from_str::<Val>(&text)? {
Val::String(ref value) => Err(Unexpected::Str(value.clone())),
Val::Integer(value) => Err(Unexpected::Integer(value)),
Val::Integer(value) => Err(Unexpected::I64(value)),
Val::Float(value) => Err(Unexpected::Float(value)),
Val::Boolean(value) => Err(Unexpected::Bool(value)),
Val::Array(_) => Err(Unexpected::Seq),
Expand All @@ -40,7 +40,7 @@ fn from_json5_value(uri: Option<&String>, value: Val) -> Value {
let vk = match value {
Val::Null => ValueKind::Nil,
Val::String(v) => ValueKind::String(v),
Val::Integer(v) => ValueKind::Integer(v),
Val::Integer(v) => ValueKind::I64(v),
Val::Float(v) => ValueKind::Float(v),
Val::Boolean(v) => ValueKind::Boolean(v),
Val::Object(table) => {
Expand Down
2 changes: 1 addition & 1 deletion src/file/format/ron.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ fn from_ron_value(

ron::Value::Number(value) => match value {
ron::Number::Float(value) => ValueKind::Float(value.get()),
ron::Number::Integer(value) => ValueKind::Integer(value),
ron::Number::Integer(value) => ValueKind::I64(value),
},

ron::Value::Char(value) => ValueKind::String(value.to_string()),
Expand Down

0 comments on commit 5ac94c9

Please sign in to comment.