Skip to content

Commit 1989f8c

Browse files
authored
Merge pull request #23 from orxfun/upgrade-clippy
upgrade clippy
2 parents 1adc3de + 2eecea1 commit 1989f8c

File tree

4 files changed

+36
-23
lines changed

4 files changed

+36
-23
lines changed

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "orx-priority-queue"
3-
version = "1.4.0"
3+
version = "1.4.1"
44
edition = "2021"
55
authors = ["orxfun <[email protected]>"]
66
description = "Priority queue traits and high performance d-ary heap implementations."
@@ -15,15 +15,15 @@ std = []
1515
impl_priority_queue = ["priority-queue"]
1616

1717
[dependencies]
18-
priority-queue = { version = "2.0", optional = true }
18+
priority-queue = { version = "2.1", optional = true }
1919

2020

2121
[[bench]]
2222
name = "basic_queue"
2323
harness = false
2424

2525
[dev-dependencies]
26-
itertools = "0.11"
26+
itertools = "0.13"
2727
rand = "0.8"
2828
rand_chacha = "0.3"
2929
criterion = { version = "0.5", features = ["html_reports"] }

src/dary/daryheap_index.rs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ pub type QuaternaryHeapOfIndices<N, K> = DaryHeapOfIndices<N, K, 4>;
2626
/// due to the following:
2727
/// * using a fixed size array could be considered as a fast `HashMap`.
2828
/// * we often reuse such heaps many times to solve many problems on the same network,
29-
/// compensating for the allocation of the positions array once.
29+
/// compensating for the allocation of the positions array once.
3030
/// * further, compared to a basic priority queue (or to `std::collections::BinaryHeap`),
31-
/// it reduces the space complexity of the Dijkstra's
32-
/// algorithm from *O(N^2)* to *O(N)* by enabling the `decrease_key` operation.
31+
/// it reduces the space complexity of the Dijkstra's
32+
/// algorithm from *O(N^2)* to *O(N)* by enabling the `decrease_key` operation.
3333
///
3434
/// However, for situations where
3535
/// * the number of nodes entering the queue is very sparse compared to the size of the set of nodes, or
@@ -227,8 +227,18 @@ where
227227
N: HasIndex,
228228
K: PartialOrd + Clone,
229229
{
230-
type NodeKey<'a> = &'a (N, K) where Self: 'a, N: 'a, K: 'a;
231-
type Iter<'a> = core::slice::Iter<'a, (N, K)> where Self: 'a, N: 'a, K: 'a;
230+
type NodeKey<'a>
231+
= &'a (N, K)
232+
where
233+
Self: 'a,
234+
N: 'a,
235+
K: 'a;
236+
type Iter<'a>
237+
= core::slice::Iter<'a, (N, K)>
238+
where
239+
Self: 'a,
240+
N: 'a,
241+
K: 'a;
232242

233243
#[inline(always)]
234244
fn len(&self) -> usize {

src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,9 @@
322322
clippy::missing_panics_doc,
323323
clippy::todo
324324
)]
325-
#![cfg_attr(not(feature = "std"), no_std)]
325+
326+
#[cfg(any(test, feature = "std"))]
327+
extern crate std;
326328

327329
extern crate alloc;
328330

src/priority_queue_deckey.rs

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,12 @@ where
6464
/// # Panics
6565
/// This method panics:
6666
/// * if the `node` is not in the queue; or
67-
/// * see [`PriorityQueueDecKey::try_decrease_key_or_push`] for a variant which pushes the
68-
/// `(node, new_key)` pair if the `node` is absent, rather than panicking;
69-
/// * if `decreased_key` is strictly larger than key of the `node` in the queue,
70-
/// * see [`PriorityQueueDecKey::try_decrease_key`] for a variant which does nothing
71-
/// if the new key is strictly larger than key of the `node` in the queue, rather than panicking.
67+
/// (see also [`try_decrease_key_or_push`])
68+
/// * if `decreased_key` is strictly larger than key of the `node` in the queue
69+
/// (see also [`try_decrease_key`]).
70+
///
71+
/// [`try_decrease_key_or_push`]: PriorityQueueDecKey::try_decrease_key_or_push
72+
/// [`try_decrease_key`]: PriorityQueueDecKey::try_decrease_key
7273
///
7374
/// # Examples
7475
///
@@ -97,9 +98,9 @@ where
9798
///
9899
/// # Panics
99100
/// This method panics if:
100-
/// * the `node` is not in the queue,
101-
/// * see [`PriorityQueueDecKey::update_key_or_push`] for a variant which pushes the
102-
/// `(node, new_key)` pair if the `node` is absent, rather than panicking.
101+
/// * the `node` is not in the queue (see also [`update_key_or_push`]).
102+
///
103+
/// [`update_key_or_push`]: PriorityQueueDecKey::update_key_or_push
103104
///
104105
/// # Examples
105106
///
@@ -170,7 +171,7 @@ where
170171

171172
/// If the `node` is present in the queue:
172173
/// * decreases key of the `node` to the given `decreased_key`; `decreased_key` is expected to be less than or equal
173-
/// to the prior key;
174+
/// to the prior key;
174175
///
175176
/// otherwise:
176177
/// * pushes the new (node, key) pair to the queue.
@@ -182,11 +183,11 @@ where
182183
///
183184
/// # Panics
184185
/// This method panics
185-
/// * if the `node` is in the queue; however, its current key is strictly less than the provided `key`;
186-
/// * see [`PriorityQueueDecKey::update_key_or_push`] for a variant which increases the key
187-
/// if the new key is strictly larger than key of the `node` in the queue, rather than panicking; or
188-
/// * see [`PriorityQueueDecKey::try_decrease_key_or_push`] for a variant which does nothing
189-
/// if the new key is strictly larger than key of the `node` in the queue, rather than panicking.
186+
/// * if the `node` is in the queue; however, its current key is strictly less than the provided `key`
187+
/// (see also [`update_key_or_push`] and [`try_decrease_key_or_push`]).
188+
///
189+
/// [`update_key_or_push`]: PriorityQueueDecKey::update_key_or_push
190+
/// [`try_decrease_key_or_push`]: PriorityQueueDecKey::try_decrease_key_or_push
190191
///
191192
/// # Examples
192193
///

0 commit comments

Comments
 (0)