Fix some warnings

This commit is contained in:
Rémi Lauzier 2021-07-27 19:18:29 -04:00
parent 2a80e96766
commit c35f792b4f
No known key found for this signature in database
GPG Key ID: D4B9ECD143336C1D
48 changed files with 201 additions and 164 deletions

2
clippy.toml Normal file
View File

@ -0,0 +1,2 @@
too-many-arguments-threshold = 8
type-complexity-threshold = 675

View File

@ -110,6 +110,16 @@
and keep in mind it is possible to convert, e.g., an `Isometry3` to a `Mat4` and vice-versa (see the [conversions section](#conversions)).
*/
#![deny(
nonstandard_style,
unused,
missing_docs,
rust_2018_idioms,
rust_2018_compatibility,
future_incompatible,
missing_copy_implementations,
missing_debug_implementations
)]
#![doc(html_favicon_url = "https://nalgebra.org/img/favicon.ico")]
#![cfg_attr(not(feature = "std"), no_std)]

View File

@ -84,7 +84,7 @@ where
);
lapack_panic!(info);
Self { h: m, tau: tau }
Self { h: m, tau }
}
/// Computes the hessenberg matrix of this decomposition.

View File

@ -62,7 +62,7 @@ where
};
if nrows.value() == 0 || ncols.value() == 0 {
return Self { qr: m, tau: tau };
return Self { qr: m, tau };
}
let lwork = T::xgeqrf_work_size(
@ -87,7 +87,7 @@ where
&mut info,
);
Self { qr: m, tau: tau }
Self { qr: m, tau }
}
/// Retrieves the upper trapezoidal submatrix `R` of this decomposition.

View File

@ -125,7 +125,7 @@ where
re: wr,
im: wi,
t: m,
q: q,
q,
})
}

View File

@ -3,7 +3,18 @@
//! This crate is not intended for direct consumption. Instead, the macros are re-exported by
//! `nalgebra` if the `macros` feature is enabled (enabled by default).
extern crate proc_macro;
#![deny(
nonstandard_style,
unused,
missing_docs,
rust_2018_idioms,
rust_2018_compatibility,
future_incompatible,
missing_copy_implementations,
missing_debug_implementations,
clippy::all,
clippy::pedantic
)]
use proc_macro::TokenStream;
use quote::{quote, ToTokens, TokenStreamExt};
@ -60,7 +71,7 @@ impl Matrix {
type MatrixRowSyntax = Punctuated<Expr, Token![,]>;
impl Parse for Matrix {
fn parse(input: ParseStream) -> Result<Self> {
fn parse(input: ParseStream<'_>) -> Result<Self> {
let mut rows = Vec::new();
let mut ncols = None;
@ -205,7 +216,7 @@ impl Vector {
}
impl Parse for Vector {
fn parse(input: ParseStream) -> Result<Self> {
fn parse(input: ParseStream<'_>) -> Result<Self> {
// The syntax of a vector is just the syntax of a single matrix row
if input.is_empty() {
Ok(Self {

View File

@ -116,7 +116,7 @@ impl<T> CsMatrix<T> {
/// Returns an entry for the given major/minor indices, or `None` if the indices are out
/// of bounds.
#[must_use]
pub fn get_entry(&self, major_index: usize, minor_index: usize) -> Option<SparseEntry<T>> {
pub fn get_entry(&self, major_index: usize, minor_index: usize) -> Option<SparseEntry<'_, T>> {
let row_range = self.get_index_range(major_index)?;
let (_, minor_indices, values) = self.cs_data();
let minor_indices = &minor_indices[row_range.clone()];
@ -135,7 +135,7 @@ impl<T> CsMatrix<T> {
&mut self,
major_index: usize,
minor_index: usize,
) -> Option<SparseEntryMut<T>> {
) -> Option<SparseEntryMut<'_, T>> {
let row_range = self.get_index_range(major_index)?;
let minor_dim = self.pattern().minor_dim();
let (_, minor_indices, values) = self.cs_data_mut();
@ -145,7 +145,7 @@ impl<T> CsMatrix<T> {
}
#[must_use]
pub fn get_lane(&self, index: usize) -> Option<CsLane<T>> {
pub fn get_lane(&self, index: usize) -> Option<CsLane<'_, T>> {
let range = self.get_index_range(index)?;
let (_, minor_indices, values) = self.cs_data();
Some(CsLane {
@ -157,7 +157,7 @@ impl<T> CsMatrix<T> {
#[inline]
#[must_use]
pub fn get_lane_mut(&mut self, index: usize) -> Option<CsLaneMut<T>> {
pub fn get_lane_mut(&mut self, index: usize) -> Option<CsLaneMut<'_, T>> {
let range = self.get_index_range(index)?;
let minor_dim = self.pattern().minor_dim();
let (_, minor_indices, values) = self.cs_data_mut();
@ -169,12 +169,12 @@ impl<T> CsMatrix<T> {
}
#[inline]
pub fn lane_iter(&self) -> CsLaneIter<T> {
pub fn lane_iter(&self) -> CsLaneIter<'_, T> {
CsLaneIter::new(self.pattern(), self.values())
}
#[inline]
pub fn lane_iter_mut(&mut self) -> CsLaneIterMut<T> {
pub fn lane_iter_mut(&mut self) -> CsLaneIterMut<'_, T> {
CsLaneIterMut::new(&self.sparsity_pattern, &mut self.values)
}
@ -406,7 +406,7 @@ macro_rules! impl_cs_lane_common_methods {
#[inline]
#[must_use]
pub fn get_entry(&self, global_col_index: usize) -> Option<SparseEntry<T>> {
pub fn get_entry(&self, global_col_index: usize) -> Option<SparseEntry<'_, T>> {
get_entry_from_slices(
self.minor_dim,
self.minor_indices,
@ -431,7 +431,7 @@ impl<'a, T> CsLaneMut<'a, T> {
}
#[must_use]
pub fn get_entry_mut(&mut self, global_minor_index: usize) -> Option<SparseEntryMut<T>> {
pub fn get_entry_mut(&mut self, global_minor_index: usize) -> Option<SparseEntryMut<'_, T>> {
get_mut_entry_from_slices(
self.minor_dim,
self.minor_indices,

View File

@ -260,7 +260,7 @@ impl<T> CscMatrix<T> {
/// let triplets: Vec<_> = csc.triplet_iter().map(|(i, j, v)| (i, j, *v)).collect();
/// assert_eq!(triplets, vec![(0, 0, 1), (2, 0, 3), (1, 1, 2), (0, 2, 4)]);
/// ```
pub fn triplet_iter(&self) -> CscTripletIter<T> {
pub fn triplet_iter(&self) -> CscTripletIter<'_, T> {
CscTripletIter {
pattern_iter: self.pattern().entries(),
values_iter: self.values().iter(),
@ -290,7 +290,7 @@ impl<T> CscMatrix<T> {
/// let triplets: Vec<_> = csc.triplet_iter().map(|(i, j, v)| (i, j, *v)).collect();
/// assert_eq!(triplets, vec![(0, 0, 1), (2, 0, 0), (1, 1, 2), (0, 2, 4)]);
/// ```
pub fn triplet_iter_mut(&mut self) -> CscTripletIterMut<T> {
pub fn triplet_iter_mut(&mut self) -> CscTripletIterMut<'_, T> {
let (pattern, values) = self.cs.pattern_and_values_mut();
CscTripletIterMut {
pattern_iter: pattern.entries(),
@ -305,7 +305,7 @@ impl<T> CscMatrix<T> {
/// Panics if column index is out of bounds.
#[inline]
#[must_use]
pub fn col(&self, index: usize) -> CscCol<T> {
pub fn col(&self, index: usize) -> CscCol<'_, T> {
self.get_col(index).expect("Row index must be in bounds")
}
@ -315,7 +315,7 @@ impl<T> CscMatrix<T> {
/// ------
/// Panics if column index is out of bounds.
#[inline]
pub fn col_mut(&mut self, index: usize) -> CscColMut<T> {
pub fn col_mut(&mut self, index: usize) -> CscColMut<'_, T> {
self.get_col_mut(index)
.expect("Row index must be in bounds")
}
@ -323,26 +323,26 @@ impl<T> CscMatrix<T> {
/// Return the column at the given column index, or `None` if out of bounds.
#[inline]
#[must_use]
pub fn get_col(&self, index: usize) -> Option<CscCol<T>> {
pub fn get_col(&self, index: usize) -> Option<CscCol<'_, T>> {
self.cs.get_lane(index).map(|lane| CscCol { lane })
}
/// Mutable column access for the given column index, or `None` if out of bounds.
#[inline]
#[must_use]
pub fn get_col_mut(&mut self, index: usize) -> Option<CscColMut<T>> {
pub fn get_col_mut(&mut self, index: usize) -> Option<CscColMut<'_, T>> {
self.cs.get_lane_mut(index).map(|lane| CscColMut { lane })
}
/// An iterator over columns in the matrix.
pub fn col_iter(&self) -> CscColIter<T> {
pub fn col_iter(&self) -> CscColIter<'_, T> {
CscColIter {
lane_iter: CsLaneIter::new(self.pattern(), self.values()),
}
}
/// A mutable iterator over columns in the matrix.
pub fn col_iter_mut(&mut self) -> CscColIterMut<T> {
pub fn col_iter_mut(&mut self) -> CscColIterMut<'_, T> {
let (pattern, values) = self.cs.pattern_and_values_mut();
CscColIterMut {
lane_iter: CsLaneIterMut::new(pattern, values),
@ -408,7 +408,7 @@ impl<T> CscMatrix<T> {
/// Each call to this function incurs the cost of a binary search among the explicitly
/// stored row entries for the given column.
#[must_use]
pub fn get_entry(&self, row_index: usize, col_index: usize) -> Option<SparseEntry<T>> {
pub fn get_entry(&self, row_index: usize, col_index: usize) -> Option<SparseEntry<'_, T>> {
self.cs.get_entry(col_index, row_index)
}
@ -421,7 +421,7 @@ impl<T> CscMatrix<T> {
&mut self,
row_index: usize,
col_index: usize,
) -> Option<SparseEntryMut<T>> {
) -> Option<SparseEntryMut<'_, T>> {
self.cs.get_entry_mut(col_index, row_index)
}
@ -434,7 +434,7 @@ impl<T> CscMatrix<T> {
/// ------
/// Panics if `row_index` or `col_index` is out of bounds.
#[must_use]
pub fn index_entry(&self, row_index: usize, col_index: usize) -> SparseEntry<T> {
pub fn index_entry(&self, row_index: usize, col_index: usize) -> SparseEntry<'_, T> {
self.get_entry(row_index, col_index)
.expect("Out of bounds matrix indices encountered")
}
@ -447,7 +447,7 @@ impl<T> CscMatrix<T> {
/// Panics
/// ------
/// Panics if `row_index` or `col_index` is out of bounds.
pub fn index_entry_mut(&mut self, row_index: usize, col_index: usize) -> SparseEntryMut<T> {
pub fn index_entry_mut(&mut self, row_index: usize, col_index: usize) -> SparseEntryMut<'_, T> {
self.get_entry_mut(row_index, col_index)
.expect("Out of bounds matrix indices encountered")
}
@ -666,7 +666,7 @@ macro_rules! impl_csc_col_common_methods {
/// Each call to this function incurs the cost of a binary search among the explicitly
/// stored row entries.
#[must_use]
pub fn get_entry(&self, global_row_index: usize) -> Option<SparseEntry<T>> {
pub fn get_entry(&self, global_row_index: usize) -> Option<SparseEntry<'_, T>> {
self.lane.get_entry(global_row_index)
}
}
@ -693,7 +693,7 @@ impl<'a, T> CscColMut<'a, T> {
/// Returns a mutable entry for the given global row index.
#[must_use]
pub fn get_entry_mut(&mut self, global_row_index: usize) -> Option<SparseEntryMut<T>> {
pub fn get_entry_mut(&mut self, global_row_index: usize) -> Option<SparseEntryMut<'_, T>> {
self.lane.get_entry_mut(global_row_index)
}
}

View File

@ -262,7 +262,7 @@ impl<T> CsrMatrix<T> {
/// let triplets: Vec<_> = csr.triplet_iter().map(|(i, j, v)| (i, j, *v)).collect();
/// assert_eq!(triplets, vec![(0, 0, 1), (0, 2, 2), (1, 1, 3), (2, 0, 4)]);
/// ```
pub fn triplet_iter(&self) -> CsrTripletIter<T> {
pub fn triplet_iter(&self) -> CsrTripletIter<'_, T> {
CsrTripletIter {
pattern_iter: self.pattern().entries(),
values_iter: self.values().iter(),
@ -292,7 +292,7 @@ impl<T> CsrMatrix<T> {
/// let triplets: Vec<_> = csr.triplet_iter().map(|(i, j, v)| (i, j, *v)).collect();
/// assert_eq!(triplets, vec![(0, 0, 1), (0, 2, 2), (1, 1, 3), (2, 0, 0)]);
/// ```
pub fn triplet_iter_mut(&mut self) -> CsrTripletIterMut<T> {
pub fn triplet_iter_mut(&mut self) -> CsrTripletIterMut<'_, T> {
let (pattern, values) = self.cs.pattern_and_values_mut();
CsrTripletIterMut {
pattern_iter: pattern.entries(),
@ -307,7 +307,7 @@ impl<T> CsrMatrix<T> {
/// Panics if row index is out of bounds.
#[inline]
#[must_use]
pub fn row(&self, index: usize) -> CsrRow<T> {
pub fn row(&self, index: usize) -> CsrRow<'_, T> {
self.get_row(index).expect("Row index must be in bounds")
}
@ -317,7 +317,7 @@ impl<T> CsrMatrix<T> {
/// ------
/// Panics if row index is out of bounds.
#[inline]
pub fn row_mut(&mut self, index: usize) -> CsrRowMut<T> {
pub fn row_mut(&mut self, index: usize) -> CsrRowMut<'_, T> {
self.get_row_mut(index)
.expect("Row index must be in bounds")
}
@ -325,26 +325,26 @@ impl<T> CsrMatrix<T> {
/// Return the row at the given row index, or `None` if out of bounds.
#[inline]
#[must_use]
pub fn get_row(&self, index: usize) -> Option<CsrRow<T>> {
pub fn get_row(&self, index: usize) -> Option<CsrRow<'_, T>> {
self.cs.get_lane(index).map(|lane| CsrRow { lane })
}
/// Mutable row access for the given row index, or `None` if out of bounds.
#[inline]
#[must_use]
pub fn get_row_mut(&mut self, index: usize) -> Option<CsrRowMut<T>> {
pub fn get_row_mut(&mut self, index: usize) -> Option<CsrRowMut<'_, T>> {
self.cs.get_lane_mut(index).map(|lane| CsrRowMut { lane })
}
/// An iterator over rows in the matrix.
pub fn row_iter(&self) -> CsrRowIter<T> {
pub fn row_iter(&self) -> CsrRowIter<'_, T> {
CsrRowIter {
lane_iter: CsLaneIter::new(self.pattern(), self.values()),
}
}
/// A mutable iterator over rows in the matrix.
pub fn row_iter_mut(&mut self) -> CsrRowIterMut<T> {
pub fn row_iter_mut(&mut self) -> CsrRowIterMut<'_, T> {
let (pattern, values) = self.cs.pattern_and_values_mut();
CsrRowIterMut {
lane_iter: CsLaneIterMut::new(pattern, values),
@ -410,7 +410,7 @@ impl<T> CsrMatrix<T> {
/// Each call to this function incurs the cost of a binary search among the explicitly
/// stored column entries for the given row.
#[must_use]
pub fn get_entry(&self, row_index: usize, col_index: usize) -> Option<SparseEntry<T>> {
pub fn get_entry(&self, row_index: usize, col_index: usize) -> Option<SparseEntry<'_, T>> {
self.cs.get_entry(row_index, col_index)
}
@ -423,7 +423,7 @@ impl<T> CsrMatrix<T> {
&mut self,
row_index: usize,
col_index: usize,
) -> Option<SparseEntryMut<T>> {
) -> Option<SparseEntryMut<'_, T>> {
self.cs.get_entry_mut(row_index, col_index)
}
@ -436,7 +436,7 @@ impl<T> CsrMatrix<T> {
/// ------
/// Panics if `row_index` or `col_index` is out of bounds.
#[must_use]
pub fn index_entry(&self, row_index: usize, col_index: usize) -> SparseEntry<T> {
pub fn index_entry(&self, row_index: usize, col_index: usize) -> SparseEntry<'_, T> {
self.get_entry(row_index, col_index)
.expect("Out of bounds matrix indices encountered")
}
@ -449,7 +449,7 @@ impl<T> CsrMatrix<T> {
/// Panics
/// ------
/// Panics if `row_index` or `col_index` is out of bounds.
pub fn index_entry_mut(&mut self, row_index: usize, col_index: usize) -> SparseEntryMut<T> {
pub fn index_entry_mut(&mut self, row_index: usize, col_index: usize) -> SparseEntryMut<'_, T> {
self.get_entry_mut(row_index, col_index)
.expect("Out of bounds matrix indices encountered")
}
@ -667,7 +667,7 @@ macro_rules! impl_csr_row_common_methods {
/// stored column entries.
#[inline]
#[must_use]
pub fn get_entry(&self, global_col_index: usize) -> Option<SparseEntry<T>> {
pub fn get_entry(&self, global_col_index: usize) -> Option<SparseEntry<'_, T>> {
self.lane.get_entry(global_col_index)
}
}
@ -697,7 +697,7 @@ impl<'a, T> CsrRowMut<'a, T> {
/// Returns a mutable entry for the given global column index.
#[inline]
#[must_use]
pub fn get_entry_mut(&mut self, global_col_index: usize) -> Option<SparseEntryMut<T>> {
pub fn get_entry_mut(&mut self, global_col_index: usize) -> Option<SparseEntryMut<'_, T>> {
self.lane.get_entry_mut(global_col_index)
}
}

View File

@ -72,7 +72,7 @@ pub struct CscCholesky<T> {
work_c: Vec<usize>,
}
#[derive(Debug, PartialEq, Eq, Clone)]
#[derive(Debug, PartialEq, Eq, Copy, Clone)]
#[non_exhaustive]
/// Possible errors produced by the Cholesky factorization.
pub enum CholeskyError {

View File

@ -131,12 +131,15 @@
//! assert_matrix_eq!(y, y_expected, comp = abs, tol = 1e-9);
//! }
//! ```
#![deny(non_camel_case_types)]
#![deny(unused_parens)]
#![deny(non_upper_case_globals)]
#![deny(unused_qualifications)]
#![deny(unused_results)]
#![deny(missing_docs)]
#![deny(
nonstandard_style,
unused,
missing_docs,
rust_2018_idioms,
rust_2018_compatibility,
future_incompatible,
missing_copy_implementations
)]
pub extern crate nalgebra as na;
pub mod convert;
@ -190,7 +193,7 @@ impl SparseFormatError {
/// The type of format error described by a [SparseFormatError](struct.SparseFormatError.html).
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq, Eq)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum SparseFormatErrorKind {
/// Indicates that the index data associated with the format contains at least one index
/// out of bounds.
@ -208,7 +211,7 @@ pub enum SparseFormatErrorKind {
}
impl fmt::Display for SparseFormatError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.error)
}
}

View File

@ -28,7 +28,7 @@ macro_rules! impl_matrix_for_csr_csc {
self.ncols()
}
fn access(&self) -> Access<T> {
fn access(&self) -> Access<'_, T> {
Access::Sparse(self)
}
}
@ -59,7 +59,7 @@ impl<T: Clone> matrixcompare_core::Matrix<T> for CooMatrix<T> {
self.ncols()
}
fn access(&self) -> Access<T> {
fn access(&self) -> Access<'_, T> {
Access::Sparse(self)
}
}

View File

@ -131,10 +131,10 @@ where
/// the transposed operation must be specified for the CSC matrix.
pub fn spmm_cs_dense<T>(
beta: T,
mut c: DMatrixSliceMut<T>,
mut c: DMatrixSliceMut<'_, T>,
alpha: T,
a: Op<&CsMatrix<T>>,
b: Op<DMatrixSlice<T>>,
b: Op<DMatrixSlice<'_, T>>,
) where
T: Scalar + ClosedAdd + ClosedMul + Zero + One,
{

View File

@ -27,10 +27,10 @@ pub fn spmm_csc_dense<'a, T>(
fn spmm_csc_dense_<T>(
beta: T,
c: DMatrixSliceMut<T>,
c: DMatrixSliceMut<'_, T>,
alpha: T,
a: Op<&CscMatrix<T>>,
b: Op<DMatrixSlice<T>>,
b: Op<DMatrixSlice<'_, T>>,
) where
T: Scalar + ClosedAdd + ClosedMul + Zero + One,
{
@ -147,7 +147,7 @@ pub fn spsolve_csc_lower_triangular<'a, T: RealField>(
fn spsolve_csc_lower_triangular_no_transpose<T: RealField>(
l: &CscMatrix<T>,
b: DMatrixSliceMut<T>,
b: DMatrixSliceMut<'_, T>,
) -> Result<(), OperationError> {
let mut x = b;
@ -205,7 +205,7 @@ fn spsolve_encountered_zero_diagonal() -> Result<(), OperationError> {
fn spsolve_csc_lower_triangular_transpose<T: RealField>(
l: &CscMatrix<T>,
b: DMatrixSliceMut<T>,
b: DMatrixSliceMut<'_, T>,
) -> Result<(), OperationError> {
let mut x = b;

View File

@ -22,10 +22,10 @@ pub fn spmm_csr_dense<'a, T>(
fn spmm_csr_dense_<T>(
beta: T,
c: DMatrixSliceMut<T>,
c: DMatrixSliceMut<'_, T>,
alpha: T,
a: Op<&CsrMatrix<T>>,
b: Op<DMatrixSlice<T>>,
b: Op<DMatrixSlice<'_, T>>,
) where
T: Scalar + ClosedAdd + ClosedMul + Zero + One,
{

View File

@ -74,7 +74,7 @@ pub struct OperationError {
/// The different kinds of operation errors that may occur.
#[non_exhaustive]
#[derive(Clone, Debug)]
#[derive(Copy, Clone, Debug)]
pub enum OperationErrorKind {
/// Indicates that one or more sparsity patterns involved in the operation violate the
/// expectations of the routine.

View File

@ -205,7 +205,7 @@ impl SparsityPattern {
/// ```
///
#[must_use]
pub fn entries(&self) -> SparsityPatternIter {
pub fn entries(&self) -> SparsityPatternIter<'_> {
SparsityPatternIter::from_pattern(self)
}
@ -260,7 +260,7 @@ impl SparsityPattern {
/// Error type for `SparsityPattern` format errors.
#[non_exhaustive]
#[derive(Debug, PartialEq, Eq)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum SparsityPatternFormatError {
/// Indicates an invalid number of offsets.
///

View File

@ -0,0 +1,3 @@
edition = "2018"
use_try_shorthand = true
use_field_init_shorthand = true

View File

@ -32,8 +32,8 @@ pub trait Allocator<T: Scalar, R: Dim, C: Dim = U1>: Any + Sized {
) -> Self::Buffer;
}
/// A matrix reallocator. Changes the size of the memory buffer that initially contains (RFrom ×
/// CFrom) elements to a smaller or larger size (RTo, CTo).
/// A matrix reallocator. Changes the size of the memory buffer that initially contains (`RFrom` ×
/// `CFrom`) elements to a smaller or larger size (`RTo`, `CTo`).
pub trait Reallocator<T: Scalar, RFrom: Dim, CFrom: Dim, RTo: Dim, CTo: Dim>:
Allocator<T, RFrom, CFrom> + Allocator<T, RTo, CTo>
{

View File

@ -79,7 +79,7 @@ impl<T: RealField> Matrix3<T> {
/// Creates a new homogeneous matrix that applies a scaling factor for each dimension with respect to point.
///
/// Can be used to implement "zoom_to" functionality.
/// Can be used to implement `zoom_to` functionality.
#[inline]
pub fn new_nonuniform_scaling_wrt_point(scaling: &Vector2<T>, pt: &Point2<T>) -> Self {
let zero = T::zero();
@ -119,7 +119,7 @@ impl<T: RealField> Matrix4<T> {
/// Creates a new homogeneous matrix that applies a scaling factor for each dimension with respect to point.
///
/// Can be used to implement "zoom_to" functionality.
/// Can be used to implement `zoom_to` functionality.
#[inline]
pub fn new_nonuniform_scaling_wrt_point(scaling: &Vector3<T>, pt: &Point3<T>) -> Self {
let zero = T::zero();
@ -187,7 +187,7 @@ impl<T: RealField> Matrix4<T> {
IsometryMatrix3::face_towards(eye, target, up).to_homogeneous()
}
/// Deprecated: Use [Matrix4::face_towards] instead.
/// Deprecated: Use [`Matrix4::face_towards`] instead.
#[deprecated(note = "renamed to `face_towards`")]
pub fn new_observer_frame(eye: &Point3<T>, target: &Point3<T>, up: &Vector3<T>) -> Self {
Matrix4::face_towards(eye, target, up)

View File

@ -3,6 +3,7 @@
use crate::base::dimension::{Dim, DimName, Dynamic};
/// A type used in `where` clauses for enforcing constraints.
#[derive(Copy, Clone, Debug)]
pub struct ShapeConstraint;
/// Constraints `C1` and `R2` to be equivalent.

View File

@ -888,19 +888,19 @@ macro_rules! transpose_array(
[$([$a]),*]
};
[$($a: ident),*; $($b: ident),*;] => {
[$([$a, $b]),*];
[$([$a, $b]),*]
};
[$($a: ident),*; $($b: ident),*; $($c: ident),*;] => {
[$([$a, $b, $c]),*];
[$([$a, $b, $c]),*]
};
[$($a: ident),*; $($b: ident),*; $($c: ident),*; $($d: ident),*;] => {
[$([$a, $b, $c, $d]),*];
[$([$a, $b, $c, $d]),*]
};
[$($a: ident),*; $($b: ident),*; $($c: ident),*; $($d: ident),*; $($e: ident),*;] => {
[$([$a, $b, $c, $d, $e]),*];
[$([$a, $b, $c, $d, $e]),*]
};
[$($a: ident),*; $($b: ident),*; $($c: ident),*; $($d: ident),*; $($e: ident),*; $($f: ident),*;] => {
[$([$a, $b, $c, $d, $e, $f]),*];
[$([$a, $b, $c, $d, $e, $f]),*]
};
);

View File

@ -28,6 +28,7 @@ use crate::base::Scalar;
*/
/// An allocator based on `GenericArray` and `VecStorage` for statically-sized and dynamically-sized
/// matrices respectively.
#[derive(Copy, Clone, Debug)]
pub struct DefaultAllocator;
// Static - Static

View File

@ -11,6 +11,7 @@ use crate::base::{Matrix, MatrixSlice, MatrixSliceMut, Scalar};
macro_rules! iterator {
(struct $Name:ident for $Storage:ident.$ptr: ident -> $Ptr:ty, $Ref:ty, $SRef: ty) => {
/// An iterator through a dense matrix with arbitrary strides matrix.
#[derive(Debug)]
pub struct $Name<'a, T: Scalar, R: Dim, C: Dim, S: 'a + $Storage<T, R, C>> {
ptr: $Ptr,
inner_ptr: $Ptr,
@ -180,7 +181,7 @@ iterator!(struct MatrixIterMut for StorageMut.ptr_mut -> *mut T, &'a mut T, &'a
* Row iterators.
*
*/
#[derive(Clone)]
#[derive(Clone, Debug)]
/// An iterator through the rows of a matrix.
pub struct RowIter<'a, T: Scalar, R: Dim, C: Dim, S: Storage<T, R, C>> {
mat: &'a Matrix<T, R, C, S>,
@ -231,6 +232,7 @@ impl<'a, T: Scalar, R: Dim, C: Dim, S: 'a + Storage<T, R, C>> ExactSizeIterator
}
/// An iterator through the mutable rows of a matrix.
#[derive(Debug)]
pub struct RowIterMut<'a, T: Scalar, R: Dim, C: Dim, S: StorageMut<T, R, C>> {
mat: *mut Matrix<T, R, C, S>,
curr: usize,
@ -292,7 +294,7 @@ impl<'a, T: Scalar, R: Dim, C: Dim, S: 'a + StorageMut<T, R, C>> ExactSizeIterat
* Column iterators.
*
*/
#[derive(Clone)]
#[derive(Clone, Debug)]
/// An iterator through the columns of a matrix.
pub struct ColumnIter<'a, T: Scalar, R: Dim, C: Dim, S: Storage<T, R, C>> {
mat: &'a Matrix<T, R, C, S>,
@ -345,6 +347,7 @@ impl<'a, T: Scalar, R: Dim, C: Dim, S: 'a + Storage<T, R, C>> ExactSizeIterator
}
/// An iterator through the mutable columns of a matrix.
#[derive(Debug)]
pub struct ColumnIterMut<'a, T: Scalar, R: Dim, C: Dim, S: StorageMut<T, R, C>> {
mat: *mut Matrix<T, R, C, S>,
curr: usize,

View File

@ -368,7 +368,7 @@ impl<T, R, C, S> Matrix<T, R, C, S> {
}
impl<T, const R: usize, const C: usize> SMatrix<T, R, C> {
/// Creates a new statically-allocated matrix from the given [ArrayStorage].
/// Creates a new statically-allocated matrix from the given [`ArrayStorage`].
///
/// This method exists primarily as a workaround for the fact that `from_data` can not
/// work in `const fn` contexts.
@ -384,7 +384,7 @@ impl<T, const R: usize, const C: usize> SMatrix<T, R, C> {
// `from_data` const fn compatible
#[cfg(any(feature = "std", feature = "alloc"))]
impl<T> DMatrix<T> {
/// Creates a new heap-allocated matrix from the given [VecStorage].
/// Creates a new heap-allocated matrix from the given [`VecStorage`].
///
/// This method exists primarily as a workaround for the fact that `from_data` can not
/// work in `const fn` contexts.
@ -399,7 +399,7 @@ impl<T> DMatrix<T> {
// `from_data` const fn compatible
#[cfg(any(feature = "std", feature = "alloc"))]
impl<T> DVector<T> {
/// Creates a new heap-allocated matrix from the given [VecStorage].
/// Creates a new heap-allocated matrix from the given [`VecStorage`].
///
/// This method exists primarily as a workaround for the fact that `from_data` can not
/// work in `const fn` contexts.

View File

@ -584,7 +584,7 @@ macro_rules! matrix_slice_impl(
* Splitting.
*
*/
/// Splits this NxM matrix into two parts delimited by two ranges.
/// Splits this `NxM` matrix into two parts delimited by two ranges.
///
/// Panics if the ranges overlap or if the first range is empty.
#[inline]
@ -620,7 +620,7 @@ macro_rules! matrix_slice_impl(
}
}
/// Splits this NxM matrix into two parts delimited by two ranges.
/// Splits this `NxM` matrix into two parts delimited by two ranges.
///
/// Panics if the ranges overlap or if the first range is empty.
#[inline]

View File

@ -40,10 +40,13 @@ pub trait Norm<T: SimdComplexField> {
}
/// Euclidean norm.
#[derive(Copy, Clone, Debug)]
pub struct EuclideanNorm;
/// Lp norm.
#[derive(Copy, Clone, Debug)]
pub struct LpNorm(pub i32);
/// L-infinite norm aka. Chebytchev norm aka. uniform norm aka. suppremum norm.
#[derive(Copy, Clone, Debug)]
pub struct UniformNorm;
impl<T: SimdComplexField> Norm<T> for EuclideanNorm {

View File

@ -238,7 +238,7 @@ impl<T> Unit<T> {
}
/// Retrieves the underlying value.
/// Deprecated: use [Unit::into_inner] instead.
/// Deprecated: use [`Unit::into_inner`] instead.
#[deprecated(note = "use `.into_inner()` instead")]
#[inline]
pub fn unwrap(self) -> T {

View File

@ -79,7 +79,7 @@ where
}
#[deprecated(note = "renamed to `VecStorage`")]
/// Renamed to [VecStorage].
/// Renamed to [`VecStorage`].
pub type MatrixVec<T, R, C> = VecStorage<T, R, C>;
impl<T, R: Dim, C: Dim> VecStorage<T, R, C> {

View File

@ -16,7 +16,7 @@ use simba::scalar::{ClosedNeg, RealField};
///
/// # Indexing
///
/// DualQuaternions are stored as \[..real, ..dual\].
/// `DualQuaternions` are stored as \[..real, ..dual\].
/// Both of the quaternion components are laid out in `i, j, k, w` order.
///
/// ```
@ -36,7 +36,7 @@ use simba::scalar::{ClosedNeg, RealField};
/// NOTE:
/// As of December 2020, dual quaternion support is a work in progress.
/// If a feature that you need is missing, feel free to open an issue or a PR.
/// See https://github.com/dimforge/nalgebra/issues/487
/// See <https://github.com/dimforge/nalgebra/issues/487>
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct DualQuaternion<T> {

View File

@ -308,7 +308,7 @@ macro_rules! look_at_isometry_construction_impl(
$RotId::face_towards(&(target - eye), up))
}
/// Deprecated: Use [Isometry::face_towards] instead.
/// Deprecated: Use [`Isometry::face_towards`] instead.
#[deprecated(note="renamed to `face_towards`")]
pub fn new_observer_frame(eye: &Point3<T>,
target: &Point3<T>,

View File

@ -314,7 +314,7 @@ impl<T: RealField> Orthographic3<T> {
}
/// Retrieves the underlying homogeneous matrix.
/// Deprecated: Use [Orthographic3::into_inner] instead.
/// Deprecated: Use [`Orthographic3::into_inner`] instead.
#[deprecated(note = "use `.into_inner()` instead")]
#[inline]
pub fn unwrap(self) -> Matrix4<T> {

View File

@ -175,7 +175,7 @@ impl<T: RealField> Perspective3<T> {
}
/// Retrieves the underlying homogeneous matrix.
/// Deprecated: Use [Perspective3::into_inner] instead.
/// Deprecated: Use [`Perspective3::into_inner`] instead.
#[deprecated(note = "use `.into_inner()` instead")]
#[inline]
pub fn unwrap(self) -> Matrix4<T> {

View File

@ -591,7 +591,7 @@ where
Self::from_rotation_matrix(&Rotation3::face_towards(dir, up))
}
/// Deprecated: Use [UnitQuaternion::face_towards] instead.
/// Deprecated: Use [`UnitQuaternion::face_towards`] instead.
#[deprecated(note = "renamed to `face_towards`")]
pub fn new_observer_frames<SB, SC>(dir: &Vector<T, U3, SB>, up: &Vector<T, U3, SC>) -> Self
where
@ -785,7 +785,7 @@ where
Self::new_eps(axisangle, eps)
}
/// Create the mean unit quaternion from a data structure implementing IntoIterator
/// Create the mean unit quaternion from a data structure implementing `IntoIterator`
/// returning unit quaternions.
///
/// The method will panic if the iterator does not return any quaternions.

View File

@ -244,7 +244,7 @@ impl<T: Scalar, const D: usize> Rotation<T, D> {
}
/// Unwraps the underlying matrix.
/// Deprecated: Use [Rotation::into_inner] instead.
/// Deprecated: Use [`Rotation::into_inner`] instead.
#[deprecated(note = "use `.into_inner()` instead")]
#[inline]
pub fn unwrap(self) -> SMatrix<T, D, D> {

View File

@ -483,7 +483,7 @@ where
))
}
/// Deprecated: Use [Rotation3::face_towards] instead.
/// Deprecated: Use [`Rotation3::face_towards`] instead.
#[deprecated(note = "renamed to `face_towards`")]
pub fn new_observer_frames<SB, SC>(dir: &Vector<T, U3, SB>, up: &Vector<T, U3, SC>) -> Self
where

View File

@ -306,7 +306,7 @@ macro_rules! similarity_construction_impl(
Self::from_isometry(Isometry::<_, $Rot<T>, 3>::face_towards(eye, target, up), scaling)
}
/// Deprecated: Use [SimilarityMatrix3::face_towards] instead.
/// Deprecated: Use [`SimilarityMatrix3::face_towards`] instead.
#[deprecated(note="renamed to `face_towards`")]
pub fn new_observer_frames(eye: &Point3<T>,
target: &Point3<T>,

View File

@ -305,7 +305,7 @@ where
}
/// Retrieves the underlying matrix.
/// Deprecated: Use [Transform::into_inner] instead.
/// Deprecated: Use [`Transform::into_inner`] instead.
#[deprecated(note = "use `.into_inner()` instead")]
#[inline]
pub fn unwrap(self) -> OMatrix<T, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>> {

View File

@ -1,4 +1,3 @@
#![allow(clippy::type_complexity)]
/*!
# nalgebra
@ -72,17 +71,18 @@ an optimized set of tools for computer graphics and physics. Those features incl
* Insertion and removal of rows of columns of a matrix.
*/
// #![feature(plugin)]
//
// #![plugin(clippy)]
#![deny(non_camel_case_types)]
#![deny(unused_parens)]
#![deny(non_upper_case_globals)]
#![deny(unused_qualifications)]
#![deny(unused_results)]
#![deny(missing_docs)]
#![deny(rust_2018_idioms)]
#![allow(unused_variables, unused_mut)]
#![deny(
nonstandard_style,
unused_parens,
unused_qualifications,
unused_results,
missing_docs,
rust_2018_idioms,
rust_2018_compatibility,
future_incompatible,
missing_copy_implementations
)]
#![doc(
html_favicon_url = "https://nalgebra.org/img/favicon.ico",
html_root_url = "https://docs.rs/nalgebra/0.25.0"
@ -246,7 +246,7 @@ pub fn min<T: Ord>(a: T, b: T) -> T {
/// The absolute value of `a`.
///
/// Deprecated: Use [Matrix::abs] or [RealField::abs] instead.
/// Deprecated: Use [`Matrix::abs`] or [`RealField::abs`] instead.
#[deprecated(note = "use the inherent method `Matrix::abs` or `RealField::abs` instead")]
#[inline]
pub fn abs<T: Signed>(a: &T) -> T {
@ -385,7 +385,7 @@ pub fn partial_sort2<'a, T: PartialOrd>(a: &'a T, b: &'a T) -> Option<(&'a T, &'
/// # See also:
///
/// * [distance](fn.distance.html)
/// * [distance_squared](fn.distance_squared.html)
/// * [`distance_squared`](fn.distance_squared.html)
#[inline]
pub fn center<T: SimdComplexField, const D: usize>(
p1: &Point<T, D>,
@ -399,7 +399,7 @@ pub fn center<T: SimdComplexField, const D: usize>(
/// # See also:
///
/// * [center](fn.center.html)
/// * [distance_squared](fn.distance_squared.html)
/// * [`distance_squared`](fn.distance_squared.html)
#[inline]
pub fn distance<T: SimdComplexField, const D: usize>(
p1: &Point<T, D>,
@ -431,11 +431,11 @@ pub fn distance_squared<T: SimdComplexField, const D: usize>(
///
/// # See also:
///
/// * [convert_ref](fn.convert_ref.html)
/// * [convert_ref_unchecked](fn.convert_ref_unchecked.html)
/// * [is_convertible](../nalgebra/fn.is_convertible.html)
/// * [try_convert](fn.try_convert.html)
/// * [try_convert_ref](fn.try_convert_ref.html)
/// * [`convert_ref`](fn.convert_ref.html)
/// * [`convert_ref_unchecked`](fn.convert_ref_unchecked.html)
/// * [`is_convertible`](../nalgebra/fn.is_convertible.html)
/// * [`try_convert`](fn.try_convert.html)
/// * [`try_convert_ref`](fn.try_convert_ref.html)
#[inline]
pub fn convert<From, To: SupersetOf<From>>(t: From) -> To {
To::from_subset(&t)
@ -448,10 +448,10 @@ pub fn convert<From, To: SupersetOf<From>>(t: From) -> To {
/// # See also:
///
/// * [convert](fn.convert.html)
/// * [convert_ref](fn.convert_ref.html)
/// * [convert_ref_unchecked](fn.convert_ref_unchecked.html)
/// * [is_convertible](../nalgebra/fn.is_convertible.html)
/// * [try_convert_ref](fn.try_convert_ref.html)
/// * [`convert_ref`](fn.convert_ref.html)
/// * [`convert_ref_unchecked`](fn.convert_ref_unchecked.html)
/// * [`is_convertible`](../nalgebra/fn.is_convertible.html)
/// * [`try_convert_ref`](fn.try_convert_ref.html)
#[inline]
pub fn try_convert<From: SupersetOf<To>, To>(t: From) -> Option<To> {
t.to_subset()
@ -463,10 +463,10 @@ pub fn try_convert<From: SupersetOf<To>, To>(t: From) -> Option<To> {
/// # See also:
///
/// * [convert](fn.convert.html)
/// * [convert_ref](fn.convert_ref.html)
/// * [convert_ref_unchecked](fn.convert_ref_unchecked.html)
/// * [try_convert](fn.try_convert.html)
/// * [try_convert_ref](fn.try_convert_ref.html)
/// * [`convert_ref`](fn.convert_ref.html)
/// * [`convert_ref_unchecked`](fn.convert_ref_unchecked.html)
/// * [`try_convert`](fn.try_convert.html)
/// * [`try_convert_ref`](fn.try_convert_ref.html)
#[inline]
pub fn is_convertible<From: SupersetOf<To>, To>(t: &From) -> bool {
t.is_in_subset()
@ -478,11 +478,11 @@ pub fn is_convertible<From: SupersetOf<To>, To>(t: &From) -> bool {
/// # See also:
///
/// * [convert](fn.convert.html)
/// * [convert_ref](fn.convert_ref.html)
/// * [convert_ref_unchecked](fn.convert_ref_unchecked.html)
/// * [is_convertible](../nalgebra/fn.is_convertible.html)
/// * [try_convert](fn.try_convert.html)
/// * [try_convert_ref](fn.try_convert_ref.html)
/// * [`convert_ref`](fn.convert_ref.html)
/// * [`convert_ref_unchecked`](fn.convert_ref_unchecked.html)
/// * [`is_convertible`](../nalgebra/fn.is_convertible.html)
/// * [`try_convert`](fn.try_convert.html)
/// * [`try_convert_ref`](fn.try_convert_ref.html)
#[inline]
pub fn convert_unchecked<From: SupersetOf<To>, To>(t: From) -> To {
t.to_subset_unchecked()
@ -493,10 +493,10 @@ pub fn convert_unchecked<From: SupersetOf<To>, To>(t: From) -> To {
/// # See also:
///
/// * [convert](fn.convert.html)
/// * [convert_ref_unchecked](fn.convert_ref_unchecked.html)
/// * [is_convertible](../nalgebra/fn.is_convertible.html)
/// * [try_convert](fn.try_convert.html)
/// * [try_convert_ref](fn.try_convert_ref.html)
/// * [`convert_ref_unchecked`](fn.convert_ref_unchecked.html)
/// * [`is_convertible`](../nalgebra/fn.is_convertible.html)
/// * [`try_convert`](fn.try_convert.html)
/// * [`try_convert_ref`](fn.try_convert_ref.html)
#[inline]
pub fn convert_ref<From, To: SupersetOf<From>>(t: &From) -> To {
To::from_subset(t)
@ -507,10 +507,10 @@ pub fn convert_ref<From, To: SupersetOf<From>>(t: &From) -> To {
/// # See also:
///
/// * [convert](fn.convert.html)
/// * [convert_ref](fn.convert_ref.html)
/// * [convert_ref_unchecked](fn.convert_ref_unchecked.html)
/// * [is_convertible](../nalgebra/fn.is_convertible.html)
/// * [try_convert](fn.try_convert.html)
/// * [`convert_ref`](fn.convert_ref.html)
/// * [`convert_ref_unchecked`](fn.convert_ref_unchecked.html)
/// * [`is_convertible`](../nalgebra/fn.is_convertible.html)
/// * [`try_convert`](fn.try_convert.html)
#[inline]
pub fn try_convert_ref<From: SupersetOf<To>, To>(t: &From) -> Option<To> {
t.to_subset()
@ -522,10 +522,10 @@ pub fn try_convert_ref<From: SupersetOf<To>, To>(t: &From) -> Option<To> {
/// # See also:
///
/// * [convert](fn.convert.html)
/// * [convert_ref](fn.convert_ref.html)
/// * [is_convertible](../nalgebra/fn.is_convertible.html)
/// * [try_convert](fn.try_convert.html)
/// * [try_convert_ref](fn.try_convert_ref.html)
/// * [`convert_ref`](fn.convert_ref.html)
/// * [`is_convertible`](../nalgebra/fn.is_convertible.html)
/// * [`try_convert`](fn.try_convert.html)
/// * [`try_convert_ref`](fn.try_convert_ref.html)
#[inline]
pub fn convert_ref_unchecked<From: SupersetOf<To>, To>(t: &From) -> To {
t.to_subset_unchecked()

View File

@ -11,7 +11,7 @@ use crate::base::{Const, DefaultAllocator, OMatrix, OVector};
/// Applies in-place a modified Parlett and Reinsch matrix balancing with 2-norm to the matrix and returns
/// the corresponding diagonal transformation.
///
/// See https://arxiv.org/pdf/1401.5766.pdf
/// See <https://arxiv.org/pdf/1401.5766.pdf>
pub fn balance_parlett_reinsch<T: RealField, D: Dim>(matrix: &mut OMatrix<T, D, D>) -> OVector<T, D>
where
DefaultAllocator: Allocator<T, D, D> + Allocator<T, D>,

View File

@ -60,7 +60,7 @@ where
+ Allocator<T, DimMinimum<R, C>>
+ Allocator<(usize, usize), DimMinimum<R, C>>,
{
/// Computes the ColPivQR decomposition using householder reflections.
/// Computes the `ColPivQR` decomposition using householder reflections.
pub fn new(mut matrix: OMatrix<T, R, C>) -> Self {
let (nrows, ncols) = matrix.data.shape();
let min_nrows_ncols = nrows.min(ncols);

View File

@ -19,7 +19,7 @@ use crate::linalg::Hessenberg;
/// Schur decomposition of a square matrix.
///
/// If this is a real matrix, this will be a RealField Schur decomposition.
/// If this is a real matrix, this will be a `RealField` Schur decomposition.
#[cfg_attr(feature = "serde-serialize-no-std", derive(Serialize, Deserialize))]
#[cfg_attr(
feature = "serde-serialize-no-std",

View File

@ -2,12 +2,12 @@
//!
//! **This module is only available when the `proptest-support` feature is enabled in `nalgebra`**.
//!
//! `proptest` is a library for *property-based testing*. While similar to QuickCheck,
//! `proptest` is a library for *property-based testing*. While similar to `QuickCheck`,
//! which may be more familiar to some users, it has a more sophisticated design that
//! provides users with automatic invariant-preserving shrinking. This means that when using
//! `proptest`, you rarely need to write your own shrinkers - which is usually very difficult -
//! and can instead get this "for free". Moreover, `proptest` does not rely on a canonical
//! `Arbitrary` trait implementation like QuickCheck, though it does also provide this. For
//! `Arbitrary` trait implementation like `QuickCheck`, though it does also provide this. For
//! more information, check out the [proptest docs](https://docs.rs/proptest/0.10.1/proptest/)
//! and the [proptest book](https://altsysrq.github.io/proptest-book/intro.html).
//!
@ -316,7 +316,7 @@ where
/// with length in the provided range.
///
/// This is a convenience function for calling
/// [matrix(value_strategy, length, U1)](fn.matrix.html) and should
/// [`matrix(value_strategy, length, U1)`](fn.matrix.html) and should
/// be used when you only want to generate column vectors, as it's simpler and makes the intent
/// clear.
pub fn vector<D, ScalarStrategy>(

View File

@ -46,7 +46,7 @@ impl<'a, T: Clone> Iterator for ColumnEntries<'a, T> {
pub trait CsStorageIter<'a, T, R, C = U1> {
/// Iterator through all the rows of a specific columns.
///
/// The elements are given as a tuple (row_index, value).
/// The elements are given as a tuple (`row_index`, value).
type ColumnEntries: Iterator<Item = (usize, T)>;
/// Iterator through the row indices of a specific column.
type ColumnRowIndices: Iterator<Item = usize>;
@ -63,7 +63,7 @@ pub trait CsStorageIterMut<'a, T: 'a, R, C = U1> {
type ValuesMut: Iterator<Item = &'a mut T>;
/// Mutable iterator through all the rows of a specific columns.
///
/// The elements are given as a tuple (row_index, value).
/// The elements are given as a tuple (`row_index`, value).
type ColumnEntriesMut: Iterator<Item = (usize, &'a mut T)>;
/// A mutable iterator through the values buffer of the sparse matrix.

View File

@ -120,7 +120,7 @@ where
#[inline]
fn decompose(&self) -> (Self::Translation, R, Id, R) {
(
self.translation.clone(),
self.translation,
self.rotation.clone(),
Id::new(),
<R as AbstractRotation<T, D>>::identity(),
@ -145,7 +145,7 @@ where
#[inline]
fn prepend_rotation(&self, r: &Self::Rotation) -> Self {
Isometry::from_parts(self.translation.clone(), self.rotation.prepend_rotation(r))
Isometry::from_parts(self.translation, self.rotation.prepend_rotation(r))
}
#[inline]
@ -175,7 +175,7 @@ where
#[inline]
fn translation(&self) -> Translation<T, D> {
self.translation.clone()
self.translation
}
#[inline]

View File

@ -105,17 +105,17 @@ impl<T: RealField + simba::scalar::RealField, const D: usize> AffineTransformati
#[inline]
fn decompose(&self) -> (Id, Self, Id, Self) {
(Id::new(), self.clone(), Id::new(), Self::identity())
(Id::new(), *self, Id::new(), Self::identity())
}
#[inline]
fn append_translation(&self, _: &Self::Translation) -> Self {
self.clone()
*self
}
#[inline]
fn prepend_translation(&self, _: &Self::Translation) -> Self {
self.clone()
*self
}
#[inline]
@ -130,12 +130,12 @@ impl<T: RealField + simba::scalar::RealField, const D: usize> AffineTransformati
#[inline]
fn append_scaling(&self, _: &Self::NonUniformScaling) -> Self {
self.clone()
*self
}
#[inline]
fn prepend_scaling(&self, _: &Self::NonUniformScaling) -> Self {
self.clone()
*self
}
}
@ -151,7 +151,7 @@ impl<T: RealField + simba::scalar::RealField, const D: usize> Similarity<Point<T
#[inline]
fn rotation(&self) -> Self {
self.clone()
*self
}
#[inline]

View File

@ -117,7 +117,7 @@ where
#[inline]
fn decompose(&self) -> (Translation<T, D>, R, T, R) {
(
self.isometry.translation.clone(),
self.isometry.translation,
self.isometry.rotation.clone(),
self.scaling(),
<R as AbstractRotation<T, D>>::identity(),

View File

@ -106,7 +106,7 @@ impl<T: RealField + simba::scalar::RealField, const D: usize> AffineTransformati
#[inline]
fn decompose(&self) -> (Self, Id, Id, Id) {
(self.clone(), Id::new(), Id::new(), Id::new())
(*self, Id::new(), Id::new(), Id::new())
}
#[inline]
@ -121,22 +121,22 @@ impl<T: RealField + simba::scalar::RealField, const D: usize> AffineTransformati
#[inline]
fn append_rotation(&self, _: &Self::Rotation) -> Self {
self.clone()
*self
}
#[inline]
fn prepend_rotation(&self, _: &Self::Rotation) -> Self {
self.clone()
*self
}
#[inline]
fn append_scaling(&self, _: &Self::NonUniformScaling) -> Self {
self.clone()
*self
}
#[inline]
fn prepend_scaling(&self, _: &Self::NonUniformScaling) -> Self {
self.clone()
*self
}
}
@ -147,7 +147,7 @@ impl<T: RealField + simba::scalar::RealField, const D: usize> Similarity<Point<T
#[inline]
fn translation(&self) -> Self {
self.clone()
*self
}
#[inline]