diff --git a/euler/src/lib.rs b/euler/src/lib.rs index 4394c2a..1811856 100644 --- a/euler/src/lib.rs +++ b/euler/src/lib.rs @@ -748,11 +748,11 @@ impl std::fmt::Debug for BoundaryCharacteristic { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Self::This => write!(f, "This"), - Self::Grid(g) => write!(f, "Grid({})", g), - Self::Vortex(vp) => write!(f, "{:?}", vp), + Self::Grid(g) => write!(f, "Grid({g})"), + Self::Vortex(vp) => write!(f, "{vp:?}"), Self::Eval(_) => write!(f, "Eval"), Self::Interpolate(_, _) => write!(f, "Interpolate"), - Self::MultiGrid(m) => write!(f, "Multigrid: {:?}", m), + Self::MultiGrid(m) => write!(f, "Multigrid: {m:?}"), } } } diff --git a/multigrid/src/input.rs b/multigrid/src/input.rs index 3319e18..faa9029 100644 --- a/multigrid/src/input.rs +++ b/multigrid/src/input.rs @@ -117,10 +117,10 @@ pub enum InterpolationOperator { NineH2, } -impl Into> for InterpolationOperator { - fn into(self) -> Box { +impl From for Box { + fn from(val: InterpolationOperator) -> Self { use sbp::operators::{Interpolation4, Interpolation8, Interpolation9, Interpolation9h2}; - match self { + match val { InterpolationOperator::Four => Box::new(Interpolation4), InterpolationOperator::Eight => Box::new(Interpolation8), InterpolationOperator::Nine => Box::new(Interpolation9), diff --git a/multigrid/src/main.rs b/multigrid/src/main.rs index 43d7a7e..487ab58 100644 --- a/multigrid/src/main.rs +++ b/multigrid/src/main.rs @@ -56,13 +56,13 @@ fn main() { let config: input::Configuration = match json5::from_str(&filecontents) { Ok(config) => config, Err(e) => { - eprintln!("Configuration could not be read: {}", e); + eprintln!("Configuration could not be read: {e}"); if let json5::Error::Message { location: Some(location), .. } = e { - eprintln!("\t{:?}", location); + eprintln!("\t{location:?}"); } return; } @@ -157,7 +157,7 @@ fn main() { println!("Time elapsed: {} seconds", duration.as_secs_f64()); } if let Some(error) = outinfo.error { - println!("Total error: {:e}", error); + println!("Total error: {error:e}"); } } } diff --git a/multigrid/src/parsing.rs b/multigrid/src/parsing.rs index 035ff70..29776e8 100644 --- a/multigrid/src/parsing.rs +++ b/multigrid/src/parsing.rs @@ -139,12 +139,12 @@ impl input::Configuration { let xi = operators.xi.unwrap_or_else(|| { default_operators .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(|| { default_operators .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; @@ -183,9 +183,8 @@ impl input::Configuration { BoundaryConditions::Expressions(expr) => { euler::BoundaryCharacteristic::Eval(expr.clone() ) } - _ => panic!( - "Boundary conditions are not available, but needed for grid {}", - name + BoundaryConditions::NotNeeded => panic!( + "Boundary conditions are not available, but needed for grid {name}" ), }, Some(BoundaryType::This) => euler::BoundaryCharacteristic::This, @@ -193,7 +192,7 @@ impl input::Configuration { if let BoundaryConditions::Vortex(vortex) = &boundary_conditions { vortex.clone() } 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)) => { diff --git a/multigrid/src/system.rs b/multigrid/src/system.rs index 4779fd1..44c25bb 100644 --- a/multigrid/src/system.rs +++ b/multigrid/src/system.rs @@ -200,7 +200,7 @@ impl BaseSystem { .zip(push) .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 { euler::BoundaryCharacteristic::This => DistributedBoundaryConditions::This, @@ -444,7 +444,7 @@ impl System { for _ in 0..sys.sys.len() { e += match sys.recv.recv().unwrap() { (_, MsgToHost::Error(e)) => e, - (_, m) => panic!("Unexpected message: {:?}", m), + (_, m) => panic!("Unexpected message: {m:?}"), } } e diff --git a/utils/constmatrix/src/lib.rs b/utils/constmatrix/src/lib.rs index 91c5526..7e19022 100644 --- a/utils/constmatrix/src/lib.rs +++ b/utils/constmatrix/src/lib.rs @@ -258,7 +258,7 @@ mod approx { fn default_epsilon() -> Self::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() .zip(other.iter()) .all(|(r, l)| r.abs_diff_eq(l, T::default_epsilon()))