Skip to content

Commit

Permalink
Simplify no_std logic a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
sfackler committed Sep 30, 2015
1 parent 44006f7 commit 70f2ed9
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 30 deletions.
11 changes: 3 additions & 8 deletions phf/src/lib.rs
Expand Up @@ -8,17 +8,12 @@
#![cfg_attr(feature = "core", feature(no_std))]
#![cfg_attr(feature = "core", no_std)]

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

extern crate debug_builders;
extern crate phf_shared;

#[cfg(feature = "core")]
mod std {
pub use core::{borrow, fmt, iter, option, ops, slice};
pub mod prelude {
pub use core::prelude as v1;
}
}

pub use phf_shared::PhfHash;
#[doc(inline)]
pub use map::Map;
Expand Down
10 changes: 5 additions & 5 deletions phf/src/map.rs
@@ -1,10 +1,10 @@
//! An immutable map constructed at compile time.
use debug_builders::DebugMap;
use std::borrow::Borrow;
use std::ops::Index;
use std::slice;
use std::fmt;
use std::iter::IntoIterator;
use core::borrow::Borrow;
use core::ops::Index;
use core::slice;
use core::fmt;
use core::iter::IntoIterator;
use PhfHash;
use phf_shared;

Expand Down
10 changes: 5 additions & 5 deletions phf/src/ordered_map.rs
@@ -1,10 +1,10 @@
//! An order-preserving immutable map constructed at compile time.
use debug_builders::DebugMap;
use std::borrow::Borrow;
use std::iter::IntoIterator;
use std::ops::Index;
use std::fmt;
use std::slice;
use core::borrow::Borrow;
use core::iter::IntoIterator;
use core::ops::Index;
use core::fmt;
use core::slice;

use PhfHash;
use phf_shared;
Expand Down
6 changes: 3 additions & 3 deletions phf/src/ordered_set.rs
@@ -1,8 +1,8 @@
//! An order-preserving immutable set constructed at compile time.
use debug_builders::DebugSet;
use std::borrow::Borrow;
use std::iter::IntoIterator;
use std::fmt;
use core::borrow::Borrow;
use core::iter::IntoIterator;
use core::fmt;
use ordered_map;
use {PhfHash, OrderedMap};

Expand Down
6 changes: 3 additions & 3 deletions phf/src/set.rs
@@ -1,8 +1,8 @@
//! An immutable set constructed at compile time.
use debug_builders::DebugSet;
use std::borrow::Borrow;
use std::iter::IntoIterator;
use std::fmt;
use core::borrow::Borrow;
use core::iter::IntoIterator;
use core::fmt;

use PhfHash;
use map;
Expand Down
9 changes: 3 additions & 6 deletions phf_shared/src/lib.rs
@@ -1,13 +1,10 @@
#![doc(html_root_url="http://sfackler.github.io/rust-phf/doc/v0.7.5")]
#![cfg_attr(feature = "core", feature(no_std, core_slice_ext, core_str_ext))]
#![cfg_attr(feature = "core", no_std)]
#[cfg(not(feature = "core"))]
extern crate std as core;

#[cfg(feature = "core")]
mod std {
pub use core::{slice, str, hash};
}

use std::hash::{Hasher, Hash, SipHasher};
use core::hash::{Hasher, Hash, SipHasher};

#[inline]
pub fn displace(f1: u32, f2: u32, d1: u32, d2: u32) -> u32 {
Expand Down

0 comments on commit 70f2ed9

Please sign in to comment.