Clippy lint fixes
This commit is contained in:
parent
4c5c0305e4
commit
909e15572e
|
@ -748,11 +748,11 @@ impl std::fmt::Debug for BoundaryCharacteristic {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
Self::This => write!(f, "This"),
|
Self::This => write!(f, "This"),
|
||||||
Self::Grid(g) => write!(f, "Grid({})", g),
|
Self::Grid(g) => write!(f, "Grid({g})"),
|
||||||
Self::Vortex(vp) => write!(f, "{:?}", vp),
|
Self::Vortex(vp) => write!(f, "{vp:?}"),
|
||||||
Self::Eval(_) => write!(f, "Eval"),
|
Self::Eval(_) => write!(f, "Eval"),
|
||||||
Self::Interpolate(_, _) => write!(f, "Interpolate"),
|
Self::Interpolate(_, _) => write!(f, "Interpolate"),
|
||||||
Self::MultiGrid(m) => write!(f, "Multigrid: {:?}", m),
|
Self::MultiGrid(m) => write!(f, "Multigrid: {m:?}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,10 +117,10 @@ pub enum InterpolationOperator {
|
||||||
NineH2,
|
NineH2,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Into<Box<dyn sbp::operators::InterpolationOperator>> for InterpolationOperator {
|
impl From<InterpolationOperator> for Box<dyn sbp::operators::InterpolationOperator> {
|
||||||
fn into(self) -> Box<dyn sbp::operators::InterpolationOperator> {
|
fn from(val: InterpolationOperator) -> Self {
|
||||||
use sbp::operators::{Interpolation4, Interpolation8, Interpolation9, Interpolation9h2};
|
use sbp::operators::{Interpolation4, Interpolation8, Interpolation9, Interpolation9h2};
|
||||||
match self {
|
match val {
|
||||||
InterpolationOperator::Four => Box::new(Interpolation4),
|
InterpolationOperator::Four => Box::new(Interpolation4),
|
||||||
InterpolationOperator::Eight => Box::new(Interpolation8),
|
InterpolationOperator::Eight => Box::new(Interpolation8),
|
||||||
InterpolationOperator::Nine => Box::new(Interpolation9),
|
InterpolationOperator::Nine => Box::new(Interpolation9),
|
||||||
|
|
|
@ -56,13 +56,13 @@ fn main() {
|
||||||
let config: input::Configuration = match json5::from_str(&filecontents) {
|
let config: input::Configuration = match json5::from_str(&filecontents) {
|
||||||
Ok(config) => config,
|
Ok(config) => config,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
eprintln!("Configuration could not be read: {}", e);
|
eprintln!("Configuration could not be read: {e}");
|
||||||
if let json5::Error::Message {
|
if let json5::Error::Message {
|
||||||
location: Some(location),
|
location: Some(location),
|
||||||
..
|
..
|
||||||
} = e
|
} = e
|
||||||
{
|
{
|
||||||
eprintln!("\t{:?}", location);
|
eprintln!("\t{location:?}");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -157,7 +157,7 @@ fn main() {
|
||||||
println!("Time elapsed: {} seconds", duration.as_secs_f64());
|
println!("Time elapsed: {} seconds", duration.as_secs_f64());
|
||||||
}
|
}
|
||||||
if let Some(error) = outinfo.error {
|
if let Some(error) = outinfo.error {
|
||||||
println!("Total error: {:e}", error);
|
println!("Total error: {error:e}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,12 +139,12 @@ impl input::Configuration {
|
||||||
let xi = operators.xi.unwrap_or_else(|| {
|
let xi = operators.xi.unwrap_or_else(|| {
|
||||||
default_operators
|
default_operators
|
||||||
.xi
|
.xi
|
||||||
.unwrap_or_else(|| panic!("No xi operator found for grid: {}", name))
|
.unwrap_or_else(|| panic!("No xi operator found for grid: {name}"))
|
||||||
});
|
});
|
||||||
let eta = operators.eta.unwrap_or_else(|| {
|
let eta = operators.eta.unwrap_or_else(|| {
|
||||||
default_operators
|
default_operators
|
||||||
.eta
|
.eta
|
||||||
.unwrap_or_else(|| panic!("No eta operator found for grid: {}", name))
|
.unwrap_or_else(|| panic!("No eta operator found for grid: {name}"))
|
||||||
});
|
});
|
||||||
|
|
||||||
use input::Operator as op;
|
use input::Operator as op;
|
||||||
|
@ -183,9 +183,8 @@ impl input::Configuration {
|
||||||
BoundaryConditions::Expressions(expr) => {
|
BoundaryConditions::Expressions(expr) => {
|
||||||
euler::BoundaryCharacteristic::Eval(expr.clone() )
|
euler::BoundaryCharacteristic::Eval(expr.clone() )
|
||||||
}
|
}
|
||||||
_ => panic!(
|
BoundaryConditions::NotNeeded => panic!(
|
||||||
"Boundary conditions are not available, but needed for grid {}",
|
"Boundary conditions are not available, but needed for grid {name}"
|
||||||
name
|
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
Some(BoundaryType::This) => euler::BoundaryCharacteristic::This,
|
Some(BoundaryType::This) => euler::BoundaryCharacteristic::This,
|
||||||
|
@ -193,7 +192,7 @@ impl input::Configuration {
|
||||||
if let BoundaryConditions::Vortex(vortex) = &boundary_conditions {
|
if let BoundaryConditions::Vortex(vortex) = &boundary_conditions {
|
||||||
vortex.clone()
|
vortex.clone()
|
||||||
} else {
|
} else {
|
||||||
panic!("Wanted vortex boundary conditions not found, needed for grid {}", name)
|
panic!("Wanted vortex boundary conditions not found, needed for grid {name}")
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
Some(BoundaryType::Neighbour(name)) => {
|
Some(BoundaryType::Neighbour(name)) => {
|
||||||
|
|
|
@ -200,7 +200,7 @@ impl BaseSystem {
|
||||||
.zip(push)
|
.zip(push)
|
||||||
.enumerate()
|
.enumerate()
|
||||||
{
|
{
|
||||||
let builder = std::thread::Builder::new().name(format!("mg: {}", name));
|
let builder = std::thread::Builder::new().name(format!("mg: {name}"));
|
||||||
|
|
||||||
let boundary_conditions = bt.map(|bt| match bt {
|
let boundary_conditions = bt.map(|bt| match bt {
|
||||||
euler::BoundaryCharacteristic::This => DistributedBoundaryConditions::This,
|
euler::BoundaryCharacteristic::This => DistributedBoundaryConditions::This,
|
||||||
|
@ -444,7 +444,7 @@ impl System {
|
||||||
for _ in 0..sys.sys.len() {
|
for _ in 0..sys.sys.len() {
|
||||||
e += match sys.recv.recv().unwrap() {
|
e += match sys.recv.recv().unwrap() {
|
||||||
(_, MsgToHost::Error(e)) => e,
|
(_, MsgToHost::Error(e)) => e,
|
||||||
(_, m) => panic!("Unexpected message: {:?}", m),
|
(_, m) => panic!("Unexpected message: {m:?}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
e
|
e
|
||||||
|
|
|
@ -258,7 +258,7 @@ mod approx {
|
||||||
fn default_epsilon() -> Self::Epsilon {
|
fn default_epsilon() -> Self::Epsilon {
|
||||||
T::default_epsilon()
|
T::default_epsilon()
|
||||||
}
|
}
|
||||||
fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool {
|
fn abs_diff_eq(&self, other: &Self, _epsilon: Self::Epsilon) -> bool {
|
||||||
self.iter()
|
self.iter()
|
||||||
.zip(other.iter())
|
.zip(other.iter())
|
||||||
.all(|(r, l)| r.abs_diff_eq(l, T::default_epsilon()))
|
.all(|(r, l)| r.abs_diff_eq(l, T::default_epsilon()))
|
||||||
|
|
Loading…
Reference in New Issue