Skip to content

Commit e2dbeeb

Browse files
committed
Merge branch 'master' into nonzero
2 parents 057f6b8 + 483200b commit e2dbeeb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+105
-203
lines changed

benches/bench1.rs

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
clippy::many_single_char_names
88
)]
99

10-
extern crate ndarray;
1110
extern crate test;
1211

1312
use ndarray::ShapeBuilder;

benches/chunks.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
extern crate test;
44
use test::Bencher;
55

6-
extern crate ndarray;
76
use ndarray::prelude::*;
87
use ndarray::NdProducer;
98

benches/construct.rs

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
extern crate test;
99
use test::Bencher;
1010

11-
extern crate ndarray;
1211
use ndarray::prelude::*;
1312

1413
#[bench]

benches/gemv.rs

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
extern crate test;
1010
use test::Bencher;
1111

12-
extern crate ndarray;
1312
use ndarray::prelude::*;
1413

1514
use ndarray::linalg::general_mat_vec_mul;

benches/higher-order.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ use std::iter::FromIterator;
1010
use test::black_box;
1111
use test::Bencher;
1212

13-
extern crate ndarray;
1413
use ndarray::prelude::*;
1514

1615
const N: usize = 1024;
@@ -23,7 +22,7 @@ fn map_regular(bench: &mut Bencher) {
2322
bench.iter(|| a.map(|&x| 2. * x));
2423
}
2524

26-
pub fn double_array(mut a: ArrayViewMut2<f64>) {
25+
pub fn double_array(mut a: ArrayViewMut2<'_, f64>) {
2726
a *= 2.0;
2827
}
2928

benches/iter.rs

-2
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@
66
clippy::many_single_char_names
77
)]
88

9-
extern crate rawpointer;
109
extern crate test;
1110
use rawpointer::PointerExt;
1211
use test::black_box;
1312
use test::Bencher;
1413

15-
extern crate ndarray;
1614
use ndarray::prelude::*;
1715
use ndarray::Slice;
1816
use ndarray::{FoldWhile, Zip};

benches/numeric.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
extern crate test;
44
use test::Bencher;
55

6-
extern crate ndarray;
76
use ndarray::prelude::*;
87

98
const N: usize = 1024;

benches/par_rayon.rs

-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
#![cfg(feature = "rayon")]
22
#![feature(test)]
33

4-
extern crate rayon;
5-
6-
extern crate itertools;
7-
extern crate ndarray;
8-
94
use ndarray::parallel::prelude::*;
105
use ndarray::prelude::*;
116

@@ -17,8 +12,6 @@ use ndarray::Zip;
1712
const EXP_N: usize = 256;
1813
const ADDN: usize = 512;
1914

20-
use std::cmp::max;
21-
2215
fn set_threads() {
2316
// Consider setting a fixed number of threads here, for example to avoid
2417
// oversubscribing on hyperthreaded cores.

examples/axis_ops.rs

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
clippy::unreadable_literal,
55
clippy::many_single_char_names
66
)]
7-
extern crate ndarray;
87

98
use ndarray::prelude::*;
109

examples/bounds_check_elim.rs

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99
// Test cases for bounds check elimination
1010

11-
extern crate ndarray;
12-
1311
use ndarray::prelude::*;
1412

1513
/*

examples/column_standardize.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
extern crate ndarray;
2-
31
use ndarray::prelude::*;
42

5-
fn std1d(a: ArrayView1<f64>) -> f64 {
3+
fn std1d(a: ArrayView1<'_, f64>) -> f64 {
64
let n = a.len() as f64;
75
if n == 0. {
86
return 0.;

examples/convo.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const SHARPEN: [[f32; 3]; 3] = [[0., -1., 0.], [-1., 5., -1.], [0., -1., 0.]];
1313
type Kernel3x3<A> = [[A; 3]; 3];
1414

1515
#[inline(never)]
16-
fn conv_3x3<F>(a: &ArrayView2<F>, out: &mut ArrayViewMut2<F>, kernel: &Kernel3x3<F>)
16+
fn conv_3x3<F>(a: &ArrayView2<'_, F>, out: &mut ArrayViewMut2<'_, F>, kernel: &Kernel3x3<F>)
1717
where
1818
F: Float,
1919
{

examples/life.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@
44
clippy::unreadable_literal,
55
clippy::many_single_char_names
66
)]
7-
extern crate ndarray;
87

98
use ndarray::prelude::*;
109
use std::iter::FromIterator;
1110

12-
const INPUT: &'static [u8] = include_bytes!("life.txt");
11+
const INPUT: &[u8] = include_bytes!("life.txt");
1312

1413
const N: usize = 100;
1514

examples/rollaxis.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
extern crate ndarray;
2-
31
use ndarray::prelude::*;
42
use ndarray::Data;
53

examples/sort-axis.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
extern crate ndarray;
2-
31
use ndarray::prelude::*;
42
use ndarray::{Data, RemoveAxis, Zip};
53

examples/zip_many.rs

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
clippy::unreadable_literal,
55
clippy::many_single_char_names
66
)]
7-
extern crate ndarray;
87

98
use ndarray::prelude::*;
109
use ndarray::Zip;

src/array_serde.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ where
9999
}
100100

101101
// private iterator wrapper
102-
struct Sequence<'a, A: 'a, D>(Iter<'a, A, D>);
102+
struct Sequence<'a, A, D>(Iter<'a, A, D>);
103103

104104
impl<'a, A, D> Serialize for Sequence<'a, A, D>
105105
where
@@ -166,7 +166,7 @@ impl<'de> Deserialize<'de> for ArrayField {
166166
impl<'de> Visitor<'de> for ArrayFieldVisitor {
167167
type Value = ArrayField;
168168

169-
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
169+
fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
170170
formatter.write_str(r#""v", "dim", or "data""#)
171171
}
172172

@@ -210,7 +210,7 @@ where
210210
{
211211
type Value = ArrayBase<S, Di>;
212212

213-
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
213+
fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
214214
formatter.write_str("ndarray representation")
215215
}
216216

src/arrayformat.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ const PRINT_ELEMENTS_LIMIT: Ix = 3;
1313

1414
fn format_1d_array<A, S, F>(
1515
view: &ArrayBase<S, Ix1>,
16-
f: &mut fmt::Formatter,
16+
f: &mut fmt::Formatter<'_>,
1717
mut format: F,
1818
limit: Ix,
1919
) -> fmt::Result
2020
where
21-
F: FnMut(&A, &mut fmt::Formatter) -> fmt::Result,
21+
F: FnMut(&A, &mut fmt::Formatter<'_>) -> fmt::Result,
2222
S: Data<Elem = A>,
2323
{
2424
let to_be_printed = to_be_printed(view.len(), limit);
@@ -62,12 +62,12 @@ fn to_be_printed(length: usize, limit: usize) -> Vec<PrintableCell> {
6262

6363
fn format_array<A, S, D, F>(
6464
view: &ArrayBase<S, D>,
65-
f: &mut fmt::Formatter,
65+
f: &mut fmt::Formatter<'_>,
6666
mut format: F,
6767
limit: Ix,
6868
) -> fmt::Result
6969
where
70-
F: FnMut(&A, &mut fmt::Formatter) -> fmt::Result + Clone,
70+
F: FnMut(&A, &mut fmt::Formatter<'_>) -> fmt::Result + Clone,
7171
D: Dimension,
7272
S: Data<Elem = A>,
7373
{
@@ -128,7 +128,7 @@ impl<'a, A: fmt::Display, S, D: Dimension> fmt::Display for ArrayBase<S, D>
128128
where
129129
S: Data<Elem = A>,
130130
{
131-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
131+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
132132
format_array(self, f, <_>::fmt, PRINT_ELEMENTS_LIMIT)
133133
}
134134
}
@@ -141,7 +141,7 @@ impl<'a, A: fmt::Debug, S, D: Dimension> fmt::Debug for ArrayBase<S, D>
141141
where
142142
S: Data<Elem = A>,
143143
{
144-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
144+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
145145
// Add extra information for Debug
146146
format_array(self, f, <_>::fmt, PRINT_ELEMENTS_LIMIT)?;
147147
write!(
@@ -167,7 +167,7 @@ impl<'a, A: fmt::LowerExp, S, D: Dimension> fmt::LowerExp for ArrayBase<S, D>
167167
where
168168
S: Data<Elem = A>,
169169
{
170-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
170+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
171171
format_array(self, f, <_>::fmt, PRINT_ELEMENTS_LIMIT)
172172
}
173173
}
@@ -180,7 +180,7 @@ impl<'a, A: fmt::UpperExp, S, D: Dimension> fmt::UpperExp for ArrayBase<S, D>
180180
where
181181
S: Data<Elem = A>,
182182
{
183-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
183+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
184184
format_array(self, f, <_>::fmt, PRINT_ELEMENTS_LIMIT)
185185
}
186186
}
@@ -192,7 +192,7 @@ impl<'a, A: fmt::LowerHex, S, D: Dimension> fmt::LowerHex for ArrayBase<S, D>
192192
where
193193
S: Data<Elem = A>,
194194
{
195-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
195+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
196196
format_array(self, f, <_>::fmt, PRINT_ELEMENTS_LIMIT)
197197
}
198198
}
@@ -205,7 +205,7 @@ impl<'a, A: fmt::Binary, S, D: Dimension> fmt::Binary for ArrayBase<S, D>
205205
where
206206
S: Data<Elem = A>,
207207
{
208-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
208+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
209209
format_array(self, f, <_>::fmt, PRINT_ELEMENTS_LIMIT)
210210
}
211211
}

src/dimension/axes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ where
3333
/// assert_eq!(largest_axis, Axis(1));
3434
/// ```
3535
#[derive(Debug)]
36-
pub struct Axes<'a, D: 'a> {
36+
pub struct Axes<'a, D> {
3737
dim: &'a D,
3838
strides: &'a D,
3939
start: usize,

src/dimension/dim.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ impl<I> fmt::Debug for Dim<I>
7777
where
7878
I: fmt::Debug,
7979
{
80-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
80+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
8181
write!(f, "{:?}", self.index)
8282
}
8383
}

src/dimension/dimension_trait.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,12 @@ pub trait Dimension:
103103
fn slice_mut(&mut self) -> &mut [Ix];
104104

105105
/// Borrow as a read-only array view.
106-
fn as_array_view(&self) -> ArrayView1<Ix> {
106+
fn as_array_view(&self) -> ArrayView1<'_, Ix> {
107107
ArrayView1::from(self.slice())
108108
}
109109

110110
/// Borrow as a read-write array view.
111-
fn as_array_view_mut(&mut self) -> ArrayViewMut1<Ix> {
111+
fn as_array_view_mut(&mut self) -> ArrayViewMut1<'_, Ix> {
112112
ArrayViewMut1::from(self.slice_mut())
113113
}
114114

src/error.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,13 @@ impl Error for ShapeError {
8585
}
8686

8787
impl fmt::Display for ShapeError {
88-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
88+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
8989
write!(f, "ShapeError/{:?}: {}", self.kind(), self.description())
9090
}
9191
}
9292

9393
impl fmt::Debug for ShapeError {
94-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
94+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
9595
write!(f, "ShapeError/{:?}: {}", self.kind(), self.description())
9696
}
9797
}

src/free_functions.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ pub fn rcarr1<A: Clone>(xs: &[A]) -> ArcArray<A, Ix1> {
6868
}
6969

7070
/// Create a zero-dimensional array view borrowing `x`.
71-
pub fn aview0<A>(x: &A) -> ArrayView0<A> {
71+
pub fn aview0<A>(x: &A) -> ArrayView0<'_, A> {
7272
unsafe { ArrayView::from_shape_ptr(Ix0(), x) }
7373
}
7474

@@ -84,15 +84,15 @@ pub fn aview0<A>(x: &A) -> ArrayView0<A> {
8484
///
8585
/// assert_eq!(a2d.sum(), 1024.0);
8686
/// ```
87-
pub fn aview1<A>(xs: &[A]) -> ArrayView1<A> {
87+
pub fn aview1<A>(xs: &[A]) -> ArrayView1<'_, A> {
8888
ArrayView::from(xs)
8989
}
9090

9191
/// Create a two-dimensional array view with elements borrowing `xs`.
9292
///
9393
/// **Panics** if the product of non-zero axis lengths overflows `isize`. (This
9494
/// can only occur when `V` is zero-sized.)
95-
pub fn aview2<A, V: FixedInitializer<Elem = A>>(xs: &[V]) -> ArrayView2<A> {
95+
pub fn aview2<A, V: FixedInitializer<Elem = A>>(xs: &[V]) -> ArrayView2<'_, A> {
9696
let cols = V::len();
9797
let rows = xs.len();
9898
let dim = Ix2(rows, cols);
@@ -129,7 +129,7 @@ pub fn aview2<A, V: FixedInitializer<Elem = A>>(xs: &[V]) -> ArrayView2<A> {
129129
/// assert_eq!(&data[..10], [5, 0, 0, 5, 0, 0, 5, 0, 0, 5]);
130130
/// }
131131
/// ```
132-
pub fn aview_mut1<A>(xs: &mut [A]) -> ArrayViewMut1<A> {
132+
pub fn aview_mut1<A>(xs: &mut [A]) -> ArrayViewMut1<'_, A> {
133133
ArrayViewMut::from(xs)
134134
}
135135

@@ -158,7 +158,7 @@ pub fn aview_mut1<A>(xs: &mut [A]) -> ArrayViewMut1<A> {
158158
/// assert_eq!(&data[..3], [[1., -1.], [1., -1.], [1., -1.]]);
159159
/// }
160160
/// ```
161-
pub fn aview_mut2<A, V: FixedInitializer<Elem = A>>(xs: &mut [V]) -> ArrayViewMut2<A> {
161+
pub fn aview_mut2<A, V: FixedInitializer<Elem = A>>(xs: &mut [V]) -> ArrayViewMut2<'_, A> {
162162
let cols = V::len();
163163
let rows = xs.len();
164164
let dim = Ix2(rows, cols);

0 commit comments

Comments
 (0)