Skip to content

Commit c35f792

Browse files
author
Rémi Lauzier
committed
Fix some warnings
1 parent 2a80e96 commit c35f792

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+201
-164
lines changed

clippy.toml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
too-many-arguments-threshold = 8
2+
type-complexity-threshold = 675

nalgebra-glm/src/lib.rs

+10
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,16 @@
110110
and keep in mind it is possible to convert, e.g., an `Isometry3` to a `Mat4` and vice-versa (see the [conversions section](#conversions)).
111111
*/
112112

113+
#![deny(
114+
nonstandard_style,
115+
unused,
116+
missing_docs,
117+
rust_2018_idioms,
118+
rust_2018_compatibility,
119+
future_incompatible,
120+
missing_copy_implementations,
121+
missing_debug_implementations
122+
)]
113123
#![doc(html_favicon_url = "https://nalgebra.org/img/favicon.ico")]
114124
#![cfg_attr(not(feature = "std"), no_std)]
115125

nalgebra-lapack/src/hessenberg.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ where
8484
);
8585
lapack_panic!(info);
8686

87-
Self { h: m, tau: tau }
87+
Self { h: m, tau }
8888
}
8989

9090
/// Computes the hessenberg matrix of this decomposition.

nalgebra-lapack/src/qr.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ where
6262
};
6363

6464
if nrows.value() == 0 || ncols.value() == 0 {
65-
return Self { qr: m, tau: tau };
65+
return Self { qr: m, tau };
6666
}
6767

6868
let lwork = T::xgeqrf_work_size(
@@ -87,7 +87,7 @@ where
8787
&mut info,
8888
);
8989

90-
Self { qr: m, tau: tau }
90+
Self { qr: m, tau }
9191
}
9292

9393
/// Retrieves the upper trapezoidal submatrix `R` of this decomposition.

nalgebra-lapack/src/schur.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ where
125125
re: wr,
126126
im: wi,
127127
t: m,
128-
q: q,
128+
q,
129129
})
130130
}
131131

nalgebra-macros/src/lib.rs

+14-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,18 @@
33
//! This crate is not intended for direct consumption. Instead, the macros are re-exported by
44
//! `nalgebra` if the `macros` feature is enabled (enabled by default).
55
6-
extern crate proc_macro;
6+
#![deny(
7+
nonstandard_style,
8+
unused,
9+
missing_docs,
10+
rust_2018_idioms,
11+
rust_2018_compatibility,
12+
future_incompatible,
13+
missing_copy_implementations,
14+
missing_debug_implementations,
15+
clippy::all,
16+
clippy::pedantic
17+
)]
718

819
use proc_macro::TokenStream;
920
use quote::{quote, ToTokens, TokenStreamExt};
@@ -60,7 +71,7 @@ impl Matrix {
6071
type MatrixRowSyntax = Punctuated<Expr, Token![,]>;
6172

6273
impl Parse for Matrix {
63-
fn parse(input: ParseStream) -> Result<Self> {
74+
fn parse(input: ParseStream<'_>) -> Result<Self> {
6475
let mut rows = Vec::new();
6576
let mut ncols = None;
6677

@@ -205,7 +216,7 @@ impl Vector {
205216
}
206217

207218
impl Parse for Vector {
208-
fn parse(input: ParseStream) -> Result<Self> {
219+
fn parse(input: ParseStream<'_>) -> Result<Self> {
209220
// The syntax of a vector is just the syntax of a single matrix row
210221
if input.is_empty() {
211222
Ok(Self {

nalgebra-sparse/src/cs.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ impl<T> CsMatrix<T> {
116116
/// Returns an entry for the given major/minor indices, or `None` if the indices are out
117117
/// of bounds.
118118
#[must_use]
119-
pub fn get_entry(&self, major_index: usize, minor_index: usize) -> Option<SparseEntry<T>> {
119+
pub fn get_entry(&self, major_index: usize, minor_index: usize) -> Option<SparseEntry<'_, T>> {
120120
let row_range = self.get_index_range(major_index)?;
121121
let (_, minor_indices, values) = self.cs_data();
122122
let minor_indices = &minor_indices[row_range.clone()];
@@ -135,7 +135,7 @@ impl<T> CsMatrix<T> {
135135
&mut self,
136136
major_index: usize,
137137
minor_index: usize,
138-
) -> Option<SparseEntryMut<T>> {
138+
) -> Option<SparseEntryMut<'_, T>> {
139139
let row_range = self.get_index_range(major_index)?;
140140
let minor_dim = self.pattern().minor_dim();
141141
let (_, minor_indices, values) = self.cs_data_mut();
@@ -145,7 +145,7 @@ impl<T> CsMatrix<T> {
145145
}
146146

147147
#[must_use]
148-
pub fn get_lane(&self, index: usize) -> Option<CsLane<T>> {
148+
pub fn get_lane(&self, index: usize) -> Option<CsLane<'_, T>> {
149149
let range = self.get_index_range(index)?;
150150
let (_, minor_indices, values) = self.cs_data();
151151
Some(CsLane {
@@ -157,7 +157,7 @@ impl<T> CsMatrix<T> {
157157

158158
#[inline]
159159
#[must_use]
160-
pub fn get_lane_mut(&mut self, index: usize) -> Option<CsLaneMut<T>> {
160+
pub fn get_lane_mut(&mut self, index: usize) -> Option<CsLaneMut<'_, T>> {
161161
let range = self.get_index_range(index)?;
162162
let minor_dim = self.pattern().minor_dim();
163163
let (_, minor_indices, values) = self.cs_data_mut();
@@ -169,12 +169,12 @@ impl<T> CsMatrix<T> {
169169
}
170170

171171
#[inline]
172-
pub fn lane_iter(&self) -> CsLaneIter<T> {
172+
pub fn lane_iter(&self) -> CsLaneIter<'_, T> {
173173
CsLaneIter::new(self.pattern(), self.values())
174174
}
175175

176176
#[inline]
177-
pub fn lane_iter_mut(&mut self) -> CsLaneIterMut<T> {
177+
pub fn lane_iter_mut(&mut self) -> CsLaneIterMut<'_, T> {
178178
CsLaneIterMut::new(&self.sparsity_pattern, &mut self.values)
179179
}
180180

@@ -406,7 +406,7 @@ macro_rules! impl_cs_lane_common_methods {
406406

407407
#[inline]
408408
#[must_use]
409-
pub fn get_entry(&self, global_col_index: usize) -> Option<SparseEntry<T>> {
409+
pub fn get_entry(&self, global_col_index: usize) -> Option<SparseEntry<'_, T>> {
410410
get_entry_from_slices(
411411
self.minor_dim,
412412
self.minor_indices,
@@ -431,7 +431,7 @@ impl<'a, T> CsLaneMut<'a, T> {
431431
}
432432

433433
#[must_use]
434-
pub fn get_entry_mut(&mut self, global_minor_index: usize) -> Option<SparseEntryMut<T>> {
434+
pub fn get_entry_mut(&mut self, global_minor_index: usize) -> Option<SparseEntryMut<'_, T>> {
435435
get_mut_entry_from_slices(
436436
self.minor_dim,
437437
self.minor_indices,

nalgebra-sparse/src/csc.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ impl<T> CscMatrix<T> {
260260
/// let triplets: Vec<_> = csc.triplet_iter().map(|(i, j, v)| (i, j, *v)).collect();
261261
/// assert_eq!(triplets, vec![(0, 0, 1), (2, 0, 3), (1, 1, 2), (0, 2, 4)]);
262262
/// ```
263-
pub fn triplet_iter(&self) -> CscTripletIter<T> {
263+
pub fn triplet_iter(&self) -> CscTripletIter<'_, T> {
264264
CscTripletIter {
265265
pattern_iter: self.pattern().entries(),
266266
values_iter: self.values().iter(),
@@ -290,7 +290,7 @@ impl<T> CscMatrix<T> {
290290
/// let triplets: Vec<_> = csc.triplet_iter().map(|(i, j, v)| (i, j, *v)).collect();
291291
/// assert_eq!(triplets, vec![(0, 0, 1), (2, 0, 0), (1, 1, 2), (0, 2, 4)]);
292292
/// ```
293-
pub fn triplet_iter_mut(&mut self) -> CscTripletIterMut<T> {
293+
pub fn triplet_iter_mut(&mut self) -> CscTripletIterMut<'_, T> {
294294
let (pattern, values) = self.cs.pattern_and_values_mut();
295295
CscTripletIterMut {
296296
pattern_iter: pattern.entries(),
@@ -305,7 +305,7 @@ impl<T> CscMatrix<T> {
305305
/// Panics if column index is out of bounds.
306306
#[inline]
307307
#[must_use]
308-
pub fn col(&self, index: usize) -> CscCol<T> {
308+
pub fn col(&self, index: usize) -> CscCol<'_, T> {
309309
self.get_col(index).expect("Row index must be in bounds")
310310
}
311311

@@ -315,34 +315,34 @@ impl<T> CscMatrix<T> {
315315
/// ------
316316
/// Panics if column index is out of bounds.
317317
#[inline]
318-
pub fn col_mut(&mut self, index: usize) -> CscColMut<T> {
318+
pub fn col_mut(&mut self, index: usize) -> CscColMut<'_, T> {
319319
self.get_col_mut(index)
320320
.expect("Row index must be in bounds")
321321
}
322322

323323
/// Return the column at the given column index, or `None` if out of bounds.
324324
#[inline]
325325
#[must_use]
326-
pub fn get_col(&self, index: usize) -> Option<CscCol<T>> {
326+
pub fn get_col(&self, index: usize) -> Option<CscCol<'_, T>> {
327327
self.cs.get_lane(index).map(|lane| CscCol { lane })
328328
}
329329

330330
/// Mutable column access for the given column index, or `None` if out of bounds.
331331
#[inline]
332332
#[must_use]
333-
pub fn get_col_mut(&mut self, index: usize) -> Option<CscColMut<T>> {
333+
pub fn get_col_mut(&mut self, index: usize) -> Option<CscColMut<'_, T>> {
334334
self.cs.get_lane_mut(index).map(|lane| CscColMut { lane })
335335
}
336336

337337
/// An iterator over columns in the matrix.
338-
pub fn col_iter(&self) -> CscColIter<T> {
338+
pub fn col_iter(&self) -> CscColIter<'_, T> {
339339
CscColIter {
340340
lane_iter: CsLaneIter::new(self.pattern(), self.values()),
341341
}
342342
}
343343

344344
/// A mutable iterator over columns in the matrix.
345-
pub fn col_iter_mut(&mut self) -> CscColIterMut<T> {
345+
pub fn col_iter_mut(&mut self) -> CscColIterMut<'_, T> {
346346
let (pattern, values) = self.cs.pattern_and_values_mut();
347347
CscColIterMut {
348348
lane_iter: CsLaneIterMut::new(pattern, values),
@@ -408,7 +408,7 @@ impl<T> CscMatrix<T> {
408408
/// Each call to this function incurs the cost of a binary search among the explicitly
409409
/// stored row entries for the given column.
410410
#[must_use]
411-
pub fn get_entry(&self, row_index: usize, col_index: usize) -> Option<SparseEntry<T>> {
411+
pub fn get_entry(&self, row_index: usize, col_index: usize) -> Option<SparseEntry<'_, T>> {
412412
self.cs.get_entry(col_index, row_index)
413413
}
414414

@@ -421,7 +421,7 @@ impl<T> CscMatrix<T> {
421421
&mut self,
422422
row_index: usize,
423423
col_index: usize,
424-
) -> Option<SparseEntryMut<T>> {
424+
) -> Option<SparseEntryMut<'_, T>> {
425425
self.cs.get_entry_mut(col_index, row_index)
426426
}
427427

@@ -434,7 +434,7 @@ impl<T> CscMatrix<T> {
434434
/// ------
435435
/// Panics if `row_index` or `col_index` is out of bounds.
436436
#[must_use]
437-
pub fn index_entry(&self, row_index: usize, col_index: usize) -> SparseEntry<T> {
437+
pub fn index_entry(&self, row_index: usize, col_index: usize) -> SparseEntry<'_, T> {
438438
self.get_entry(row_index, col_index)
439439
.expect("Out of bounds matrix indices encountered")
440440
}
@@ -447,7 +447,7 @@ impl<T> CscMatrix<T> {
447447
/// Panics
448448
/// ------
449449
/// Panics if `row_index` or `col_index` is out of bounds.
450-
pub fn index_entry_mut(&mut self, row_index: usize, col_index: usize) -> SparseEntryMut<T> {
450+
pub fn index_entry_mut(&mut self, row_index: usize, col_index: usize) -> SparseEntryMut<'_, T> {
451451
self.get_entry_mut(row_index, col_index)
452452
.expect("Out of bounds matrix indices encountered")
453453
}
@@ -666,7 +666,7 @@ macro_rules! impl_csc_col_common_methods {
666666
/// Each call to this function incurs the cost of a binary search among the explicitly
667667
/// stored row entries.
668668
#[must_use]
669-
pub fn get_entry(&self, global_row_index: usize) -> Option<SparseEntry<T>> {
669+
pub fn get_entry(&self, global_row_index: usize) -> Option<SparseEntry<'_, T>> {
670670
self.lane.get_entry(global_row_index)
671671
}
672672
}
@@ -693,7 +693,7 @@ impl<'a, T> CscColMut<'a, T> {
693693

694694
/// Returns a mutable entry for the given global row index.
695695
#[must_use]
696-
pub fn get_entry_mut(&mut self, global_row_index: usize) -> Option<SparseEntryMut<T>> {
696+
pub fn get_entry_mut(&mut self, global_row_index: usize) -> Option<SparseEntryMut<'_, T>> {
697697
self.lane.get_entry_mut(global_row_index)
698698
}
699699
}

0 commit comments

Comments
 (0)