Skip to content

Commit

Permalink
Migrate to Rust 2021 Edition
Browse files Browse the repository at this point in the history
- Change edition to 2021
- Increase MSRV to 1.56.0
- Remove `build.rs`, build-dependency on `autocfg`, and conditional
  compilation of methods requiring at least 1.56.0
- Update the CI matrix
  • Loading branch information
clint-white committed Sep 20, 2022
1 parent bbf5534 commit 52a20d8
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 36 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,14 @@ jobs:
- macos-latest
rust:
- stable
- 1.52.0 # MSRV
- 1.56.0 # MSRV
cargo_args:
- ""
- --features serde
include:
# Also test on nightly and Rust versions between MSRV and stable
# where there is conditional compilation
- os: ubuntu-latest
rust: nightly
cargo_args: ""
- os: ubuntu-latest
rust: 1.56.0
cargo_args: ""

runs-on: ${{ matrix.os }}

Expand Down
9 changes: 5 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

* `#[must_use]` attribute to many methods, porting and extending several
rust-lang/rust PRs
* Method `shrink_to()` for Rust 1.56.0 and greater, ported from rust-lang/rust
* Implementation of `From<[T; N]>` for `BinaryHeap<T>` for Rust 1.56.0 or
greater, ported from rust-lang/rust#84111
* Method `shrink_to()`, ported from rust-lang/rust
* Implementation of `From<[T; N]>` for `BinaryHeap<T>`, ported from
rust-lang/rust#84111
* Links to referenced items in the documenation
* Example of a min-heap, ported from rust-lang/rust#60451
* Documentation of time complexities of several methods, ported from
rust-lang/rust#60952

### Changed

* Bump MSRV (minimum supported rust version) to rust 1.52.0.
* Migrate to Rust 2021 Edition
* Increase MSRV (minimum supported rust version) to rust 1.56.0.
* Implement `From<BinaryHeap<T, C>>` for `Vec<T>` instead of `Into<Vec<T>>` for
`BinaryHeap<T, C>`
* Port rust-lang/rust#77435 improvement to rebuild heuristic of
Expand Down
6 changes: 2 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ repository = "https://github.com/sekineh/binary-heap-plus-rs"
readme = "README.md"
keywords = ["binary", "heap", "priority", "queue"]
categories = ["data-structures", "algorithms", ]
edition = "2018"

[build-dependencies]
autocfg = "1"
edition = "2021"
rust-version = "1.56.0"

[dependencies]
compare = "0.1.0"
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ This crate is based on the standard library's implementation of
[`BinaryHeap`](https://doc.rust-lang.org/stable/std/collections/struct.BinaryHeap.html)
from Rust 1.62.0.

This crate requires Rust 1.52.0 or later. A few of its APIs are only available
for more recent versions of Rust where they have been stabilized in the
standard library; see the documentation for specifics.
The minimum supported Rust version is 1.56.0.

# Changes

Expand Down
8 changes: 0 additions & 8 deletions build.rs

This file was deleted.

11 changes: 0 additions & 11 deletions src/binary_heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
//!
//! ```
//! use std::cmp::Ordering;
//! // Only required for Rust versions prior to 1.43.0.
//! use std::usize;
//! use binary_heap_plus::BinaryHeap;
//!
//! #[derive(Copy, Clone, Eq, PartialEq)]
Expand Down Expand Up @@ -1258,12 +1256,7 @@ impl<T, C> BinaryHeap<T, C> {
/// heap.shrink_to(10);
/// assert!(heap.capacity() >= 10);
/// ```
///
/// # Compatibility
///
/// This feature requires Rust 1.56.0 or greater.
#[inline]
#[cfg(rustc_1_56)]
pub fn shrink_to(&mut self, min_capacity: usize) {
self.data.shrink_to(min_capacity)
}
Expand Down Expand Up @@ -1655,10 +1648,6 @@ impl<T: Ord> From<Vec<T>> for BinaryHeap<T> {
}
}

/// # Compatibility
///
/// This trait is only implemented for Rust 1.56.0 or greater.
#[cfg(rustc_1_56)]
impl<T: Ord, const N: usize> From<[T; N]> for BinaryHeap<T> {
/// ```
/// use binary_heap_plus::BinaryHeap;
Expand Down

0 comments on commit 52a20d8

Please sign in to comment.