Skip to content

Commit dd04985

Browse files
committed
Edition 2024.
1 parent c0ee603 commit dd04985

File tree

11 files changed

+31
-28
lines changed

11 files changed

+31
-28
lines changed

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[package]
22
name = "ndarray-slice"
3-
version = "0.4.0"
4-
rust-version = "1.65.0"
5-
edition = "2021"
3+
version = "0.5.0"
4+
rust-version = "1.85.0"
5+
edition = "2024"
66
authors = ["Rouven Spreckels <rs@qu1x.dev>"]
77
description = """Fast and robust slice-based algorithms (e.g., sorting, selection, search)
88
for non-contiguous (sub)views into n-dimensional arrays."""
@@ -37,13 +37,13 @@ rustdoc-args = ["--cfg", "docsrs"]
3737

3838
[dependencies]
3939
ndarray = { version = "0.16.1", default-features = false }
40-
stacker = { version = "0.1.17", optional = true }
40+
stacker = { version = "0.1.19", optional = true }
4141
rayon = { version = "1.10.0", optional = true }
4242

4343
[dev-dependencies]
4444
quickcheck = "1.0.3"
4545
quickcheck_macros = "1.0.0"
46-
rand = "0.8.5"
46+
rand = "0.9.0"
4747

4848
[features]
4949
default = ["std", "stacker"]

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
[Documentation]: https://docs.rs/ndarray-slice/badge.svg
1212
[Downloads]: https://img.shields.io/crates/d/ndarray-slice.svg
1313
[Version]: https://img.shields.io/crates/v/ndarray-slice.svg
14-
[Rust]: https://img.shields.io/badge/rust-v1.65.0-brightgreen.svg
14+
[Rust]: https://img.shields.io/badge/rust-v1.85.0-brightgreen.svg
1515
[License]: https://img.shields.io/badge/License-MIT%20OR%20Apache--2.0-blue.svg
1616

1717
Fast and robust slice-based algorithms (e.g., [sorting], [selection], [search]) for
@@ -95,7 +95,7 @@ See the [release history](RELEASES.md) to keep track of the development.
9595

9696
# License
9797

98-
Copyright © 2023 Rouven Spreckels <rs@qu1x.dev>
98+
Copyright © 2023-2025 Rouven Spreckels <rs@qu1x.dev>
9999

100100
This project contains derivative works of [`rust`] and [`rayon`]. For full authorship information,
101101
see their version control histories. Respective copyrights are retained by their contributors.

src/heap_sort.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//!
33
//! [`core::slice::sort`]: https://doc.rust-lang.org/src/core/slice/sort.rs.html
44
5-
use ndarray::{s, ArrayViewMut1};
5+
use ndarray::{ArrayViewMut1, s};
66

77
/// Sorts `v` using heapsort, which guarantees *O*(*n* \* log(*n*)) worst-case.
88
#[cold]

src/insertion_sort.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! [`core::slice::sort`]: https://doc.rust-lang.org/src/core/slice/sort.rs.html
44
55
use core::{marker::PhantomData, mem, ptr};
6-
use ndarray::{s, ArrayViewMut1, IndexLonger};
6+
use ndarray::{ArrayViewMut1, IndexLonger, s};
77

88
// When dropped, copies from `src` into `dest`.
99
#[must_use]

src/merge_sort.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use crate::insertion_sort::insertion_sort_shift_left;
88
use crate::partition::reverse;
99
use core::{cmp, mem, ptr};
10-
use ndarray::{s, ArrayView1, ArrayViewMut1, IndexLonger};
10+
use ndarray::{ArrayView1, ArrayViewMut1, IndexLonger, s};
1111

1212
/// Merges non-decreasing runs `v[..mid]` and `v[mid..]` using `buf` as temporary storage, and
1313
/// stores the result into `v[..]`.
@@ -178,7 +178,7 @@ where
178178
// }
179179
//}
180180

181-
impl<'a, T> Drop for MergeHole<'a, T> {
181+
impl<T> Drop for MergeHole<'_, T> {
182182
fn drop(&mut self) {
183183
// SAFETY: `T` is not a zero-sized type, and these are pointers into a slice's elements.
184184
unsafe {

src/par/heap_sort.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//!
33
//! [`core::slice::sort`]: https://doc.rust-lang.org/src/core/slice/sort.rs.html
44
5-
use ndarray::{s, ArrayViewMut1};
5+
use ndarray::{ArrayViewMut1, s};
66

77
/// Sorts `v` using heapsort, which guarantees *O*(*n* \* log(*n*)) worst-case.
88
#[cold]

src/par/insertion_sort.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
use crate::insertion_sort::InsertionHole;
66
use core::{mem, ptr};
7-
use ndarray::{s, ArrayViewMut1, IndexLonger};
7+
use ndarray::{ArrayViewMut1, IndexLonger, s};
88

99
/// Inserts `v[v.len() - 1]` into pre-sorted sequence `v[..v.len() - 1]` so that whole `v[..]`
1010
/// becomes sorted.

src/par/merge_sort.rs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use core::{
77
mem::{self, size_of},
88
ptr,
99
};
10-
use ndarray::{s, ArrayView1, ArrayViewMut1, Axis, IndexLonger};
10+
use ndarray::{ArrayView1, ArrayViewMut1, Axis, IndexLonger, s};
1111
use rayon::iter::{ParallelBridge, ParallelIterator};
1212

1313
/// We need to transmit raw pointers across threads. It is possible to do this
@@ -920,25 +920,28 @@ where
920920
mod test {
921921
use super::{par_merge_sort, split_for_merge};
922922
use core::cmp::Ordering;
923-
use ndarray::{s, Array1, ArrayView1};
923+
use ndarray::{Array1, ArrayView1, s};
924924
use quickcheck_macros::quickcheck;
925925
use rand::distributions::Uniform;
926-
use rand::{thread_rng, Rng};
926+
use rand::{Rng, thread_rng};
927927

928928
#[test]
929929
fn split() {
930930
fn check(left: &[u32], right: &[u32]) {
931931
let left = ArrayView1::from_shape(left.len(), left).unwrap();
932932
let right = ArrayView1::from_shape(right.len(), right).unwrap();
933933
let (l, r) = split_for_merge(left, right, &|&a, &b| a < b);
934-
assert!(left
935-
.slice(s![..l])
936-
.iter()
937-
.all(|&x| right.slice(s![r..]).iter().all(|&y| x <= y)));
938-
assert!(right
939-
.slice(s![..r])
940-
.iter()
941-
.all(|&x| left.slice(s![l..]).iter().all(|&y| x < y)));
934+
assert!(
935+
left.slice(s![..l])
936+
.iter()
937+
.all(|&x| right.slice(s![r..]).iter().all(|&y| x <= y))
938+
);
939+
assert!(
940+
right
941+
.slice(s![..r])
942+
.iter()
943+
.all(|&x| left.slice(s![l..]).iter().all(|&y| x < y))
944+
);
942945
}
943946

944947
check(&[1, 2, 2, 2, 2, 3], &[1, 2, 2, 2, 2, 3]);

src/par/partition.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use core::{
1616
mem::{self, ManuallyDrop, MaybeUninit},
1717
ptr,
1818
};
19-
use ndarray::{s, ArrayView1, ArrayViewMut1, Axis, IndexLonger};
19+
use ndarray::{ArrayView1, ArrayViewMut1, Axis, IndexLonger, s};
2020

2121
// For slices of up to this length it's probably faster to simply sort them.
2222
// Defined at the module scope because it's used in multiple functions.

src/partition.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use core::{
1111
mem::{self, ManuallyDrop, MaybeUninit},
1212
ptr,
1313
};
14-
use ndarray::{s, ArrayView1, ArrayViewMut1, Axis, IndexLonger};
14+
use ndarray::{ArrayView1, ArrayViewMut1, Axis, IndexLonger, s};
1515

1616
// For slices of up to this length it's probably faster to simply sort them.
1717
// Defined at the module scope because it's used in multiple functions.
@@ -934,7 +934,7 @@ impl<T> Drop for InsertionHole<T> {
934934
mod test {
935935
use super::{partition_at_index, partition_at_indices, reverse};
936936
use crate::{partition_dedup::partition_dedup, quick_sort::quick_sort};
937-
use ndarray::{arr1, Array1};
937+
use ndarray::{Array1, arr1};
938938
use quickcheck::TestResult;
939939
use quickcheck_macros::quickcheck;
940940

0 commit comments

Comments
 (0)