Skip to content

Commit b57fdf3

Browse files
Use core for a few trait impls rather than std
1 parent 57468a6 commit b57fdf3

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/alphabet.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
//! Provides [Alphabet] and constants for alphabets commonly used in the wild.
22
33
use crate::PAD_BYTE;
4+
use core::{convert, fmt};
45
#[cfg(any(feature = "std", test))]
5-
use std::{convert, error, fmt};
6+
use std::error;
67

78
const ALPHABET_SIZE: usize = 64;
89

@@ -43,9 +44,6 @@ impl Alphabet {
4344
/// Create an `Alphabet` from a string of 64 unique printable ASCII bytes.
4445
///
4546
/// The `=` byte is not allowed as it is used for padding.
46-
///
47-
/// The `const`-ness of this function isn't useful as of rust 1.54.0 since `const` `unwrap()`,
48-
/// etc, haven't shipped yet, but that's [on the roadmap](https://github.com/rust-lang/rust/issues/85194).
4947
pub const fn from_str(alphabet: &str) -> Result<Self, ParseAlphabetError> {
5048
let bytes = alphabet.as_bytes();
5149
if bytes.len() != ALPHABET_SIZE {
@@ -95,7 +93,6 @@ impl Alphabet {
9593
}
9694
}
9795

98-
#[cfg(any(feature = "std", test))]
9996
impl convert::TryFrom<&str> for Alphabet {
10097
type Error = ParseAlphabetError;
10198

@@ -117,7 +114,6 @@ pub enum ParseAlphabetError {
117114
ReservedByte(u8),
118115
}
119116

120-
#[cfg(any(feature = "std", test))]
121117
impl fmt::Display for ParseAlphabetError {
122118
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
123119
match self {

0 commit comments

Comments
 (0)