Skip to content

Commit

Permalink
Update Edition
Browse files Browse the repository at this point in the history
  • Loading branch information
Gianmarco Garrisi committed Mar 7, 2025
1 parent 2338edd commit 6422a96
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ readme = "README.md"
keywords = ["priority", "queue", "heap"]
categories = ["data-structures", "algorithms"]
license = "LGPL-3.0-or-later OR MPL-2.0"
edition = "2021"
edition = "2024"

[build-dependencies]
autocfg = "1"
Expand Down
2 changes: 1 addition & 1 deletion benches/priority_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ mod benchmarks {
extern crate test;
use hashbrown::hash_map::DefaultHashBuilder;
use priority_queue::{DoublePriorityQueue, PriorityQueue};
use test::{black_box, Bencher};
use test::{Bencher, black_box};

#[bench]
fn push_and_pop(b: &mut Bencher) {
Expand Down
2 changes: 1 addition & 1 deletion src/double_priority_queue/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ pub mod iterators;
#[cfg(not(feature = "std"))]
use std::vec::Vec;

use crate::TryReserveError;
use crate::core_iterators::*;
use crate::store::{Index, Position, Store};
use crate::TryReserveError;
use iterators::*;

use std::borrow::Borrow;
Expand Down
2 changes: 1 addition & 1 deletion src/priority_queue/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ pub mod iterators;
#[cfg(not(feature = "std"))]
use std::vec::Vec;

use crate::TryReserveError;
use crate::core_iterators::*;
use crate::store::{Index, Position, Store};
use crate::TryReserveError;
use iterators::*;

use std::borrow::Borrow;
Expand Down
16 changes: 9 additions & 7 deletions src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ use std::vec::Vec;

// an improvement in terms of complexity would be to use a bare HashMap
// as vec instead of the IndexMap
use crate::core_iterators::*;
use crate::TryReserveError;
use crate::core_iterators::*;

use std::borrow::Borrow;
use std::cmp::{Eq, Ord};
Expand Down Expand Up @@ -302,12 +302,14 @@ impl<I, P, H> Store<I, P, H> {
}

#[inline(always)]
pub unsafe fn get_priority_from_position(&self, position: Position) -> &P { unsafe {
self.map
.get_index(self.heap.get_unchecked(position.0).0)
.unwrap()
.1
}}
pub unsafe fn get_priority_from_position(&self, position: Position) -> &P {
unsafe {
self.map
.get_index(self.heap.get_unchecked(position.0).0)
.unwrap()
.1
}
}
}

impl<I, P, H> Store<I, P, H>
Expand Down
2 changes: 1 addition & 1 deletion tests/double_priority_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ mod doublepq_tests {
#[cfg(all(feature = "serde", test))]
mod serde_tests_basics {
use priority_queue::DoublePriorityQueue;
use serde_test::{assert_tokens, Token};
use serde_test::{Token, assert_tokens};
#[test]
fn serde_empty() {
let pq: DoublePriorityQueue<String, i32> = DoublePriorityQueue::new();
Expand Down
2 changes: 1 addition & 1 deletion tests/priority_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ mod pqueue_tests {
#[cfg(all(feature = "serde", test))]
mod serde_tests_basics {
use priority_queue::PriorityQueue;
use serde_test::{assert_tokens, Token};
use serde_test::{Token, assert_tokens};
#[test]
fn serde_empty() {
let pq: PriorityQueue<String, i32> = PriorityQueue::new();
Expand Down

0 comments on commit 6422a96

Please sign in to comment.