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)] #![feature(test)]
#![allow(unused_macros)]
extern crate test; extern crate test;
extern crate rand; 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() { match Self::dimension() {
1 => { 1 => {
if vs.len() == 0 { if vs.len() == 0 {
f(&Self::canonical_basis_element(0)); let _ = f(&Self::canonical_basis_element(0));
} }
}, },
2 => { 2 => {
@ -227,7 +227,7 @@ impl<N: Real, R: DimName, C: DimName> FiniteDimInnerSpace for MatrixMN<N, R, C>
let v = &vs[0]; let v = &vs[0];
let res = Self::from_column_slice(&[-v[1], v[0]]); let res = Self::from_column_slice(&[-v[1], v[0]]);
f(&res.normalize()); let _ = f(&res.normalize());
} }
// Otherwise, nothing. // Otherwise, nothing.
@ -252,11 +252,11 @@ impl<N: Real, R: DimName, C: DimName> FiniteDimInnerSpace for MatrixMN<N, R, C>
let _ = a.normalize_mut(); let _ = a.normalize_mut();
if f(&a.cross(v)) { if f(&a.cross(v)) {
f(&a); let _ = f(&a);
} }
} }
else if vs.len() == 2 { 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() { if self.data.is_contiguous() && rhs.data.is_contiguous() && out.data.is_contiguous() {
let arr1 = self.data.as_slice(); let arr1 = self.data.as_slice();
let arr2 = rhs.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() { for i in 0 .. arr1.len() {
unsafe { unsafe {
*out.get_unchecked_mut(i) = arr1.get_unchecked(i).$method(*arr2.get_unchecked(i)); *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. // This is the most common case and should be deduced at compile-time.
// FIXME: use specialization instead? // FIXME: use specialization instead?
if self.data.is_contiguous() && rhs.data.is_contiguous() { 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(); let arr2 = rhs.data.as_slice();
for i in 0 .. arr2.len() { for i in 0 .. arr2.len() {
unsafe { unsafe {
@ -206,7 +206,7 @@ macro_rules! componentwise_binop_impl(
// FIXME: use specialization instead? // FIXME: use specialization instead?
if self.data.is_contiguous() && rhs.data.is_contiguous() { if self.data.is_contiguous() && rhs.data.is_contiguous() {
let arr1 = self.data.as_slice(); 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() { for i in 0 .. arr1.len() {
unsafe { unsafe {
let res = arr1.get_unchecked(i).$method(*arr2.get_unchecked(i)); 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 j in 0 .. self.ncols() {
for i in 0 .. self.nrows() { for i in 0 .. self.nrows() {
unsafe { 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) *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>) pub fn solve_mut<R2: Dim, C2: Dim, S2>(&self, b: &mut Matrix<N, R2, C2, S2>)
where S2: StorageMut<N, R2, C2>, where S2: StorageMut<N, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D> { ShapeConstraint: SameNumberOfRows<R2, D> {
self.chol.solve_lower_triangular_mut(b); let _ = self.chol.solve_lower_triangular_mut(b);
self.chol.tr_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 /// 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() { if self.is_invertible() {
self.p.permute_rows(b); 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); let _ = self.lu.solve_upper_triangular_mut(b);
self.q.inv_permute_rows(b); self.q.inv_permute_rows(b);
true 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) 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."); assert!(self.lu.is_square(), "LU solve: unable to solve a non-square system.");
self.p.permute_rows(b); 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) 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 solve;
mod determinant; mod determinant;