Clippy lints

This commit is contained in:
Magnus Ulimoen 2021-08-16 20:33:57 +00:00
parent 4d44b4a74a
commit 2d473b8255
8 changed files with 14 additions and 5 deletions

View File

@ -5,6 +5,7 @@ use super::GAMMA;
use ndarray::{azip, ArrayView, ArrayViewMut, Dimension}; use ndarray::{azip, ArrayView, ArrayViewMut, Dimension};
pub trait Evaluator<D: Dimension>: Send + Sync { pub trait Evaluator<D: Dimension>: Send + Sync {
#[allow(clippy::too_many_arguments)]
fn evaluate( fn evaluate(
&self, &self,
t: Float, t: Float,
@ -55,6 +56,7 @@ pub trait EvaluatorPressure<D: Dimension>: Send + Sync {
rho: ArrayView<Float, D>, rho: ArrayView<Float, D>,
out: ArrayViewMut<Float, D>, out: ArrayViewMut<Float, D>,
); );
#[allow(clippy::too_many_arguments)]
fn p( fn p(
&self, &self,
t: Float, t: Float,
@ -70,6 +72,7 @@ pub trait EvaluatorPressure<D: Dimension>: Send + Sync {
impl<'a, D: Dimension, BP: EvaluatorPressure<D>> Evaluator<D> impl<'a, D: Dimension, BP: EvaluatorPressure<D>> Evaluator<D>
for EvaluatorPressureWrapper<'a, D, BP> for EvaluatorPressureWrapper<'a, D, BP>
{ {
#[allow(clippy::many_single_char_names)]
fn evaluate( fn evaluate(
&self, &self,
t: Float, t: Float,

View File

@ -330,6 +330,7 @@ impl Field {
let (rho, rhou, rhov, e) = self.components_mut(); let (rho, rhou, rhov, e) = self.components_mut();
vortex_param.evaluate(time, x, y, rho, rhou, rhov, e) vortex_param.evaluate(time, x, y, rho, rhou, rhov, e)
} }
#[allow(clippy::erasing_op, clippy::identity_op)]
fn iter(&self) -> impl ExactSizeIterator<Item = FieldValue> + '_ { fn iter(&self) -> impl ExactSizeIterator<Item = FieldValue> + '_ {
let n = self.nx() * self.ny(); let n = self.nx() * self.ny();
let slice = self.0.as_slice().unwrap(); let slice = self.0.as_slice().unwrap();

View File

@ -10,6 +10,7 @@ pub enum Evaluator {
} }
impl<D: Dimension> euler::eval::Evaluator<D> for Evaluator { impl<D: Dimension> euler::eval::Evaluator<D> for Evaluator {
#[allow(clippy::many_single_char_names)]
fn evaluate( fn evaluate(
&self, &self,
t: Float, t: Float,

View File

@ -79,6 +79,7 @@ pub struct EvaluatorConservation {
} }
impl<D: Dimension> euler::eval::Evaluator<D> for Evaluator { impl<D: Dimension> euler::eval::Evaluator<D> for Evaluator {
#[allow(clippy::many_single_char_names)]
fn evaluate( fn evaluate(
&self, &self,
t: Float, t: Float,
@ -267,6 +268,7 @@ impl<D: Dimension> euler::eval::EvaluatorPressure<D> for EvaluatorPressure {
}) })
} }
#[allow(clippy::many_single_char_names)]
fn p( fn p(
&self, &self,
t: Float, t: Float,

View File

@ -77,12 +77,12 @@ fn main() {
} = config.into_runtime(); } = config.into_runtime();
let basesystem = system::BaseSystem::new( let basesystem = system::BaseSystem::new(
names.clone(), names,
grids, grids,
0.0, 0.0,
operators, operators,
boundary_conditions, boundary_conditions,
initial_conditions.clone(), initial_conditions,
opt.output.clone(), opt.output.clone(),
); );
// System::new(grids, grid_connections, operators); // System::new(grids, grid_connections, operators);

View File

@ -48,6 +48,7 @@ impl BaseSystem {
output, output,
} }
} }
#[allow(clippy::many_single_char_names)]
pub fn create(self) -> System { pub fn create(self) -> System {
let fnow = self let fnow = self
.grids .grids
@ -134,7 +135,7 @@ impl BaseSystem {
} }
} }
*/ */
parsing::InitialConditions::Vortex(vortexparams) => sys.vortex(0.0, &vortexparams), parsing::InitialConditions::Vortex(vortexparams) => sys.vortex(0.0, vortexparams),
parsing::InitialConditions::Expressions(expr) => { parsing::InitialConditions::Expressions(expr) => {
let t = 0.0; let t = 0.0;
for (grid, field) in sys.grids.iter().zip(sys.fnow.iter_mut()) { for (grid, field) in sys.grids.iter().zip(sys.fnow.iter_mut()) {
@ -413,7 +414,7 @@ impl integrate::Integrable for SingleThreadedSystem {
impl SingleThreadedSystem { impl SingleThreadedSystem {
pub fn vortex(&mut self, t: Float, vortex_params: &euler::VortexParameters) { pub fn vortex(&mut self, t: Float, vortex_params: &euler::VortexParameters) {
for (f, g) in self.fnow.iter_mut().zip(&self.grids) { for (f, g) in self.fnow.iter_mut().zip(&self.grids) {
f.vortex(g.x(), g.y(), t, &vortex_params); f.vortex(g.x(), g.y(), t, vortex_params);
} }
} }

View File

@ -281,6 +281,7 @@ pub(crate) fn diff_op_2d_fallback<const M: usize, const N: usize, const D: usize
#[inline(always)] #[inline(always)]
/// 2D diff when first axis is contiguous /// 2D diff when first axis is contiguous
#[allow(unused)] #[allow(unused)]
#[allow(clippy::assign_op_pattern)]
pub(crate) fn diff_op_2d_sliceable_y<const M: usize, const N: usize, const D: usize>( pub(crate) fn diff_op_2d_sliceable_y<const M: usize, const N: usize, const D: usize>(
matrix: &BlockMatrix<Float, M, N, D>, matrix: &BlockMatrix<Float, M, N, D>,
optype: OperatorType, optype: OperatorType,

View File

@ -215,7 +215,7 @@ pub fn integrate<BTableau: ButcherTableau, F: Integrable, RHS>(
} }
}; };
rhs(&mut k[i], &fut, simtime); rhs(&mut k[i], fut, simtime);
} }
} }