Skip to content

Commit

Permalink
Merge pull request #343 from mulimoen/clippy
Browse files Browse the repository at this point in the history
Fix clippy lints
  • Loading branch information
mulimoen committed Dec 19, 2023
2 parents d784194 + d1f5c68 commit dcbc203
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions sprs/src/sparse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ pub struct TriMatIter<RI, CI, DI> {
}

mod prelude {
#[allow(unused_imports)]
pub use super::{
CsMat, CsMatBase, CsMatI, CsMatVecView, CsMatVecView_, CsMatView,
CsMatViewI, CsMatViewMut, CsMatViewMutI, CsStructure, CsStructureI,
Expand Down
3 changes: 1 addition & 2 deletions sprs/src/sparse/construct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,7 @@ where
})
})
.collect();
let mut to_vstack = Vec::new();
to_vstack.reserve(super_rows);
let mut to_vstack = Vec::with_capacity(super_rows);
for (i, row) in mats.iter().enumerate() {
let with_zeros: Vec<_> = row
.as_ref()
Expand Down
2 changes: 1 addition & 1 deletion sprs/src/sparse/csmat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,7 @@ where
let mut indices: Vec<I> = Vec::with_capacity(max_data_len);
let mut data = Vec::with_capacity(max_data_len);

for (_, inner_vec) in self.outer_iterator().enumerate() {
for inner_vec in self.outer_iterator() {
let hot_element = inner_vec
.iter()
.filter(|e| !e.1.is_nan())
Expand Down
4 changes: 2 additions & 2 deletions sprs/src/sparse/indptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ where
///
/// An empty matrix is considered non-proper.
pub fn is_proper(&self) -> bool {
self.storage.get(0).map_or(false, |i| *i == Iptr::zero())
self.storage.first().map_or(false, |i| *i == Iptr::zero())
}

/// Return a view on the underlying slice if it is a proper `indptr` slice,
Expand Down Expand Up @@ -215,7 +215,7 @@ where

fn offset(&self) -> Iptr {
let zero = Iptr::zero();
self.storage.get(0).copied().unwrap_or(zero)
self.storage.first().copied().unwrap_or(zero)
}

/// Iterate over the nonzeros represented by this indptr, yielding the
Expand Down

0 comments on commit dcbc203

Please sign in to comment.