Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove std #85

Merged
merged 3 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/hybrid-array.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
strategy:
matrix:
rust:
- 1.65.0 # MSRV
- 1.81.0 # MSRV
- stable
target:
- armv7a-none-eabi
Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.75.0
toolchain: 1.81.0
components: clippy
- run: cargo clippy --all --all-features -- -D warnings

Expand Down Expand Up @@ -95,7 +95,7 @@ jobs:
strategy:
matrix:
toolchain:
- 1.65.0 # MSRV
- 1.81.0 # MSRV
- stable
runs-on: ubuntu-latest
steps:
Expand Down
3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@ categories = ["no-std", "data-structures"]
keywords = ["generic-array"]
readme = "README.md"
edition = "2021"
rust-version = "1.65"
rust-version = "1.81.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to use just 1.81 here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately the documentation on rust-version only mentions that two or three components is allowed. Not if they are handled differently.

Can you explain why the two components version is better? (if needed I can create a MR to change it)

Copy link
Member

@newpavlov newpavlov Sep 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's the same logic as with skipping zero minor/patch versions in dependencies (e.g. we use zeroize = "1.8", not zeroize = "1.8.0"). The notations mean the same thing, but 1.81 is shorter and easier to read. I think it can be updated in a pre-release PR.


[dependencies]
typenum = { version = "1.17", features = ["const-generics"] }
zeroize = { version = "1.8", optional = true, default-features = false }

[features]
std = []
extra-sizes = []

[package.metadata.docs.rs]
Expand Down
3 changes: 1 addition & 2 deletions src/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ impl fmt::Display for TryFromIteratorError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for TryFromIteratorError {}
impl core::error::Error for TryFromIteratorError {}

impl<T, U> Array<T, U>
where
Expand Down
7 changes: 2 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,6 @@
//! If you have any questions, please
//! [start a discussion](https://github.com/RustCrypto/hybrid-array/discussions).

#[cfg(feature = "std")]
extern crate std;

pub mod sizes;

mod from_fn;
Expand Down Expand Up @@ -207,7 +204,7 @@ where
U: Add<N>,
Sum<U, N>: ArraySize,
{
self.into_iter().chain(other.into_iter()).collect()
self.into_iter().chain(other).collect()
}

/// Splits `self` at index `N` in two arrays.
Expand Down Expand Up @@ -766,7 +763,7 @@ where

#[inline]
fn try_from(slice: &'a [T]) -> Result<Array<T, U>, TryFromSliceError> {
<&'a Self>::try_from(slice).map(Clone::clone)
<&'a Self>::try_from(slice).cloned()
}
}

Expand Down