Skip to content

Commit 61acbd3

Browse files
authored
Merge pull request #924 from jturner314/warnings-as-errors
Treat warnings as errors in CI
2 parents cef3901 + 87a6448 commit 61acbd3

File tree

18 files changed

+38
-39
lines changed

18 files changed

+38
-39
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ env:
1010
CARGO_TERM_COLOR: always
1111
HOST: x86_64-unknown-linux-gnu
1212
FEATURES: "test docs"
13+
RUSTFLAGS: "-D warnings"
1314

1415
jobs:
1516
tests:

benches/higher-order.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
clippy::many_single_char_names
77
)]
88
extern crate test;
9-
use std::iter::FromIterator;
109
use test::black_box;
1110
use test::Bencher;
1211

blas-tests/tests/oper.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use ndarray::linalg::general_mat_vec_mul;
88
use ndarray::prelude::*;
99
use ndarray::{Data, LinalgScalar};
1010
use ndarray::{Ix, Ixs, SliceInfo, SliceOrIndex};
11-
use std::iter::FromIterator;
1211

1312
use approx::{assert_abs_diff_eq, assert_relative_eq};
1413
use defmac::defmac;

examples/life.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
)]
77

88
use ndarray::prelude::*;
9-
use std::iter::FromIterator;
109

1110
const INPUT: &[u8] = include_bytes!("life.txt");
1211

src/data_traits.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ pub unsafe trait RawDataClone: RawData {
9494
pub unsafe trait Data: RawData {
9595
/// Converts the array to a uniquely owned array, cloning elements if necessary.
9696
#[doc(hidden)]
97+
#[allow(clippy::wrong_self_convention)]
9798
fn into_owned<D>(self_: ArrayBase<Self, D>) -> ArrayBase<OwnedRepr<Self::Elem>, D>
9899
where
99100
Self::Elem: Clone,
@@ -102,6 +103,7 @@ pub unsafe trait Data: RawData {
102103
/// Return a shared ownership (copy on write) array based on the existing one,
103104
/// cloning elements if necessary.
104105
#[doc(hidden)]
106+
#[allow(clippy::wrong_self_convention)]
105107
fn to_shared<D>(self_: &ArrayBase<Self, D>) -> ArrayBase<OwnedArcRepr<Self::Elem>, D>
106108
where
107109
Self::Elem: Clone,

src/dimension/dynindeximpl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ impl<T: Copy + Zero> IxDynRepr<T> {
5151
pub fn copy_from(x: &[T]) -> Self {
5252
if x.len() <= CAP {
5353
let mut arr = [T::zero(); CAP];
54-
arr[..x.len()].copy_from_slice(&x[..]);
54+
arr[..x.len()].copy_from_slice(x);
5555
IxDynRepr::Inline(x.len() as _, arr)
5656
} else {
5757
Self::from(x)

src/impl_constructors.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ where
7373
///
7474
/// let array = Array::from_iter(0..10);
7575
/// ```
76+
#[allow(clippy::should_implement_trait)]
7677
pub fn from_iter<I: IntoIterator<Item = A>>(iterable: I) -> Self {
7778
Self::from_vec(iterable.into_iter().collect())
7879
}

src/impl_internal_constructors.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ where
2525
/// See ArrayView::from_shape_ptr for general pointer validity documentation.
2626
pub(crate) unsafe fn from_data_ptr(data: S, ptr: NonNull<A>) -> Self {
2727
let array = ArrayBase {
28-
data: data,
29-
ptr: ptr,
28+
data,
29+
ptr,
3030
dim: Ix1(0),
3131
strides: Ix1(1),
3232
};

src/linalg/impl_linalg.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,7 @@ pub fn general_mat_vec_mul<A, S1, S2, S3>(
613613
///
614614
/// The caller must ensure that the raw view is valid for writing.
615615
/// the destination may be uninitialized iff beta is zero.
616+
#[allow(clippy::collapsible_else_if)]
616617
unsafe fn general_mat_vec_mul_impl<A, S1, S2>(
617618
alpha: A,
618619
a: &ArrayBase<S1, Ix2>,

tests/array.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ use ndarray::indices;
1313
use ndarray::prelude::*;
1414
use ndarray::{arr3, rcarr2};
1515
use ndarray::{Slice, SliceInfo, SliceOrIndex};
16-
use std::iter::FromIterator;
1716

1817
macro_rules! assert_panics {
1918
($body:expr) => {
@@ -1803,7 +1802,7 @@ fn test_contiguous() {
18031802
#[test]
18041803
fn test_contiguous_neg_strides() {
18051804
let s = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13];
1806-
let mut a = ArrayView::from_shape((2, 3, 2).strides((1, 4, 2)), &s).unwrap();
1805+
let a = ArrayView::from_shape((2, 3, 2).strides((1, 4, 2)), &s).unwrap();
18071806
assert_eq!(
18081807
a,
18091808
arr3(&[[[0, 2], [4, 6], [8, 10]], [[1, 3], [5, 7], [9, 11]]])

0 commit comments

Comments
 (0)