Skip to content

Commit

Permalink
style: thx fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
ChobobDev committed Nov 26, 2022
1 parent e6dcdc5 commit e5f1b9c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions core/src/data/value/binary_op/integer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ mod i16;
mod i32;
mod i64;
mod i8;
mod u128;
mod u16;
mod u8;
mod u32;
mod u64;
mod u128;
mod u8;

mod macros;
4 changes: 2 additions & 2 deletions core/src/data/value/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ impl TryFrom<&Value> for u64 {
Value::U16(value) => value.to_u64().ok_or(ValueError::ImpossibleCast)?,
Value::U32(value) => value.to_u64().ok_or(ValueError::ImpossibleCast)?,
Value::U64(value) => *value,
Value::U128(value) =>value.to_u64().ok_or(ValueError::ImpossibleCast)?,
Value::U128(value) => value.to_u64().ok_or(ValueError::ImpossibleCast)?,
Value::F64(value) => value.to_u64().ok_or(ValueError::ImpossibleCast)?,
Value::Str(value) => value
.parse::<u64>()
Expand Down Expand Up @@ -523,7 +523,7 @@ impl TryFrom<&Value> for u128 {
Value::U16(value) => value.to_u128().ok_or(ValueError::ImpossibleCast)?,
Value::U32(value) => value.to_u128().ok_or(ValueError::ImpossibleCast)?,
Value::U64(value) => value.to_u128().ok_or(ValueError::ImpossibleCast)?,
Value::U128(value) =>*value,
Value::U128(value) => *value,
Value::F64(value) => value.to_u128().ok_or(ValueError::ImpossibleCast)?,
Value::Str(value) => value
.parse::<u128>()
Expand Down
6 changes: 3 additions & 3 deletions core/src/data/value/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ impl TryFrom<Value> for JsonValue {
Value::U16(v) => Ok(v.into()),
Value::U32(v) => Ok(v.into()),
Value::U64(v) => Ok(v.into()),
Value::U128(v)=> JsonNumber::from_str(&v.to_string())
.map(JsonValue::Number)
.map_err(|_| ValueError::UnreachableJsonNumberParseFailure(v.to_string()).into()),
Value::U128(v) => JsonNumber::from_str(&v.to_string())
.map(JsonValue::Number)
.map_err(|_| ValueError::UnreachableJsonNumberParseFailure(v.to_string()).into()),
Value::F64(v) => Ok(v.into()),
Value::Decimal(v) => JsonNumber::from_str(&v.to_string())
.map(JsonValue::Number)
Expand Down
7 changes: 4 additions & 3 deletions core/src/data/value/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -536,8 +536,8 @@ impl Value {
use Value::*;

match self {
I8(_) | I16(_) | I32(_) | I64(_) | I128(_) | U8(_) | U16(_) | U32(_)|U64(_)|U128(_)|F64(_) | Interval(_)
| Decimal(_) => Ok(self.clone()),
I8(_) | I16(_) | I32(_) | I64(_) | I128(_) | U8(_) | U16(_) | U32(_) | U64(_)
| U128(_) | F64(_) | Interval(_) | Decimal(_) => Ok(self.clone()),
Null => Ok(Null),
_ => Err(ValueError::UnaryPlusOnNonNumeric.into()),
}
Expand Down Expand Up @@ -635,7 +635,8 @@ impl Value {
pub fn sqrt(&self) -> Result<Value> {
use Value::*;
match self {
I8(_) | I16(_) | I64(_) | I128(_) | U8(_) | U16(_) |U32(_)|U64(_)|U128(_)|F64(_) => {
I8(_) | I16(_) | I64(_) | I128(_) | U8(_) | U16(_) | U32(_) | U64(_) | U128(_)
| F64(_) => {
let a: f64 = self.try_into()?;
Ok(Value::F64(a.sqrt()))
}
Expand Down

0 comments on commit e5f1b9c

Please sign in to comment.