Remove core feature

This commit is contained in:
Steven Roose 2021-03-24 19:02:11 +00:00
parent 5fe9d2b094
commit 0313e97134
No known key found for this signature in database
GPG Key ID: 2F2A88D7F8D68E87
4 changed files with 3 additions and 13 deletions

View File

@ -19,10 +19,8 @@ before_install:
script: script:
- cargo build --verbose - cargo build --verbose
- cargo test --verbose - cargo test --verbose
- cargo build --verbose --no-default-features - cargo build --verbose --no-default-features --features all-languages
- cargo test --verbose --no-default-features - cargo test --verbose --no-default-features --features all-languages
- cargo build --verbose --no-default-features --features core,all-languages
- cargo test --verbose --no-default-features --features core,all-languages
- cargo build --verbose --features rand,all-languages - cargo build --verbose --features rand,all-languages
- cargo test --verbose --features rand,all-languages - cargo test --verbose --features rand,all-languages
# benchmarks # benchmarks

View File

@ -16,8 +16,7 @@ path = "src/lib.rs"
[features] [features]
default = [ "std" ] default = [ "std" ]
core = [] std = [ "unicode-normalization", "serde/std" ]
std = [ "core", "unicode-normalization", "serde/std" ]
# Note: English is the standard for bip39 so always included # Note: English is the standard for bip39 so always included
chinese-simplified = [] chinese-simplified = []

View File

@ -1,5 +1,4 @@
#[cfg(feature = "core")]
use core::fmt; use core::fmt;
mod english; mod english;
@ -153,7 +152,6 @@ impl Language {
} }
} }
#[cfg(feature = "core")]
impl fmt::Display for Language { impl fmt::Display for Language {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::Debug::fmt(self, f) fmt::Debug::fmt(self, f)

View File

@ -42,7 +42,6 @@ extern crate rand;
#[cfg(feature = "serde")] #[cfg(feature = "serde")]
pub extern crate serde; pub extern crate serde;
#[cfg(feature = "core")]
use core::{fmt, str}; use core::{fmt, str};
#[cfg(feature = "std")] #[cfg(feature = "std")]
@ -82,7 +81,6 @@ impl AmbiguousLanguages {
} }
/// An iterator over the possible languages. /// An iterator over the possible languages.
#[cfg(feature = "core")]
pub fn iter(&self) -> impl Iterator<Item = Language> + '_ { pub fn iter(&self) -> impl Iterator<Item = Language> + '_ {
Language::all().iter().enumerate().filter(move |(i, _)| self.0[*i]).map(|(_, l)| *l) Language::all().iter().enumerate().filter(move |(i, _)| self.0[*i]).map(|(_, l)| *l)
} }
@ -113,7 +111,6 @@ pub enum Error {
AmbiguousLanguages(AmbiguousLanguages), AmbiguousLanguages(AmbiguousLanguages),
} }
#[cfg(feature = "core")]
impl fmt::Display for Error { impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self { match *self {
@ -469,7 +466,6 @@ impl Mnemonic {
} }
} }
#[cfg(feature = "core")]
impl fmt::Display for Mnemonic { impl fmt::Display for Mnemonic {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
for i in 0..self.0.len() { for i in 0..self.0.len() {
@ -486,7 +482,6 @@ impl fmt::Display for Mnemonic {
} }
} }
#[cfg(feature = "core")]
impl str::FromStr for Mnemonic { impl str::FromStr for Mnemonic {
type Err = Error; type Err = Error;