Various clippy fixes. (#403)
This commit is contained in:
@@ -28,18 +28,18 @@ impl RuntimeValue {
|
||||
/// Return the type of this `RuntimeValue`.
|
||||
pub fn value_type(self) -> ir::Type {
|
||||
match self {
|
||||
RuntimeValue::I32(_) => ir::types::I32,
|
||||
RuntimeValue::I64(_) => ir::types::I64,
|
||||
RuntimeValue::F32(_) => ir::types::F32,
|
||||
RuntimeValue::F64(_) => ir::types::F64,
|
||||
RuntimeValue::V128(_) => ir::types::I8X16,
|
||||
Self::I32(_) => ir::types::I32,
|
||||
Self::I64(_) => ir::types::I64,
|
||||
Self::F32(_) => ir::types::F32,
|
||||
Self::F64(_) => ir::types::F64,
|
||||
Self::V128(_) => ir::types::I8X16,
|
||||
}
|
||||
}
|
||||
|
||||
/// Assuming this `RuntimeValue` holds an `i32`, return that value.
|
||||
pub fn unwrap_i32(self) -> i32 {
|
||||
match self {
|
||||
RuntimeValue::I32(x) => x,
|
||||
Self::I32(x) => x,
|
||||
_ => panic!("unwrapping value of type {} as i32", self.value_type()),
|
||||
}
|
||||
}
|
||||
@@ -47,7 +47,7 @@ impl RuntimeValue {
|
||||
/// Assuming this `RuntimeValue` holds an `i64`, return that value.
|
||||
pub fn unwrap_i64(self) -> i64 {
|
||||
match self {
|
||||
RuntimeValue::I64(x) => x,
|
||||
Self::I64(x) => x,
|
||||
_ => panic!("unwrapping value of type {} as i64", self.value_type()),
|
||||
}
|
||||
}
|
||||
@@ -60,7 +60,7 @@ impl RuntimeValue {
|
||||
/// Assuming this `RuntimeValue` holds an `f32`, return the bits of that value as a `u32`.
|
||||
pub fn unwrap_f32_bits(self) -> u32 {
|
||||
match self {
|
||||
RuntimeValue::F32(x) => x,
|
||||
Self::F32(x) => x,
|
||||
_ => panic!("unwrapping value of type {} as f32", self.value_type()),
|
||||
}
|
||||
}
|
||||
@@ -73,7 +73,7 @@ impl RuntimeValue {
|
||||
/// Assuming this `RuntimeValue` holds an `f64`, return the bits of that value as a `u64`.
|
||||
pub fn unwrap_f64_bits(self) -> u64 {
|
||||
match self {
|
||||
RuntimeValue::F64(x) => x,
|
||||
Self::F64(x) => x,
|
||||
_ => panic!("unwrapping value of type {} as f64", self.value_type()),
|
||||
}
|
||||
}
|
||||
@@ -82,11 +82,11 @@ impl RuntimeValue {
|
||||
impl fmt::Display for RuntimeValue {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
RuntimeValue::I32(x) => write!(f, "{}: i32", x),
|
||||
RuntimeValue::I64(x) => write!(f, "{}: i64", x),
|
||||
RuntimeValue::F32(x) => write!(f, "{}: f32", x),
|
||||
RuntimeValue::F64(x) => write!(f, "{}: f64", x),
|
||||
RuntimeValue::V128(x) => write!(f, "{:?}: v128", x.to_vec()),
|
||||
Self::I32(x) => write!(f, "{}: i32", x),
|
||||
Self::I64(x) => write!(f, "{}: i64", x),
|
||||
Self::F32(x) => write!(f, "{}: f32", x),
|
||||
Self::F64(x) => write!(f, "{}: f64", x),
|
||||
Self::V128(x) => write!(f, "{:?}: v128", x.to_vec()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user