Skip to content

Commit 92c7da9

Browse files
authored
Merge pull request #205 from rust-ndarray/clippy
Clippy check
2 parents 688f80c + 749ccb9 commit 92c7da9

26 files changed

+46
-48
lines changed

.github/workflows/rust.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,11 @@ jobs:
6565
with:
6666
command: fmt
6767
args: -- --check
68+
69+
clippy:
70+
runs-on: ubuntu-18.04
71+
steps:
72+
- uses: actions/checkout@v1
73+
- uses: actions-rs/cargo@v1
74+
with:
75+
command: clippy

src/cholesky.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ where
298298
fn factorizec_into(self, uplo: UPLO) -> Result<CholeskyFactorized<S>> {
299299
Ok(CholeskyFactorized {
300300
factor: self.cholesky_into(uplo)?,
301-
uplo: uplo,
301+
uplo,
302302
})
303303
}
304304
}
@@ -311,7 +311,7 @@ where
311311
fn factorizec(&self, uplo: UPLO) -> Result<CholeskyFactorized<OwnedRepr<A>>> {
312312
Ok(CholeskyFactorized {
313313
factor: self.cholesky(uplo)?,
314-
uplo: uplo,
314+
uplo,
315315
})
316316
}
317317
}

src/diagonal.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ where
4242
S: DataMut<Elem = A>,
4343
{
4444
for (val, d) in a.iter_mut().zip(self.diag.iter()) {
45-
*val = *val * *d;
45+
*val *= *d;
4646
}
4747
}
4848
}

src/krylov/householder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ where
1313
A: Scalar + Lapack,
1414
S: DataMut<Elem = A>,
1515
{
16-
assert!(x.len() > 0);
16+
assert!(!x.is_empty());
1717
let norm = x.norm_l2();
1818
let alpha = -x[0].mul_real(norm / x[0].abs());
1919
x[0] -= alpha;

src/krylov/mgs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ impl<A: Scalar + Lapack> Orthogonalizer for MGS<A> {
5151
for i in 0..self.len() {
5252
let q = &self.q[i];
5353
let c = q.inner(&a);
54-
azip!((a in &mut *a, &q in q) *a = *a - c * q);
54+
azip!((a in &mut *a, &q in q) *a -= c * q);
5555
coef[i] = c;
5656
}
5757
let nrm = a.norm_l2();
@@ -88,7 +88,7 @@ impl<A: Scalar + Lapack> Orthogonalizer for MGS<A> {
8888
// Linearly dependent
8989
return AppendResult::Dependent(coef);
9090
}
91-
azip!((a in &mut *a) *a = *a / A::from_real(nrm));
91+
azip!((a in &mut *a) *a /= A::from_real(nrm));
9292
self.q.push(a.to_owned());
9393
AppendResult::Added(coef)
9494
}

src/lapack/cholesky.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//! Cholesky decomposition
22
3-
use lapacke;
4-
53
use crate::error::*;
64
use crate::layout::MatrixLayout;
75
use crate::types::*;

src/lapack/eig.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//! Eigenvalue decomposition for general matrices
22
3-
use lapacke;
43
use num_traits::Zero;
54

65
use crate::error::*;

src/lapack/eigh.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//! Eigenvalue decomposition for Hermite matrices
22
3-
use lapacke;
43
use num_traits::Zero;
54

65
use crate::error::*;

src/lapack/least_squares.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//! Least squares
22
3-
use lapacke;
43
use ndarray::{ErrorKind, ShapeError};
54
use num_traits::Zero;
65

src/lapack/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//! Define traits wrapping LAPACK routines
22
3+
#![allow(clippy::missing_safety_doc)]
4+
35
pub mod cholesky;
46
pub mod eig;
57
pub mod eigh;

0 commit comments

Comments
 (0)