Some automated fixes suggested by cargo clippy --fix
This commit is contained in:
+11
-11
@@ -91,7 +91,7 @@ impl<'a, T: Debug + Display + Copy + Sized> DenseMatrixView<'a, T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T: Debug + Display + Copy + Sized> fmt::Display for DenseMatrixView<'a, T> {
|
impl<T: Debug + Display + Copy + Sized> fmt::Display for DenseMatrixView<'_, T> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
writeln!(
|
writeln!(
|
||||||
f,
|
f,
|
||||||
@@ -169,7 +169,7 @@ impl<'a, T: Debug + Display + Copy + Sized> DenseMatrixMutView<'a, T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T: Debug + Display + Copy + Sized> fmt::Display for DenseMatrixMutView<'a, T> {
|
impl<T: Debug + Display + Copy + Sized> fmt::Display for DenseMatrixMutView<'_, T> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
writeln!(
|
writeln!(
|
||||||
f,
|
f,
|
||||||
@@ -493,7 +493,7 @@ impl<T: Number + RealNumber> EVDDecomposable<T> for DenseMatrix<T> {}
|
|||||||
impl<T: Number + RealNumber> LUDecomposable<T> for DenseMatrix<T> {}
|
impl<T: Number + RealNumber> LUDecomposable<T> for DenseMatrix<T> {}
|
||||||
impl<T: Number + RealNumber> SVDDecomposable<T> for DenseMatrix<T> {}
|
impl<T: Number + RealNumber> SVDDecomposable<T> for DenseMatrix<T> {}
|
||||||
|
|
||||||
impl<'a, T: Debug + Display + Copy + Sized> Array<T, (usize, usize)> for DenseMatrixView<'a, T> {
|
impl<T: Debug + Display + Copy + Sized> Array<T, (usize, usize)> for DenseMatrixView<'_, T> {
|
||||||
fn get(&self, pos: (usize, usize)) -> &T {
|
fn get(&self, pos: (usize, usize)) -> &T {
|
||||||
if self.column_major {
|
if self.column_major {
|
||||||
&self.values[pos.0 + pos.1 * self.stride]
|
&self.values[pos.0 + pos.1 * self.stride]
|
||||||
@@ -515,7 +515,7 @@ impl<'a, T: Debug + Display + Copy + Sized> Array<T, (usize, usize)> for DenseMa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T: Debug + Display + Copy + Sized> Array<T, usize> for DenseMatrixView<'a, T> {
|
impl<T: Debug + Display + Copy + Sized> Array<T, usize> for DenseMatrixView<'_, T> {
|
||||||
fn get(&self, i: usize) -> &T {
|
fn get(&self, i: usize) -> &T {
|
||||||
if self.nrows == 1 {
|
if self.nrows == 1 {
|
||||||
if self.column_major {
|
if self.column_major {
|
||||||
@@ -553,11 +553,11 @@ impl<'a, T: Debug + Display + Copy + Sized> Array<T, usize> for DenseMatrixView<
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T: Debug + Display + Copy + Sized> ArrayView2<T> for DenseMatrixView<'a, T> {}
|
impl<T: Debug + Display + Copy + Sized> ArrayView2<T> for DenseMatrixView<'_, T> {}
|
||||||
|
|
||||||
impl<'a, T: Debug + Display + Copy + Sized> ArrayView1<T> for DenseMatrixView<'a, T> {}
|
impl<T: Debug + Display + Copy + Sized> ArrayView1<T> for DenseMatrixView<'_, T> {}
|
||||||
|
|
||||||
impl<'a, T: Debug + Display + Copy + Sized> Array<T, (usize, usize)> for DenseMatrixMutView<'a, T> {
|
impl<T: Debug + Display + Copy + Sized> Array<T, (usize, usize)> for DenseMatrixMutView<'_, T> {
|
||||||
fn get(&self, pos: (usize, usize)) -> &T {
|
fn get(&self, pos: (usize, usize)) -> &T {
|
||||||
if self.column_major {
|
if self.column_major {
|
||||||
&self.values[pos.0 + pos.1 * self.stride]
|
&self.values[pos.0 + pos.1 * self.stride]
|
||||||
@@ -579,8 +579,8 @@ impl<'a, T: Debug + Display + Copy + Sized> Array<T, (usize, usize)> for DenseMa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T: Debug + Display + Copy + Sized> MutArray<T, (usize, usize)>
|
impl<T: Debug + Display + Copy + Sized> MutArray<T, (usize, usize)>
|
||||||
for DenseMatrixMutView<'a, T>
|
for DenseMatrixMutView<'_, T>
|
||||||
{
|
{
|
||||||
fn set(&mut self, pos: (usize, usize), x: T) {
|
fn set(&mut self, pos: (usize, usize), x: T) {
|
||||||
if self.column_major {
|
if self.column_major {
|
||||||
@@ -595,9 +595,9 @@ impl<'a, T: Debug + Display + Copy + Sized> MutArray<T, (usize, usize)>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T: Debug + Display + Copy + Sized> MutArrayView2<T> for DenseMatrixMutView<'a, T> {}
|
impl<T: Debug + Display + Copy + Sized> MutArrayView2<T> for DenseMatrixMutView<'_, T> {}
|
||||||
|
|
||||||
impl<'a, T: Debug + Display + Copy + Sized> ArrayView2<T> for DenseMatrixMutView<'a, T> {}
|
impl<T: Debug + Display + Copy + Sized> ArrayView2<T> for DenseMatrixMutView<'_, T> {}
|
||||||
|
|
||||||
impl<T: RealNumber> MatrixStats<T> for DenseMatrix<T> {}
|
impl<T: RealNumber> MatrixStats<T> for DenseMatrix<T> {}
|
||||||
|
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ impl<T: Debug + Display + Copy + Sized> Array1<T> for Vec<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T: Debug + Display + Copy + Sized> Array<T, usize> for VecMutView<'a, T> {
|
impl<T: Debug + Display + Copy + Sized> Array<T, usize> for VecMutView<'_, T> {
|
||||||
fn get(&self, i: usize) -> &T {
|
fn get(&self, i: usize) -> &T {
|
||||||
&self.ptr[i]
|
&self.ptr[i]
|
||||||
}
|
}
|
||||||
@@ -138,7 +138,7 @@ impl<'a, T: Debug + Display + Copy + Sized> Array<T, usize> for VecMutView<'a, T
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T: Debug + Display + Copy + Sized> MutArray<T, usize> for VecMutView<'a, T> {
|
impl<T: Debug + Display + Copy + Sized> MutArray<T, usize> for VecMutView<'_, T> {
|
||||||
fn set(&mut self, i: usize, x: T) {
|
fn set(&mut self, i: usize, x: T) {
|
||||||
self.ptr[i] = x;
|
self.ptr[i] = x;
|
||||||
}
|
}
|
||||||
@@ -149,10 +149,10 @@ impl<'a, T: Debug + Display + Copy + Sized> MutArray<T, usize> for VecMutView<'a
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T: Debug + Display + Copy + Sized> ArrayView1<T> for VecMutView<'a, T> {}
|
impl<T: Debug + Display + Copy + Sized> ArrayView1<T> for VecMutView<'_, T> {}
|
||||||
impl<'a, T: Debug + Display + Copy + Sized> MutArrayView1<T> for VecMutView<'a, T> {}
|
impl<T: Debug + Display + Copy + Sized> MutArrayView1<T> for VecMutView<'_, T> {}
|
||||||
|
|
||||||
impl<'a, T: Debug + Display + Copy + Sized> Array<T, usize> for VecView<'a, T> {
|
impl<T: Debug + Display + Copy + Sized> Array<T, usize> for VecView<'_, T> {
|
||||||
fn get(&self, i: usize) -> &T {
|
fn get(&self, i: usize) -> &T {
|
||||||
&self.ptr[i]
|
&self.ptr[i]
|
||||||
}
|
}
|
||||||
@@ -171,7 +171,7 @@ impl<'a, T: Debug + Display + Copy + Sized> Array<T, usize> for VecView<'a, T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T: Debug + Display + Copy + Sized> ArrayView1<T> for VecView<'a, T> {}
|
impl<T: Debug + Display + Copy + Sized> ArrayView1<T> for VecView<'_, T> {}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ impl<T: Debug + Display + Copy + Sized> ArrayView2<T> for ArrayBase<OwnedRepr<T>
|
|||||||
|
|
||||||
impl<T: Debug + Display + Copy + Sized> MutArrayView2<T> for ArrayBase<OwnedRepr<T>, Ix2> {}
|
impl<T: Debug + Display + Copy + Sized> MutArrayView2<T> for ArrayBase<OwnedRepr<T>, Ix2> {}
|
||||||
|
|
||||||
impl<'a, T: Debug + Display + Copy + Sized> BaseArray<T, (usize, usize)> for ArrayView<'a, T, Ix2> {
|
impl<T: Debug + Display + Copy + Sized> BaseArray<T, (usize, usize)> for ArrayView<'_, T, Ix2> {
|
||||||
fn get(&self, pos: (usize, usize)) -> &T {
|
fn get(&self, pos: (usize, usize)) -> &T {
|
||||||
&self[[pos.0, pos.1]]
|
&self[[pos.0, pos.1]]
|
||||||
}
|
}
|
||||||
@@ -144,10 +144,10 @@ impl<T: Number + RealNumber> EVDDecomposable<T> for ArrayBase<OwnedRepr<T>, Ix2>
|
|||||||
impl<T: Number + RealNumber> LUDecomposable<T> for ArrayBase<OwnedRepr<T>, Ix2> {}
|
impl<T: Number + RealNumber> LUDecomposable<T> for ArrayBase<OwnedRepr<T>, Ix2> {}
|
||||||
impl<T: Number + RealNumber> SVDDecomposable<T> for ArrayBase<OwnedRepr<T>, Ix2> {}
|
impl<T: Number + RealNumber> SVDDecomposable<T> for ArrayBase<OwnedRepr<T>, Ix2> {}
|
||||||
|
|
||||||
impl<'a, T: Debug + Display + Copy + Sized> ArrayView2<T> for ArrayView<'a, T, Ix2> {}
|
impl<T: Debug + Display + Copy + Sized> ArrayView2<T> for ArrayView<'_, T, Ix2> {}
|
||||||
|
|
||||||
impl<'a, T: Debug + Display + Copy + Sized> BaseArray<T, (usize, usize)>
|
impl<T: Debug + Display + Copy + Sized> BaseArray<T, (usize, usize)>
|
||||||
for ArrayViewMut<'a, T, Ix2>
|
for ArrayViewMut<'_, T, Ix2>
|
||||||
{
|
{
|
||||||
fn get(&self, pos: (usize, usize)) -> &T {
|
fn get(&self, pos: (usize, usize)) -> &T {
|
||||||
&self[[pos.0, pos.1]]
|
&self[[pos.0, pos.1]]
|
||||||
@@ -175,8 +175,8 @@ impl<'a, T: Debug + Display + Copy + Sized> BaseArray<T, (usize, usize)>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T: Debug + Display + Copy + Sized> MutArray<T, (usize, usize)>
|
impl<T: Debug + Display + Copy + Sized> MutArray<T, (usize, usize)>
|
||||||
for ArrayViewMut<'a, T, Ix2>
|
for ArrayViewMut<'_, T, Ix2>
|
||||||
{
|
{
|
||||||
fn set(&mut self, pos: (usize, usize), x: T) {
|
fn set(&mut self, pos: (usize, usize), x: T) {
|
||||||
self[[pos.0, pos.1]] = x
|
self[[pos.0, pos.1]] = x
|
||||||
@@ -195,9 +195,9 @@ impl<'a, T: Debug + Display + Copy + Sized> MutArray<T, (usize, usize)>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T: Debug + Display + Copy + Sized> MutArrayView2<T> for ArrayViewMut<'a, T, Ix2> {}
|
impl<T: Debug + Display + Copy + Sized> MutArrayView2<T> for ArrayViewMut<'_, T, Ix2> {}
|
||||||
|
|
||||||
impl<'a, T: Debug + Display + Copy + Sized> ArrayView2<T> for ArrayViewMut<'a, T, Ix2> {}
|
impl<T: Debug + Display + Copy + Sized> ArrayView2<T> for ArrayViewMut<'_, T, Ix2> {}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ impl<T: Debug + Display + Copy + Sized> ArrayView1<T> for ArrayBase<OwnedRepr<T>
|
|||||||
|
|
||||||
impl<T: Debug + Display + Copy + Sized> MutArrayView1<T> for ArrayBase<OwnedRepr<T>, Ix1> {}
|
impl<T: Debug + Display + Copy + Sized> MutArrayView1<T> for ArrayBase<OwnedRepr<T>, Ix1> {}
|
||||||
|
|
||||||
impl<'a, T: Debug + Display + Copy + Sized> BaseArray<T, usize> for ArrayView<'a, T, Ix1> {
|
impl<T: Debug + Display + Copy + Sized> BaseArray<T, usize> for ArrayView<'_, T, Ix1> {
|
||||||
fn get(&self, i: usize) -> &T {
|
fn get(&self, i: usize) -> &T {
|
||||||
&self[i]
|
&self[i]
|
||||||
}
|
}
|
||||||
@@ -60,9 +60,9 @@ impl<'a, T: Debug + Display + Copy + Sized> BaseArray<T, usize> for ArrayView<'a
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T: Debug + Display + Copy + Sized> ArrayView1<T> for ArrayView<'a, T, Ix1> {}
|
impl<T: Debug + Display + Copy + Sized> ArrayView1<T> for ArrayView<'_, T, Ix1> {}
|
||||||
|
|
||||||
impl<'a, T: Debug + Display + Copy + Sized> BaseArray<T, usize> for ArrayViewMut<'a, T, Ix1> {
|
impl<T: Debug + Display + Copy + Sized> BaseArray<T, usize> for ArrayViewMut<'_, T, Ix1> {
|
||||||
fn get(&self, i: usize) -> &T {
|
fn get(&self, i: usize) -> &T {
|
||||||
&self[i]
|
&self[i]
|
||||||
}
|
}
|
||||||
@@ -81,7 +81,7 @@ impl<'a, T: Debug + Display + Copy + Sized> BaseArray<T, usize> for ArrayViewMut
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T: Debug + Display + Copy + Sized> MutArray<T, usize> for ArrayViewMut<'a, T, Ix1> {
|
impl<T: Debug + Display + Copy + Sized> MutArray<T, usize> for ArrayViewMut<'_, T, Ix1> {
|
||||||
fn set(&mut self, i: usize, x: T) {
|
fn set(&mut self, i: usize, x: T) {
|
||||||
self[i] = x;
|
self[i] = x;
|
||||||
}
|
}
|
||||||
@@ -92,8 +92,8 @@ impl<'a, T: Debug + Display + Copy + Sized> MutArray<T, usize> for ArrayViewMut<
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T: Debug + Display + Copy + Sized> ArrayView1<T> for ArrayViewMut<'a, T, Ix1> {}
|
impl<T: Debug + Display + Copy + Sized> ArrayView1<T> for ArrayViewMut<'_, T, Ix1> {}
|
||||||
impl<'a, T: Debug + Display + Copy + Sized> MutArrayView1<T> for ArrayViewMut<'a, T, Ix1> {}
|
impl<T: Debug + Display + Copy + Sized> MutArrayView1<T> for ArrayViewMut<'_, T, Ix1> {}
|
||||||
|
|
||||||
impl<T: Debug + Display + Copy + Sized> Array1<T> for ArrayBase<OwnedRepr<T>, Ix1> {
|
impl<T: Debug + Display + Copy + Sized> Array1<T> for ArrayBase<OwnedRepr<T>, Ix1> {
|
||||||
fn slice<'a>(&'a self, range: Range<usize>) -> Box<dyn ArrayView1<T> + 'a> {
|
fn slice<'a>(&'a self, range: Range<usize>) -> Box<dyn ArrayView1<T> + 'a> {
|
||||||
|
|||||||
@@ -258,8 +258,8 @@ impl<TX: Number + FloatNumber + RealNumber, TY: Number + Ord, X: Array2<TX>, Y:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T: Number + FloatNumber, X: Array2<T>> ObjectiveFunction<T, X>
|
impl<T: Number + FloatNumber, X: Array2<T>> ObjectiveFunction<T, X>
|
||||||
for BinaryObjectiveFunction<'a, T, X>
|
for BinaryObjectiveFunction<'_, T, X>
|
||||||
{
|
{
|
||||||
fn f(&self, w_bias: &[T]) -> T {
|
fn f(&self, w_bias: &[T]) -> T {
|
||||||
let mut f = T::zero();
|
let mut f = T::zero();
|
||||||
@@ -313,8 +313,8 @@ struct MultiClassObjectiveFunction<'a, T: Number + FloatNumber, X: Array2<T>> {
|
|||||||
_phantom_t: PhantomData<T>,
|
_phantom_t: PhantomData<T>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T: Number + FloatNumber + RealNumber, X: Array2<T>> ObjectiveFunction<T, X>
|
impl<T: Number + FloatNumber + RealNumber, X: Array2<T>> ObjectiveFunction<T, X>
|
||||||
for MultiClassObjectiveFunction<'a, T, X>
|
for MultiClassObjectiveFunction<'_, T, X>
|
||||||
{
|
{
|
||||||
fn f(&self, w_bias: &[T]) -> T {
|
fn f(&self, w_bias: &[T]) -> T {
|
||||||
let mut f = T::zero();
|
let mut f = T::zero();
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ mod tests {
|
|||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, PartialEq, Clone)]
|
||||||
struct TestDistribution<'d>(&'d Vec<i32>);
|
struct TestDistribution<'d>(&'d Vec<i32>);
|
||||||
|
|
||||||
impl<'d> NBDistribution<i32, i32> for TestDistribution<'d> {
|
impl NBDistribution<i32, i32> for TestDistribution<'_> {
|
||||||
fn prior(&self, _class_index: usize) -> f64 {
|
fn prior(&self, _class_index: usize) -> f64 {
|
||||||
1.
|
1.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -172,18 +172,12 @@ where
|
|||||||
T: Number + RealNumber,
|
T: Number + RealNumber,
|
||||||
M: Array2<T>,
|
M: Array2<T>,
|
||||||
{
|
{
|
||||||
if let Some(output_matrix) = columns.first().cloned() {
|
columns.first().cloned().map(|output_matrix| columns
|
||||||
return Some(
|
|
||||||
columns
|
|
||||||
.iter()
|
.iter()
|
||||||
.skip(1)
|
.skip(1)
|
||||||
.fold(output_matrix, |current_matrix, new_colum| {
|
.fold(output_matrix, |current_matrix, new_colum| {
|
||||||
current_matrix.h_stack(new_colum)
|
current_matrix.h_stack(new_colum)
|
||||||
}),
|
}))
|
||||||
);
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|||||||
+1
-1
@@ -30,7 +30,7 @@ pub struct CSVDefinition<'a> {
|
|||||||
/// What seperates the fields in your csv-file?
|
/// What seperates the fields in your csv-file?
|
||||||
field_seperator: &'a str,
|
field_seperator: &'a str,
|
||||||
}
|
}
|
||||||
impl<'a> Default for CSVDefinition<'a> {
|
impl Default for CSVDefinition<'_> {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
n_rows_header: 1,
|
n_rows_header: 1,
|
||||||
|
|||||||
+2
-2
@@ -360,8 +360,8 @@ impl<'a, TX: Number + RealNumber, TY: Number + Ord, X: Array2<TX> + 'a, Y: Array
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, TX: Number + RealNumber, TY: Number + Ord, X: Array2<TX>, Y: Array1<TY>> PartialEq
|
impl<TX: Number + RealNumber, TY: Number + Ord, X: Array2<TX>, Y: Array1<TY>> PartialEq
|
||||||
for SVC<'a, TX, TY, X, Y>
|
for SVC<'_, TX, TY, X, Y>
|
||||||
{
|
{
|
||||||
fn eq(&self, other: &Self) -> bool {
|
fn eq(&self, other: &Self) -> bool {
|
||||||
if (self.b.unwrap().sub(other.b.unwrap())).abs() > TX::epsilon() * TX::two()
|
if (self.b.unwrap().sub(other.b.unwrap())).abs() > TX::epsilon() * TX::two()
|
||||||
|
|||||||
+2
-2
@@ -281,8 +281,8 @@ impl<'a, T: Number + FloatNumber + PartialOrd, X: Array2<T>, Y: Array1<T>> SVR<'
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T: Number + FloatNumber + PartialOrd, X: Array2<T>, Y: Array1<T>> PartialEq
|
impl<T: Number + FloatNumber + PartialOrd, X: Array2<T>, Y: Array1<T>> PartialEq
|
||||||
for SVR<'a, T, X, Y>
|
for SVR<'_, T, X, Y>
|
||||||
{
|
{
|
||||||
fn eq(&self, other: &Self) -> bool {
|
fn eq(&self, other: &Self) -> bool {
|
||||||
if (self.b - other.b).abs() > T::epsilon() * T::two()
|
if (self.b - other.b).abs() > T::epsilon() * T::two()
|
||||||
|
|||||||
Reference in New Issue
Block a user