Skip to content

Commit

Permalink
Remove std feature; leverage core::error::Error (#680)
Browse files Browse the repository at this point in the history
Now that the MSRV is 1.81, use `core::error::Error` instead of
`std::error::Error`.

Since this was our only dependency on `std`, we can also remove the
entire `std` feature.
  • Loading branch information
tarcieri authored Sep 19, 2024
1 parent 725f936 commit 1c94607
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 9 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ rand_chacha = "0.3"
[features]
default = ["rand"]
alloc = ["serdect?/alloc"]
std = ["alloc"]

extra-sizes = []
rand = ["rand_core/std"]
Expand Down
3 changes: 0 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,6 @@
#[macro_use]
extern crate alloc;

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

#[macro_use]
mod macros;

Expand Down
1 change: 0 additions & 1 deletion src/modular/boxed_monty_form.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ impl BoxedMontyForm {
}

/// Instantiates a new [`BoxedMontyForm`] that represents an integer modulo the provided params.
#[cfg(feature = "std")]
pub fn new_with_arc(mut integer: BoxedUint, params: Arc<BoxedMontyParams>) -> Self {
debug_assert_eq!(integer.bits_precision(), params.bits_precision());
convert_to_montgomery(&mut integer, &params);
Expand Down
7 changes: 3 additions & 4 deletions src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,8 @@ impl fmt::Display for RandomBitsError {
}
}

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

/// Random bits generation support.
#[cfg(feature = "rand_core")]
Expand Down Expand Up @@ -572,8 +572,7 @@ impl fmt::Display for DecodeError {
}
}

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

/// Support for optimized squaring
pub trait Square {
Expand Down

0 comments on commit 1c94607

Please sign in to comment.