Skip to content

Commit

Permalink
Merge pull request #376 from mulimoen/clippy
Browse files Browse the repository at this point in the history
Clippy lints
  • Loading branch information
mulimoen authored Jan 20, 2025
2 parents be00262 + 725cb9f commit 3898a15
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 56 deletions.
2 changes: 1 addition & 1 deletion sprs/src/dense_vector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ pub trait DenseVectorMut: DenseVector {
fn index_mut(&mut self, idx: usize) -> &mut Self::Scalar;
}

impl<'a, N: 'a + Zero + Clone> DenseVectorMut for [N] {
impl<N: Zero + Clone> DenseVectorMut for [N] {
#[inline(always)]
fn index_mut(&mut self, idx: usize) -> &mut N {
&mut self[idx]
Expand Down
2 changes: 1 addition & 1 deletion sprs/src/num_matrixmarket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::num_kinds::Pattern;

pub struct Displayable<T>(T);

impl<'a> Display for Displayable<&'a Pattern> {
impl Display for Displayable<&Pattern> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
// write nothing for pattern
write!(f, "")
Expand Down
72 changes: 36 additions & 36 deletions sprs/src/sparse/csmat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1820,14 +1820,14 @@ pub mod raw {
}
}

impl<'a, I, Iptr, IpStorage, IStorage, DStorage, T> std::ops::MulAssign<T>
impl<I, Iptr, IpStorage, IStorage, DStorage, T> std::ops::MulAssign<T>
for CsMatBase<T, I, IpStorage, IStorage, DStorage, Iptr>
where
I: 'a + SpIndex,
Iptr: 'a + SpIndex,
IpStorage: 'a + Deref<Target = [Iptr]>,
IStorage: 'a + Deref<Target = [I]>,
DStorage: 'a + DerefMut<Target = [T]>,
I: SpIndex,
Iptr: SpIndex,
IpStorage: Deref<Target = [Iptr]>,
IStorage: Deref<Target = [I]>,
DStorage: DerefMut<Target = [T]>,
T: std::ops::MulAssign<T> + Clone,
{
fn mul_assign(&mut self, rhs: T) {
Expand All @@ -1837,14 +1837,14 @@ where
}
}

impl<'a, I, Iptr, IpStorage, IStorage, DStorage, T> std::ops::DivAssign<T>
impl<I, Iptr, IpStorage, IStorage, DStorage, T> std::ops::DivAssign<T>
for CsMatBase<T, I, IpStorage, IStorage, DStorage, Iptr>
where
I: 'a + SpIndex,
Iptr: 'a + SpIndex,
IpStorage: 'a + Deref<Target = [Iptr]>,
IStorage: 'a + Deref<Target = [I]>,
DStorage: 'a + DerefMut<Target = [T]>,
I: SpIndex,
Iptr: SpIndex,
IpStorage: Deref<Target = [Iptr]>,
IStorage: Deref<Target = [I]>,
DStorage: DerefMut<Target = [T]>,
T: std::ops::DivAssign<T> + Clone,
{
fn div_assign(&mut self, rhs: T) {
Expand Down Expand Up @@ -1879,7 +1879,7 @@ where
}

/// Multiply two sparse matrices.
///
/// This function is generic over `MulAcc`, and supports accumulating
/// into a different output type. This is not the default for `Mul`,
/// as type inference fails for intermediaries
Expand Down Expand Up @@ -2038,15 +2038,15 @@ where
}
}

impl<'a, 'b, N, I, IpS, IS, DS, DS2> Dot<CsMatBase<N, I, IpS, IS, DS>>
impl<N, I, IpS, IS, DS, DS2> Dot<CsMatBase<N, I, IpS, IS, DS>>
for ArrayBase<DS2, Ix2>
where
N: 'a + Clone + crate::MulAcc + num_traits::Zero + std::fmt::Debug,
I: 'a + SpIndex,
IpS: 'a + Deref<Target = [I]>,
IS: 'a + Deref<Target = [I]>,
DS: 'a + Deref<Target = [N]>,
DS2: 'b + ndarray::Data<Elem = N>,
N: Clone + crate::MulAcc + num_traits::Zero + std::fmt::Debug,
I: SpIndex,
IpS: Deref<Target = [I]>,
IS: Deref<Target = [I]>,
DS: Deref<Target = [N]>,
DS2: ndarray::Data<Elem = N>,
{
type Output = Array<N, Ix2>;

Expand Down Expand Up @@ -2089,16 +2089,16 @@ where
}
}

impl<'a, 'b, N, I, Iptr, IpS, IS, DS, DS2> Dot<ArrayBase<DS2, Ix2>>
impl<N, I, Iptr, IpS, IS, DS, DS2> Dot<ArrayBase<DS2, Ix2>>
for CsMatBase<N, I, IpS, IS, DS, Iptr>
where
N: 'a + Clone + crate::MulAcc + num_traits::Zero,
I: 'a + SpIndex,
Iptr: 'a + SpIndex,
IpS: 'a + Deref<Target = [Iptr]>,
IS: 'a + Deref<Target = [I]>,
DS: 'a + Deref<Target = [N]>,
DS2: 'b + ndarray::Data<Elem = N>,
N: Clone + crate::MulAcc + num_traits::Zero,
I: SpIndex,
Iptr: SpIndex,
IpS: Deref<Target = [Iptr]>,
IS: Deref<Target = [I]>,
DS: Deref<Target = [N]>,
DS2: ndarray::Data<Elem = N>,
{
type Output = Array<N, Ix2>;

Expand Down Expand Up @@ -2150,16 +2150,16 @@ where
}
}

impl<'a, 'b, N, I, Iptr, IpS, IS, DS, DS2> Dot<ArrayBase<DS2, Ix1>>
impl<N, I, Iptr, IpS, IS, DS, DS2> Dot<ArrayBase<DS2, Ix1>>
for CsMatBase<N, I, IpS, IS, DS, Iptr>
where
N: 'a + Clone + crate::MulAcc + num_traits::Zero,
I: 'a + SpIndex,
Iptr: 'a + SpIndex,
IpS: 'a + Deref<Target = [Iptr]>,
IS: 'a + Deref<Target = [I]>,
DS: 'a + Deref<Target = [N]>,
DS2: 'b + ndarray::Data<Elem = N>,
N: Clone + crate::MulAcc + num_traits::Zero,
I: SpIndex,
Iptr: SpIndex,
IpS: Deref<Target = [Iptr]>,
IS: Deref<Target = [I]>,
DS: Deref<Target = [N]>,
DS2: ndarray::Data<Elem = N>,
{
type Output = Array<N, Ix1>;

Expand Down
2 changes: 1 addition & 1 deletion sprs/src/sparse/linalg/trisolve.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
//! Sparse triangular solves
use crate::dense_vector::{DenseVector, DenseVectorMut};
use crate::errors::{LinalgError, SingularMatrixInfo};
use crate::indexing::SpIndex;
use crate::sparse::CsMatViewI;
use crate::sparse::CsVecViewI;
use crate::stack::{self, DStack, StackVal};
use num_traits::Num;
/// Sparse triangular solves

fn check_solver_dimensions<N, I, Iptr, V>(
lower_tri_mat: &CsMatViewI<N, I, Iptr>,
Expand Down
2 changes: 1 addition & 1 deletion sprs/src/sparse/permutation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ impl<I: SpIndex> PermOwnedI<I> {
}
}

impl<'a, I: SpIndex> PermViewI<'a, I> {
impl<I: SpIndex> PermViewI<'_, I> {
pub fn reborrow(&self) -> Self {
match self.storage {
Identity => Self {
Expand Down
28 changes: 13 additions & 15 deletions sprs/src/sparse/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -998,11 +998,10 @@ where
}

/// # Methods on sparse vectors with mutable access to their data
impl<'a, N, I, IStorage, DStorage> CsVecBase<IStorage, DStorage, N, I>
impl<N, I, IStorage, DStorage> CsVecBase<IStorage, DStorage, N, I>
where
N: 'a,
I: 'a + SpIndex,
IStorage: 'a + Deref<Target = [I]>,
I: SpIndex,
IStorage: Deref<Target = [I]>,
DStorage: DerefMut<Target = [N]>,
{
/// The underlying non zero values as a mutable slice.
Expand Down Expand Up @@ -1102,9 +1101,8 @@ where
}
}

impl<'a, 'b, N, I, Iptr, IpS1, IS1, DS1, IS2, DS2>
Mul<&'b CsVecBase<IS2, DS2, N, I>>
for &'a CsMatBase<N, I, IpS1, IS1, DS1, Iptr>
impl<N, I, Iptr, IpS1, IS1, DS1, IS2, DS2> Mul<&CsVecBase<IS2, DS2, N, I>>
for &CsMatBase<N, I, IpS1, IS1, DS1, Iptr>
where
N: Clone
+ crate::MulAcc
Expand Down Expand Up @@ -1151,8 +1149,8 @@ where
}
}

impl<'a, Lhs, Rhs, Res, I, IS1, DS1, IS2, DS2>
Add<&'a CsVecBase<IS2, DS2, Rhs, I>> for CsVecBase<IS1, DS1, Lhs, I>
impl<Lhs, Rhs, Res, I, IS1, DS1, IS2, DS2> Add<&CsVecBase<IS2, DS2, Rhs, I>>
for CsVecBase<IS1, DS1, Lhs, I>
where
Lhs: Zero,
Rhs: Zero,
Expand All @@ -1170,8 +1168,8 @@ where
}
}

impl<'a, Lhs, Rhs, Res, I, IS1, DS1, IS2, DS2> Add<CsVecBase<IS2, DS2, Rhs, I>>
for &'a CsVecBase<IS1, DS1, Lhs, I>
impl<Lhs, Rhs, Res, I, IS1, DS1, IS2, DS2> Add<CsVecBase<IS2, DS2, Rhs, I>>
for &CsVecBase<IS1, DS1, Lhs, I>
where
Lhs: Zero,
Rhs: Zero,
Expand All @@ -1189,8 +1187,8 @@ where
}
}

impl<'a, 'b, Lhs, Rhs, Res, I, IS1, DS1, IS2, DS2>
Add<&'b CsVecBase<IS2, DS2, Rhs, I>> for &'a CsVecBase<IS1, DS1, Lhs, I>
impl<Lhs, Rhs, Res, I, IS1, DS1, IS2, DS2> Add<&CsVecBase<IS2, DS2, Rhs, I>>
for &CsVecBase<IS1, DS1, Lhs, I>
where
Lhs: Zero,
Rhs: Zero,
Expand All @@ -1208,8 +1206,8 @@ where
}
}

impl<'a, 'b, Lhs, Rhs, Res, I, IS1, DS1, IS2, DS2>
Sub<&'b CsVecBase<IS2, DS2, Rhs, I>> for &'a CsVecBase<IS1, DS1, Lhs, I>
impl<Lhs, Rhs, Res, I, IS1, DS1, IS2, DS2> Sub<&CsVecBase<IS2, DS2, Rhs, I>>
for &CsVecBase<IS1, DS1, Lhs, I>
where
Lhs: Zero,
Rhs: Zero,
Expand Down
2 changes: 1 addition & 1 deletion sprs/src/sparse/visu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub struct NnzPatternFormatter<'a, N, I: SpIndex, Iptr: SpIndex> {
mat: CsMatViewI<'a, N, I, Iptr>,
}

impl<'a, N, I, Iptr> fmt::Display for NnzPatternFormatter<'a, N, I, Iptr>
impl<N, I, Iptr> fmt::Display for NnzPatternFormatter<'_, N, I, Iptr>
where
N: Clone + Default,
I: SpIndex,
Expand Down

0 comments on commit 3898a15

Please sign in to comment.