forked from M-Labs/nalgebra
Fix rust_2018_idioms warnings
This commit is contained in:
parent
305f39faf8
commit
ed6b34a0d6
@ -49,7 +49,7 @@ where
|
||||
|
||||
impl<T: Debug, const R: usize, const C: usize> Debug for ArrayStorage<T, R, C> {
|
||||
#[inline]
|
||||
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
|
||||
fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
|
||||
self.0.fmt(fmt)
|
||||
}
|
||||
}
|
||||
@ -231,7 +231,7 @@ where
|
||||
{
|
||||
type Value = ArrayStorage<T, R, C>;
|
||||
|
||||
fn expecting(&self, formatter: &mut Formatter) -> fmt::Result {
|
||||
fn expecting(&self, formatter: &mut Formatter<'_>) -> fmt::Result {
|
||||
formatter.write_str("a matrix array")
|
||||
}
|
||||
|
||||
|
@ -455,8 +455,8 @@ where
|
||||
x: &Vector<T, D3, SC>,
|
||||
beta: T,
|
||||
dot: impl Fn(
|
||||
&DVectorSlice<T, SB::RStride, SB::CStride>,
|
||||
&DVectorSlice<T, SC::RStride, SC::CStride>,
|
||||
&DVectorSlice<'_, T, SB::RStride, SB::CStride>,
|
||||
&DVectorSlice<'_, T, SC::RStride, SC::CStride>,
|
||||
) -> T,
|
||||
) where
|
||||
T: One,
|
||||
@ -619,7 +619,7 @@ where
|
||||
a: &Matrix<T, R2, C2, SB>,
|
||||
x: &Vector<T, D3, SC>,
|
||||
beta: T,
|
||||
dot: impl Fn(&VectorSlice<T, R2, SB::RStride, SB::CStride>, &Vector<T, D3, SC>) -> T,
|
||||
dot: impl Fn(&VectorSlice<'_, T, R2, SB::RStride, SB::CStride>, &Vector<T, D3, SC>) -> T,
|
||||
) where
|
||||
T: One,
|
||||
SB: Storage<T, R2, C2>,
|
||||
|
@ -193,7 +193,7 @@ pub struct Matrix<T, R, C, S> {
|
||||
}
|
||||
|
||||
impl<T, R: Dim, C: Dim, S: fmt::Debug> fmt::Debug for Matrix<T, R, C, S> {
|
||||
fn fmt(&self, formatter: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
|
||||
formatter
|
||||
.debug_struct("Matrix")
|
||||
.field("data", &self.data)
|
||||
@ -278,7 +278,7 @@ impl<T: Scalar, R: Dim, C: Dim, S: Storage<T, R, C>> matrixcompare_core::Matrix<
|
||||
self.ncols()
|
||||
}
|
||||
|
||||
fn access(&self) -> matrixcompare_core::Access<T> {
|
||||
fn access(&self) -> matrixcompare_core::Access<'_, T> {
|
||||
matrixcompare_core::Access::Dense(self)
|
||||
}
|
||||
}
|
||||
@ -1051,7 +1051,7 @@ impl<T: Scalar, R: Dim, C: Dim, S: Storage<T, R, C>> Matrix<T, R, C, S> {
|
||||
/// assert_eq!(*it.next().unwrap(), 23);
|
||||
/// assert!(it.next().is_none());
|
||||
#[inline]
|
||||
pub fn iter(&self) -> MatrixIter<T, R, C, S> {
|
||||
pub fn iter(&self) -> MatrixIter<'_, T, R, C, S> {
|
||||
MatrixIter::new(&self.data)
|
||||
}
|
||||
|
||||
@ -1067,7 +1067,7 @@ impl<T: Scalar, R: Dim, C: Dim, S: Storage<T, R, C>> Matrix<T, R, C, S> {
|
||||
/// }
|
||||
/// ```
|
||||
#[inline]
|
||||
pub fn row_iter(&self) -> RowIter<T, R, C, S> {
|
||||
pub fn row_iter(&self) -> RowIter<'_, T, R, C, S> {
|
||||
RowIter::new(self)
|
||||
}
|
||||
|
||||
@ -1082,13 +1082,13 @@ impl<T: Scalar, R: Dim, C: Dim, S: Storage<T, R, C>> Matrix<T, R, C, S> {
|
||||
/// }
|
||||
/// ```
|
||||
#[inline]
|
||||
pub fn column_iter(&self) -> ColumnIter<T, R, C, S> {
|
||||
pub fn column_iter(&self) -> ColumnIter<'_, T, R, C, S> {
|
||||
ColumnIter::new(self)
|
||||
}
|
||||
|
||||
/// Mutably iterates through this matrix coordinates.
|
||||
#[inline]
|
||||
pub fn iter_mut(&mut self) -> MatrixIterMut<T, R, C, S>
|
||||
pub fn iter_mut(&mut self) -> MatrixIterMut<'_, T, R, C, S>
|
||||
where
|
||||
S: StorageMut<T, R, C>,
|
||||
{
|
||||
@ -1111,7 +1111,7 @@ impl<T: Scalar, R: Dim, C: Dim, S: Storage<T, R, C>> Matrix<T, R, C, S> {
|
||||
/// assert_eq!(a, expected);
|
||||
/// ```
|
||||
#[inline]
|
||||
pub fn row_iter_mut(&mut self) -> RowIterMut<T, R, C, S>
|
||||
pub fn row_iter_mut(&mut self) -> RowIterMut<'_, T, R, C, S>
|
||||
where
|
||||
S: StorageMut<T, R, C>,
|
||||
{
|
||||
@ -1134,7 +1134,7 @@ impl<T: Scalar, R: Dim, C: Dim, S: Storage<T, R, C>> Matrix<T, R, C, S> {
|
||||
/// assert_eq!(a, expected);
|
||||
/// ```
|
||||
#[inline]
|
||||
pub fn column_iter_mut(&mut self) -> ColumnIterMut<T, R, C, S>
|
||||
pub fn column_iter_mut(&mut self) -> ColumnIterMut<'_, T, R, C, S>
|
||||
where
|
||||
S: StorageMut<T, R, C>,
|
||||
{
|
||||
@ -1820,9 +1820,9 @@ macro_rules! impl_fmt {
|
||||
T: Scalar + $trait,
|
||||
S: Storage<T, R, C>,
|
||||
{
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
#[cfg(feature = "std")]
|
||||
fn val_width<T: Scalar + $trait>(val: &T, f: &mut fmt::Formatter) -> usize {
|
||||
fn val_width<T: Scalar + $trait>(val: &T, f: &mut fmt::Formatter<'_>) -> usize {
|
||||
match f.precision() {
|
||||
Some(precision) => format!($fmt_str_with_precision, val, precision)
|
||||
.chars()
|
||||
@ -1832,7 +1832,7 @@ macro_rules! impl_fmt {
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
fn val_width<T: Scalar + $trait>(_: &T, _: &mut fmt::Formatter) -> usize {
|
||||
fn val_width<T: Scalar + $trait>(_: &T, _: &mut fmt::Formatter<'_>) -> usize {
|
||||
4
|
||||
}
|
||||
|
||||
|
@ -315,20 +315,20 @@ macro_rules! matrix_slice_impl(
|
||||
*/
|
||||
/// Returns a slice containing the i-th row of this matrix.
|
||||
#[inline]
|
||||
pub fn $row($me: $Me, i: usize) -> $MatrixSlice<T, U1, C, S::RStride, S::CStride> {
|
||||
pub fn $row($me: $Me, i: usize) -> $MatrixSlice<'_, T, U1, C, S::RStride, S::CStride> {
|
||||
$me.$fixed_rows::<1>(i)
|
||||
}
|
||||
|
||||
/// Returns a slice containing the `n` first elements of the i-th row of this matrix.
|
||||
#[inline]
|
||||
pub fn $row_part($me: $Me, i: usize, n: usize) -> $MatrixSlice<T, U1, Dynamic, S::RStride, S::CStride> {
|
||||
pub fn $row_part($me: $Me, i: usize, n: usize) -> $MatrixSlice<'_, T, U1, Dynamic, S::RStride, S::CStride> {
|
||||
$me.$generic_slice((i, 0), (Const::<1>, Dynamic::new(n)))
|
||||
}
|
||||
|
||||
/// Extracts from this matrix a set of consecutive rows.
|
||||
#[inline]
|
||||
pub fn $rows($me: $Me, first_row: usize, nrows: usize)
|
||||
-> $MatrixSlice<T, Dynamic, C, S::RStride, S::CStride> {
|
||||
-> $MatrixSlice<'_, T, Dynamic, C, S::RStride, S::CStride> {
|
||||
|
||||
$me.$rows_generic(first_row, Dynamic::new(nrows))
|
||||
}
|
||||
@ -336,7 +336,7 @@ macro_rules! matrix_slice_impl(
|
||||
/// Extracts from this matrix a set of consecutive rows regularly skipping `step` rows.
|
||||
#[inline]
|
||||
pub fn $rows_with_step($me: $Me, first_row: usize, nrows: usize, step: usize)
|
||||
-> $MatrixSlice<T, Dynamic, C, Dynamic, S::CStride> {
|
||||
-> $MatrixSlice<'_, T, Dynamic, C, Dynamic, S::CStride> {
|
||||
|
||||
$me.$rows_generic_with_step(first_row, Dynamic::new(nrows), step)
|
||||
}
|
||||
@ -344,7 +344,7 @@ macro_rules! matrix_slice_impl(
|
||||
/// Extracts a compile-time number of consecutive rows from this matrix.
|
||||
#[inline]
|
||||
pub fn $fixed_rows<const RSLICE: usize>($me: $Me, first_row: usize)
|
||||
-> $MatrixSlice<T, Const<RSLICE>, C, S::RStride, S::CStride> {
|
||||
-> $MatrixSlice<'_, T, Const<RSLICE>, C, S::RStride, S::CStride> {
|
||||
|
||||
$me.$rows_generic(first_row, Const::<RSLICE>)
|
||||
}
|
||||
@ -353,7 +353,7 @@ macro_rules! matrix_slice_impl(
|
||||
/// rows.
|
||||
#[inline]
|
||||
pub fn $fixed_rows_with_step<const RSLICE: usize>($me: $Me, first_row: usize, step: usize)
|
||||
-> $MatrixSlice<T, Const<RSLICE>, C, Dynamic, S::CStride> {
|
||||
-> $MatrixSlice<'_, T, Const<RSLICE>, C, Dynamic, S::CStride> {
|
||||
|
||||
$me.$rows_generic_with_step(first_row, Const::<RSLICE>, step)
|
||||
}
|
||||
@ -362,7 +362,7 @@ macro_rules! matrix_slice_impl(
|
||||
/// argument may or may not be values known at compile-time.
|
||||
#[inline]
|
||||
pub fn $rows_generic<RSlice: Dim>($me: $Me, row_start: usize, nrows: RSlice)
|
||||
-> $MatrixSlice<T, RSlice, C, S::RStride, S::CStride> {
|
||||
-> $MatrixSlice<'_, T, RSlice, C, S::RStride, S::CStride> {
|
||||
|
||||
let my_shape = $me.data.shape();
|
||||
$me.assert_slice_index((row_start, 0), (nrows.value(), my_shape.1.value()), (0, 0));
|
||||
@ -379,7 +379,7 @@ macro_rules! matrix_slice_impl(
|
||||
/// argument may or may not be values known at compile-time.
|
||||
#[inline]
|
||||
pub fn $rows_generic_with_step<RSlice>($me: $Me, row_start: usize, nrows: RSlice, step: usize)
|
||||
-> $MatrixSlice<T, RSlice, C, Dynamic, S::CStride>
|
||||
-> $MatrixSlice<'_, T, RSlice, C, Dynamic, S::CStride>
|
||||
where RSlice: Dim {
|
||||
|
||||
let my_shape = $me.data.shape();
|
||||
@ -402,20 +402,20 @@ macro_rules! matrix_slice_impl(
|
||||
*/
|
||||
/// Returns a slice containing the i-th column of this matrix.
|
||||
#[inline]
|
||||
pub fn $column($me: $Me, i: usize) -> $MatrixSlice<T, R, U1, S::RStride, S::CStride> {
|
||||
pub fn $column($me: $Me, i: usize) -> $MatrixSlice<'_, T, R, U1, S::RStride, S::CStride> {
|
||||
$me.$fixed_columns::<1>(i)
|
||||
}
|
||||
|
||||
/// Returns a slice containing the `n` first elements of the i-th column of this matrix.
|
||||
#[inline]
|
||||
pub fn $column_part($me: $Me, i: usize, n: usize) -> $MatrixSlice<T, Dynamic, U1, S::RStride, S::CStride> {
|
||||
pub fn $column_part($me: $Me, i: usize, n: usize) -> $MatrixSlice<'_, T, Dynamic, U1, S::RStride, S::CStride> {
|
||||
$me.$generic_slice((0, i), (Dynamic::new(n), Const::<1>))
|
||||
}
|
||||
|
||||
/// Extracts from this matrix a set of consecutive columns.
|
||||
#[inline]
|
||||
pub fn $columns($me: $Me, first_col: usize, ncols: usize)
|
||||
-> $MatrixSlice<T, R, Dynamic, S::RStride, S::CStride> {
|
||||
-> $MatrixSlice<'_, T, R, Dynamic, S::RStride, S::CStride> {
|
||||
|
||||
$me.$columns_generic(first_col, Dynamic::new(ncols))
|
||||
}
|
||||
@ -424,7 +424,7 @@ macro_rules! matrix_slice_impl(
|
||||
/// columns.
|
||||
#[inline]
|
||||
pub fn $columns_with_step($me: $Me, first_col: usize, ncols: usize, step: usize)
|
||||
-> $MatrixSlice<T, R, Dynamic, S::RStride, Dynamic> {
|
||||
-> $MatrixSlice<'_, T, R, Dynamic, S::RStride, Dynamic> {
|
||||
|
||||
$me.$columns_generic_with_step(first_col, Dynamic::new(ncols), step)
|
||||
}
|
||||
@ -432,7 +432,7 @@ macro_rules! matrix_slice_impl(
|
||||
/// Extracts a compile-time number of consecutive columns from this matrix.
|
||||
#[inline]
|
||||
pub fn $fixed_columns<const CSLICE: usize>($me: $Me, first_col: usize)
|
||||
-> $MatrixSlice<T, R, Const<CSLICE>, S::RStride, S::CStride> {
|
||||
-> $MatrixSlice<'_, T, R, Const<CSLICE>, S::RStride, S::CStride> {
|
||||
|
||||
$me.$columns_generic(first_col, Const::<CSLICE>)
|
||||
}
|
||||
@ -441,7 +441,7 @@ macro_rules! matrix_slice_impl(
|
||||
/// `step` columns.
|
||||
#[inline]
|
||||
pub fn $fixed_columns_with_step<const CSLICE: usize>($me: $Me, first_col: usize, step: usize)
|
||||
-> $MatrixSlice<T, R, Const<CSLICE>, S::RStride, Dynamic> {
|
||||
-> $MatrixSlice<'_, T, R, Const<CSLICE>, S::RStride, Dynamic> {
|
||||
|
||||
$me.$columns_generic_with_step(first_col, Const::<CSLICE>, step)
|
||||
}
|
||||
@ -450,7 +450,7 @@ macro_rules! matrix_slice_impl(
|
||||
/// known at compile-time.
|
||||
#[inline]
|
||||
pub fn $columns_generic<CSlice: Dim>($me: $Me, first_col: usize, ncols: CSlice)
|
||||
-> $MatrixSlice<T, R, CSlice, S::RStride, S::CStride> {
|
||||
-> $MatrixSlice<'_, T, R, CSlice, S::RStride, S::CStride> {
|
||||
|
||||
let my_shape = $me.data.shape();
|
||||
$me.assert_slice_index((0, first_col), (my_shape.0.value(), ncols.value()), (0, 0));
|
||||
@ -467,7 +467,7 @@ macro_rules! matrix_slice_impl(
|
||||
/// or may not be values known at compile-time.
|
||||
#[inline]
|
||||
pub fn $columns_generic_with_step<CSlice: Dim>($me: $Me, first_col: usize, ncols: CSlice, step: usize)
|
||||
-> $MatrixSlice<T, R, CSlice, S::RStride, Dynamic> {
|
||||
-> $MatrixSlice<'_, T, R, CSlice, S::RStride, Dynamic> {
|
||||
|
||||
let my_shape = $me.data.shape();
|
||||
let my_strides = $me.data.strides();
|
||||
@ -492,7 +492,7 @@ macro_rules! matrix_slice_impl(
|
||||
/// consecutive elements.
|
||||
#[inline]
|
||||
pub fn $slice($me: $Me, start: (usize, usize), shape: (usize, usize))
|
||||
-> $MatrixSlice<T, Dynamic, Dynamic, S::RStride, S::CStride> {
|
||||
-> $MatrixSlice<'_, T, Dynamic, Dynamic, S::RStride, S::CStride> {
|
||||
|
||||
$me.assert_slice_index(start, shape, (0, 0));
|
||||
let shape = (Dynamic::new(shape.0), Dynamic::new(shape.1));
|
||||
@ -510,7 +510,7 @@ macro_rules! matrix_slice_impl(
|
||||
/// original matrix.
|
||||
#[inline]
|
||||
pub fn $slice_with_steps($me: $Me, start: (usize, usize), shape: (usize, usize), steps: (usize, usize))
|
||||
-> $MatrixSlice<T, Dynamic, Dynamic, Dynamic, Dynamic> {
|
||||
-> $MatrixSlice<'_, T, Dynamic, Dynamic, Dynamic, Dynamic> {
|
||||
let shape = (Dynamic::new(shape.0), Dynamic::new(shape.1));
|
||||
|
||||
$me.$generic_slice_with_steps(start, shape, steps)
|
||||
@ -520,7 +520,7 @@ macro_rules! matrix_slice_impl(
|
||||
/// CSlice::dim())` consecutive components.
|
||||
#[inline]
|
||||
pub fn $fixed_slice<const RSLICE: usize, const CSLICE: usize>($me: $Me, irow: usize, icol: usize)
|
||||
-> $MatrixSlice<T, Const<RSLICE>, Const<CSLICE>, S::RStride, S::CStride> {
|
||||
-> $MatrixSlice<'_, T, Const<RSLICE>, Const<CSLICE>, S::RStride, S::CStride> {
|
||||
|
||||
$me.assert_slice_index((irow, icol), (RSLICE, CSLICE), (0, 0));
|
||||
let shape = (Const::<RSLICE>, Const::<CSLICE>);
|
||||
@ -537,7 +537,7 @@ macro_rules! matrix_slice_impl(
|
||||
/// the original matrix.
|
||||
#[inline]
|
||||
pub fn $fixed_slice_with_steps<const RSLICE: usize, const CSLICE: usize>($me: $Me, start: (usize, usize), steps: (usize, usize))
|
||||
-> $MatrixSlice<T, Const<RSLICE>, Const<CSLICE>, Dynamic, Dynamic> {
|
||||
-> $MatrixSlice<'_, T, Const<RSLICE>, Const<CSLICE>, Dynamic, Dynamic> {
|
||||
let shape = (Const::<RSLICE>, Const::<CSLICE>);
|
||||
$me.$generic_slice_with_steps(start, shape, steps)
|
||||
}
|
||||
@ -545,7 +545,7 @@ macro_rules! matrix_slice_impl(
|
||||
/// Creates a slice that may or may not have a fixed size and stride.
|
||||
#[inline]
|
||||
pub fn $generic_slice<RSlice, CSlice>($me: $Me, start: (usize, usize), shape: (RSlice, CSlice))
|
||||
-> $MatrixSlice<T, RSlice, CSlice, S::RStride, S::CStride>
|
||||
-> $MatrixSlice<'_, T, RSlice, CSlice, S::RStride, S::CStride>
|
||||
where RSlice: Dim,
|
||||
CSlice: Dim {
|
||||
|
||||
@ -563,7 +563,7 @@ macro_rules! matrix_slice_impl(
|
||||
start: (usize, usize),
|
||||
shape: (RSlice, CSlice),
|
||||
steps: (usize, usize))
|
||||
-> $MatrixSlice<T, RSlice, CSlice, Dynamic, Dynamic>
|
||||
-> $MatrixSlice<'_, T, RSlice, CSlice, Dynamic, Dynamic>
|
||||
where RSlice: Dim,
|
||||
CSlice: Dim {
|
||||
|
||||
@ -589,8 +589,8 @@ macro_rules! matrix_slice_impl(
|
||||
/// Panics if the ranges overlap or if the first range is empty.
|
||||
#[inline]
|
||||
pub fn $rows_range_pair<Range1: SliceRange<R>, Range2: SliceRange<R>>($me: $Me, r1: Range1, r2: Range2)
|
||||
-> ($MatrixSlice<T, Range1::Size, C, S::RStride, S::CStride>,
|
||||
$MatrixSlice<T, Range2::Size, C, S::RStride, S::CStride>) {
|
||||
-> ($MatrixSlice<'_, T, Range1::Size, C, S::RStride, S::CStride>,
|
||||
$MatrixSlice<'_, T, Range2::Size, C, S::RStride, S::CStride>) {
|
||||
|
||||
let (nrows, ncols) = $me.data.shape();
|
||||
let strides = $me.data.strides();
|
||||
@ -625,8 +625,8 @@ macro_rules! matrix_slice_impl(
|
||||
/// Panics if the ranges overlap or if the first range is empty.
|
||||
#[inline]
|
||||
pub fn $columns_range_pair<Range1: SliceRange<C>, Range2: SliceRange<C>>($me: $Me, r1: Range1, r2: Range2)
|
||||
-> ($MatrixSlice<T, R, Range1::Size, S::RStride, S::CStride>,
|
||||
$MatrixSlice<T, R, Range2::Size, S::RStride, S::CStride>) {
|
||||
-> ($MatrixSlice<'_, T, R, Range1::Size, S::RStride, S::CStride>,
|
||||
$MatrixSlice<'_, T, R, Range2::Size, S::RStride, S::CStride>) {
|
||||
|
||||
let (nrows, ncols) = $me.data.shape();
|
||||
let strides = $me.data.strides();
|
||||
@ -870,7 +870,7 @@ impl<T: Scalar, R: Dim, C: Dim, S: Storage<T, R, C>> Matrix<T, R, C, S> {
|
||||
&self,
|
||||
rows: RowRange,
|
||||
cols: ColRange,
|
||||
) -> MatrixSlice<T, RowRange::Size, ColRange::Size, S::RStride, S::CStride>
|
||||
) -> MatrixSlice<'_, T, RowRange::Size, ColRange::Size, S::RStride, S::CStride>
|
||||
where
|
||||
RowRange: SliceRange<R>,
|
||||
ColRange: SliceRange<C>,
|
||||
@ -888,7 +888,7 @@ impl<T: Scalar, R: Dim, C: Dim, S: Storage<T, R, C>> Matrix<T, R, C, S> {
|
||||
pub fn rows_range<RowRange: SliceRange<R>>(
|
||||
&self,
|
||||
rows: RowRange,
|
||||
) -> MatrixSlice<T, RowRange::Size, C, S::RStride, S::CStride> {
|
||||
) -> MatrixSlice<'_, T, RowRange::Size, C, S::RStride, S::CStride> {
|
||||
self.slice_range(rows, ..)
|
||||
}
|
||||
|
||||
@ -898,7 +898,7 @@ impl<T: Scalar, R: Dim, C: Dim, S: Storage<T, R, C>> Matrix<T, R, C, S> {
|
||||
pub fn columns_range<ColRange: SliceRange<C>>(
|
||||
&self,
|
||||
cols: ColRange,
|
||||
) -> MatrixSlice<T, R, ColRange::Size, S::RStride, S::CStride> {
|
||||
) -> MatrixSlice<'_, T, R, ColRange::Size, S::RStride, S::CStride> {
|
||||
self.slice_range(.., cols)
|
||||
}
|
||||
}
|
||||
@ -912,7 +912,7 @@ impl<T: Scalar, R: Dim, C: Dim, S: StorageMut<T, R, C>> Matrix<T, R, C, S> {
|
||||
&mut self,
|
||||
rows: RowRange,
|
||||
cols: ColRange,
|
||||
) -> MatrixSliceMut<T, RowRange::Size, ColRange::Size, S::RStride, S::CStride>
|
||||
) -> MatrixSliceMut<'_, T, RowRange::Size, ColRange::Size, S::RStride, S::CStride>
|
||||
where
|
||||
RowRange: SliceRange<R>,
|
||||
ColRange: SliceRange<C>,
|
||||
@ -929,7 +929,7 @@ impl<T: Scalar, R: Dim, C: Dim, S: StorageMut<T, R, C>> Matrix<T, R, C, S> {
|
||||
pub fn rows_range_mut<RowRange: SliceRange<R>>(
|
||||
&mut self,
|
||||
rows: RowRange,
|
||||
) -> MatrixSliceMut<T, RowRange::Size, C, S::RStride, S::CStride> {
|
||||
) -> MatrixSliceMut<'_, T, RowRange::Size, C, S::RStride, S::CStride> {
|
||||
self.slice_range_mut(rows, ..)
|
||||
}
|
||||
|
||||
@ -938,7 +938,7 @@ impl<T: Scalar, R: Dim, C: Dim, S: StorageMut<T, R, C>> Matrix<T, R, C, S> {
|
||||
pub fn columns_range_mut<ColRange: SliceRange<C>>(
|
||||
&mut self,
|
||||
cols: ColRange,
|
||||
) -> MatrixSliceMut<T, R, ColRange::Size, S::RStride, S::CStride> {
|
||||
) -> MatrixSliceMut<'_, T, R, ColRange::Size, S::RStride, S::CStride> {
|
||||
self.slice_range_mut(.., cols)
|
||||
}
|
||||
}
|
||||
|
@ -708,8 +708,8 @@ where
|
||||
rhs: &Matrix<T, R2, C2, SB>,
|
||||
out: &mut Matrix<T, R3, C3, SC>,
|
||||
dot: impl Fn(
|
||||
&VectorSlice<T, R1, SA::RStride, SA::CStride>,
|
||||
&VectorSlice<T, R2, SB::RStride, SB::CStride>,
|
||||
&VectorSlice<'_, T, R1, SA::RStride, SA::CStride>,
|
||||
&VectorSlice<'_, T, R2, SB::RStride, SB::CStride>,
|
||||
) -> T,
|
||||
) where
|
||||
SB: Storage<T, R2, C2>,
|
||||
|
@ -12,7 +12,7 @@ impl<T: Scalar, R: Dim, C: Dim, S: Storage<T, R, C>> Matrix<T, R, C, S> {
|
||||
#[must_use]
|
||||
pub fn compress_rows(
|
||||
&self,
|
||||
f: impl Fn(VectorSlice<T, R, S::RStride, S::CStride>) -> T,
|
||||
f: impl Fn(VectorSlice<'_, T, R, S::RStride, S::CStride>) -> T,
|
||||
) -> RowOVector<T, C>
|
||||
where
|
||||
DefaultAllocator: Allocator<T, U1, C>,
|
||||
@ -39,7 +39,7 @@ impl<T: Scalar, R: Dim, C: Dim, S: Storage<T, R, C>> Matrix<T, R, C, S> {
|
||||
#[must_use]
|
||||
pub fn compress_rows_tr(
|
||||
&self,
|
||||
f: impl Fn(VectorSlice<T, R, S::RStride, S::CStride>) -> T,
|
||||
f: impl Fn(VectorSlice<'_, T, R, S::RStride, S::CStride>) -> T,
|
||||
) -> OVector<T, C>
|
||||
where
|
||||
DefaultAllocator: Allocator<T, C>,
|
||||
@ -64,7 +64,7 @@ impl<T: Scalar, R: Dim, C: Dim, S: Storage<T, R, C>> Matrix<T, R, C, S> {
|
||||
pub fn compress_columns(
|
||||
&self,
|
||||
init: OVector<T, R>,
|
||||
f: impl Fn(&mut OVector<T, R>, VectorSlice<T, R, S::RStride, S::CStride>),
|
||||
f: impl Fn(&mut OVector<T, R>, VectorSlice<'_, T, R, S::RStride, S::CStride>),
|
||||
) -> OVector<T, R>
|
||||
where
|
||||
DefaultAllocator: Allocator<T, R>,
|
||||
|
@ -896,7 +896,7 @@ impl<T: RealField> Default for UnitDualQuaternion<T> {
|
||||
}
|
||||
|
||||
impl<T: RealField + fmt::Display> fmt::Display for UnitDualQuaternion<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
if let Some(axis) = self.rotation().axis() {
|
||||
let axis = axis.into_inner();
|
||||
write!(
|
||||
|
@ -642,7 +642,7 @@ impl<T: RealField + fmt::Display, R, const D: usize> fmt::Display for Isometry<T
|
||||
where
|
||||
R: fmt::Display,
|
||||
{
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
let precision = f.precision().unwrap_or(3);
|
||||
|
||||
writeln!(f, "Isometry {{")?;
|
||||
|
@ -32,7 +32,7 @@ impl<T: RealField> Clone for Orthographic3<T> {
|
||||
}
|
||||
|
||||
impl<T: RealField> fmt::Debug for Orthographic3<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
|
||||
self.matrix.fmt(f)
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ impl<T: RealField> Clone for Perspective3<T> {
|
||||
}
|
||||
|
||||
impl<T: RealField> fmt::Debug for Perspective3<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
|
||||
self.matrix.fmt(f)
|
||||
}
|
||||
}
|
||||
|
@ -273,7 +273,7 @@ where
|
||||
#[inline]
|
||||
pub fn iter(
|
||||
&self,
|
||||
) -> MatrixIter<T, D, Const<1>, <DefaultAllocator as Allocator<T, D>>::Buffer> {
|
||||
) -> MatrixIter<'_, T, D, Const<1>, <DefaultAllocator as Allocator<T, D>>::Buffer> {
|
||||
self.coords.iter()
|
||||
}
|
||||
|
||||
@ -299,7 +299,7 @@ where
|
||||
#[inline]
|
||||
pub fn iter_mut(
|
||||
&mut self,
|
||||
) -> MatrixIterMut<T, D, Const<1>, <DefaultAllocator as Allocator<T, D>>::Buffer> {
|
||||
) -> MatrixIterMut<'_, T, D, Const<1>, <DefaultAllocator as Allocator<T, D>>::Buffer> {
|
||||
self.coords.iter_mut()
|
||||
}
|
||||
|
||||
@ -454,7 +454,7 @@ impl<T: Scalar + fmt::Display, D: DimName> fmt::Display for OPoint<T, D>
|
||||
where
|
||||
DefaultAllocator: Allocator<T, D>,
|
||||
{
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "{{")?;
|
||||
|
||||
let mut it = self.coords.iter();
|
||||
|
@ -241,7 +241,7 @@ where
|
||||
/// ```
|
||||
#[inline]
|
||||
#[must_use]
|
||||
pub fn vector(&self) -> MatrixSlice<T, U3, U1, RStride<T, U4, U1>, CStride<T, U4, U1>> {
|
||||
pub fn vector(&self) -> MatrixSlice<'_, T, U3, U1, RStride<T, U4, U1>, CStride<T, U4, U1>> {
|
||||
self.coords.fixed_rows::<3>(0)
|
||||
}
|
||||
|
||||
@ -633,7 +633,7 @@ where
|
||||
#[inline]
|
||||
pub fn vector_mut(
|
||||
&mut self,
|
||||
) -> MatrixSliceMut<T, U3, U1, RStride<T, U4, U1>, CStride<T, U4, U1>> {
|
||||
) -> MatrixSliceMut<'_, T, U3, U1, RStride<T, U4, U1>, CStride<T, U4, U1>> {
|
||||
self.coords.fixed_rows_mut::<3>(0)
|
||||
}
|
||||
|
||||
@ -1046,7 +1046,7 @@ impl<T: RealField + UlpsEq<Epsilon = T>> UlpsEq for Quaternion<T> {
|
||||
}
|
||||
|
||||
impl<T: RealField + fmt::Display> fmt::Display for Quaternion<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"Quaternion {} − ({}, {}, {})",
|
||||
@ -1692,7 +1692,7 @@ impl<T: RealField> Default for UnitQuaternion<T> {
|
||||
}
|
||||
|
||||
impl<T: RealField + fmt::Display> fmt::Display for UnitQuaternion<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
if let Some(axis) = self.axis() {
|
||||
let axis = axis.into_inner();
|
||||
write!(
|
||||
|
@ -894,9 +894,9 @@ where
|
||||
#[cfg(test)]
|
||||
#[cfg(feature = "rand")]
|
||||
mod tests {
|
||||
extern crate rand_xorshift;
|
||||
use super::*;
|
||||
use rand::SeedableRng;
|
||||
use rand_xorshift;
|
||||
|
||||
#[test]
|
||||
fn random_unit_quats_are_unit() {
|
||||
|
@ -565,7 +565,7 @@ impl<T, const D: usize> fmt::Display for Rotation<T, D>
|
||||
where
|
||||
T: RealField + fmt::Display,
|
||||
{
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
let precision = f.precision().unwrap_or(3);
|
||||
|
||||
writeln!(f, "Rotation matrix {{")?;
|
||||
|
@ -429,7 +429,7 @@ where
|
||||
T: RealField + fmt::Display,
|
||||
R: AbstractRotation<T, D> + fmt::Display,
|
||||
{
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
let precision = f.precision().unwrap_or(3);
|
||||
|
||||
writeln!(f, "Similarity {{")?;
|
||||
|
@ -332,7 +332,7 @@ where
|
||||
*
|
||||
*/
|
||||
impl<T: Scalar + fmt::Display, const D: usize> fmt::Display for Translation<T, D> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
let precision = f.precision().unwrap_or(3);
|
||||
|
||||
writeln!(f, "Translation {{")?;
|
||||
|
@ -412,7 +412,7 @@ where
|
||||
}
|
||||
|
||||
impl<T: RealField + fmt::Display> fmt::Display for UnitComplex<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "UnitComplex angle: {}", self.angle())
|
||||
}
|
||||
}
|
||||
|
@ -82,6 +82,7 @@ an optimized set of tools for computer graphics and physics. Those features incl
|
||||
#![deny(unused_qualifications)]
|
||||
#![deny(unused_results)]
|
||||
#![deny(missing_docs)]
|
||||
#![deny(rust_2018_idioms)]
|
||||
#![doc(
|
||||
html_favicon_url = "https://nalgebra.org/img/favicon.ico",
|
||||
html_root_url = "https://docs.rs/nalgebra/0.25.0"
|
||||
|
@ -376,8 +376,8 @@ impl<T: ComplexField, D: Dim, S: Storage<T, D, D>> SquareMatrix<T, D, S> {
|
||||
b: &mut Vector<T, R2, S2>,
|
||||
conjugate: impl Fn(T) -> T,
|
||||
dot: impl Fn(
|
||||
&DVectorSlice<T, S::RStride, S::CStride>,
|
||||
&DVectorSlice<T, S2::RStride, S2::CStride>,
|
||||
&DVectorSlice<'_, T, S::RStride, S::CStride>,
|
||||
&DVectorSlice<'_, T, S2::RStride, S2::CStride>,
|
||||
) -> T,
|
||||
) -> bool
|
||||
where
|
||||
@ -411,8 +411,8 @@ impl<T: ComplexField, D: Dim, S: Storage<T, D, D>> SquareMatrix<T, D, S> {
|
||||
b: &mut Vector<T, R2, S2>,
|
||||
conjugate: impl Fn(T) -> T,
|
||||
dot: impl Fn(
|
||||
&DVectorSlice<T, S::RStride, S::CStride>,
|
||||
&DVectorSlice<T, S2::RStride, S2::CStride>,
|
||||
&DVectorSlice<'_, T, S::RStride, S::CStride>,
|
||||
&DVectorSlice<'_, T, S2::RStride, S2::CStride>,
|
||||
) -> T,
|
||||
) -> bool
|
||||
where
|
||||
@ -734,8 +734,8 @@ impl<T: SimdComplexField, D: Dim, S: Storage<T, D, D>> SquareMatrix<T, D, S> {
|
||||
b: &mut Vector<T, R2, S2>,
|
||||
conjugate: impl Fn(T) -> T,
|
||||
dot: impl Fn(
|
||||
&DVectorSlice<T, S::RStride, S::CStride>,
|
||||
&DVectorSlice<T, S2::RStride, S2::CStride>,
|
||||
&DVectorSlice<'_, T, S::RStride, S::CStride>,
|
||||
&DVectorSlice<'_, T, S2::RStride, S2::CStride>,
|
||||
) -> T,
|
||||
) where
|
||||
S2: StorageMut<T, R2, U1>,
|
||||
@ -760,8 +760,8 @@ impl<T: SimdComplexField, D: Dim, S: Storage<T, D, D>> SquareMatrix<T, D, S> {
|
||||
b: &mut Vector<T, R2, S2>,
|
||||
conjugate: impl Fn(T) -> T,
|
||||
dot: impl Fn(
|
||||
&DVectorSlice<T, S::RStride, S::CStride>,
|
||||
&DVectorSlice<T, S2::RStride, S2::CStride>,
|
||||
&DVectorSlice<'_, T, S::RStride, S::CStride>,
|
||||
&DVectorSlice<'_, T, S2::RStride, S2::CStride>,
|
||||
) -> T,
|
||||
) where
|
||||
S2: StorageMut<T, R2, U1>,
|
||||
|
Loading…
Reference in New Issue
Block a user