Fix clippy warnings
This commit is contained in:
parent
e3b5457fe6
commit
c14f809614
@ -37,14 +37,14 @@ pub enum VectorDirection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl VectorDirection {
|
impl VectorDirection {
|
||||||
pub fn swap(&self) -> Self {
|
pub const fn swap(&self) -> Self {
|
||||||
match self {
|
match self {
|
||||||
Self::Row => Self::Column,
|
Self::Row => Self::Column,
|
||||||
Self::Column => Self::Row,
|
Self::Column => Self::Row,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_separator(&self) -> &str {
|
pub const fn get_separator(&self) -> &str {
|
||||||
match self {
|
match self {
|
||||||
Self::Row => " ",
|
Self::Row => " ",
|
||||||
Self::Column => "; ",
|
Self::Column => "; ",
|
||||||
@ -333,10 +333,10 @@ impl CalculatorEntry for Vector {
|
|||||||
.try_fold(Entry::Number(Number::ZERO), |acc, n2| {
|
.try_fold(Entry::Number(Number::ZERO), |acc, n2| {
|
||||||
acc.add(&n2.pow_num(&Number { value: 2.0_f64 })?)
|
acc.add(&n2.pow_num(&Number { value: 2.0_f64 })?)
|
||||||
})?;
|
})?;
|
||||||
Ok(value.sqrt()?)
|
value.sqrt()
|
||||||
}
|
}
|
||||||
fn inverse(&self) -> CalculatorResult<Entry> {
|
fn inverse(&self) -> CalculatorResult<Entry> {
|
||||||
Ok(Entry::Vector(Vector {
|
Ok(Entry::Vector(Self {
|
||||||
values: self.values.clone(),
|
values: self.values.clone(),
|
||||||
direction: self.direction.swap(),
|
direction: self.direction.swap(),
|
||||||
}))
|
}))
|
||||||
@ -607,7 +607,7 @@ impl CalculatorEntry for Number {
|
|||||||
value: match angle_mode {
|
value: match angle_mode {
|
||||||
CalculatorAngleMode::Degrees => self.value.asin().to_degrees(),
|
CalculatorAngleMode::Degrees => self.value.asin().to_degrees(),
|
||||||
CalculatorAngleMode::Radians => self.value.asin(),
|
CalculatorAngleMode::Radians => self.value.asin(),
|
||||||
CalculatorAngleMode::Grads => self.value.asin() * std::f64::consts::PI / 200.0,
|
CalculatorAngleMode::Grads => self.value.asin() * 200.0 / std::f64::consts::PI,
|
||||||
},
|
},
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
@ -616,7 +616,7 @@ impl CalculatorEntry for Number {
|
|||||||
value: match angle_mode {
|
value: match angle_mode {
|
||||||
CalculatorAngleMode::Degrees => self.value.acos().to_degrees(),
|
CalculatorAngleMode::Degrees => self.value.acos().to_degrees(),
|
||||||
CalculatorAngleMode::Radians => self.value.acos(),
|
CalculatorAngleMode::Radians => self.value.acos(),
|
||||||
CalculatorAngleMode::Grads => self.value.acos() * std::f64::consts::PI / 200.0,
|
CalculatorAngleMode::Grads => self.value.acos() * 200.0 / std::f64::consts::PI,
|
||||||
},
|
},
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
@ -625,7 +625,7 @@ impl CalculatorEntry for Number {
|
|||||||
value: match angle_mode {
|
value: match angle_mode {
|
||||||
CalculatorAngleMode::Degrees => self.value.atan().to_degrees(),
|
CalculatorAngleMode::Degrees => self.value.atan().to_degrees(),
|
||||||
CalculatorAngleMode::Radians => self.value.atan(),
|
CalculatorAngleMode::Radians => self.value.atan(),
|
||||||
CalculatorAngleMode::Grads => self.value.atan() * std::f64::consts::PI / 200.0,
|
CalculatorAngleMode::Grads => self.value.atan() * 200.0 / std::f64::consts::PI,
|
||||||
},
|
},
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user