Fix unused_result lint errors.

This commit is contained in:
Sébastien Crozet 2017-08-15 18:24:34 +02:00 committed by Sébastien Crozet
parent c235728fb0
commit 740d19437c
7 changed files with 16 additions and 15 deletions

View File

@ -1,4 +1,5 @@
#![feature(test)]
#![allow(unused_macros)]
extern crate test;
extern crate rand;

View File

@ -215,7 +215,7 @@ impl<N: Real, R: DimName, C: DimName> FiniteDimInnerSpace for MatrixMN<N, R, C>
match Self::dimension() {
1 => {
if vs.len() == 0 {
f(&Self::canonical_basis_element(0));
let _ = f(&Self::canonical_basis_element(0));
}
},
2 => {
@ -227,7 +227,7 @@ impl<N: Real, R: DimName, C: DimName> FiniteDimInnerSpace for MatrixMN<N, R, C>
let v = &vs[0];
let res = Self::from_column_slice(&[-v[1], v[0]]);
f(&res.normalize());
let _ = f(&res.normalize());
}
// Otherwise, nothing.
@ -252,11 +252,11 @@ impl<N: Real, R: DimName, C: DimName> FiniteDimInnerSpace for MatrixMN<N, R, C>
let _ = a.normalize_mut();
if f(&a.cross(v)) {
f(&a);
let _ = f(&a);
}
}
else if vs.len() == 2 {
f(&vs[0].cross(&vs[1]).normalize());
let _ = f(&vs[0].cross(&vs[1]).normalize());
}
},
_ => {

View File

@ -144,7 +144,7 @@ macro_rules! componentwise_binop_impl(
if self.data.is_contiguous() && rhs.data.is_contiguous() && out.data.is_contiguous() {
let arr1 = self.data.as_slice();
let arr2 = rhs.data.as_slice();
let mut out = out.data.as_mut_slice();
let out = out.data.as_mut_slice();
for i in 0 .. arr1.len() {
unsafe {
*out.get_unchecked_mut(i) = arr1.get_unchecked(i).$method(*arr2.get_unchecked(i));
@ -175,7 +175,7 @@ macro_rules! componentwise_binop_impl(
// This is the most common case and should be deduced at compile-time.
// FIXME: use specialization instead?
if self.data.is_contiguous() && rhs.data.is_contiguous() {
let mut arr1 = self.data.as_mut_slice();
let arr1 = self.data.as_mut_slice();
let arr2 = rhs.data.as_slice();
for i in 0 .. arr2.len() {
unsafe {
@ -206,7 +206,7 @@ macro_rules! componentwise_binop_impl(
// FIXME: use specialization instead?
if self.data.is_contiguous() && rhs.data.is_contiguous() {
let arr1 = self.data.as_slice();
let mut arr2 = rhs.data.as_mut_slice();
let arr2 = rhs.data.as_mut_slice();
for i in 0 .. arr1.len() {
unsafe {
let res = arr1.get_unchecked(i).$method(*arr2.get_unchecked(i));
@ -218,7 +218,7 @@ macro_rules! componentwise_binop_impl(
for j in 0 .. self.ncols() {
for i in 0 .. self.nrows() {
unsafe {
let mut r = rhs.get_unchecked_mut(i, j);
let r = rhs.get_unchecked_mut(i, j);
*r = self.get_unchecked(i, j).$method(*r)
}
}

View File

@ -104,8 +104,8 @@ impl<N: Real, D: DimSub<Dynamic>> Cholesky<N, D>
pub fn solve_mut<R2: Dim, C2: Dim, S2>(&self, b: &mut Matrix<N, R2, C2, S2>)
where S2: StorageMut<N, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D> {
self.chol.solve_lower_triangular_mut(b);
self.chol.tr_solve_lower_triangular_mut(b);
let _ = self.chol.solve_lower_triangular_mut(b);
let _ = self.chol.tr_solve_lower_triangular_mut(b);
}
/// Returns the solution of the system `self * x = b` where `self` is the decomposed matrix and

View File

@ -175,8 +175,8 @@ impl<N: Real, D: DimMin<D, Output = D>> FullPivLU<N, D, D>
if self.is_invertible() {
self.p.permute_rows(b);
self.lu.solve_lower_triangular_with_diag_mut(b, N::one());
self.lu.solve_upper_triangular_mut(b);
let _ = self.lu.solve_lower_triangular_with_diag_mut(b, N::one());
let _ = self.lu.solve_upper_triangular_mut(b);
self.q.inv_permute_rows(b);
true

View File

@ -73,7 +73,7 @@ pub fn try_invert_to<N: Real, D: Dim, S>(mut matrix: MatrixN<N, D>,
}
}
matrix.solve_lower_triangular_with_diag_mut(out, N::one());
let _ = matrix.solve_lower_triangular_with_diag_mut(out, N::one());
matrix.solve_upper_triangular_mut(out)
}
@ -216,7 +216,7 @@ impl<N: Real, D: DimMin<D, Output = D>> LU<N, D, D>
assert!(self.lu.is_square(), "LU solve: unable to solve a non-square system.");
self.p.permute_rows(b);
self.lu.solve_lower_triangular_with_diag_mut(b, N::one());
let _ = self.lu.solve_lower_triangular_with_diag_mut(b, N::one());
self.lu.solve_upper_triangular_mut(b)
}

View File

@ -1,4 +1,4 @@
//! Factorization of real matrices.
//! [Reexported at the root of this crate.] Factorization of real matrices.
mod solve;
mod determinant;