Merge pull request #32 from Hywan/fix-compiler-no-default-features

fix(compiler) Fix features
This commit is contained in:
Ivan Enderlin
2020-05-20 14:26:35 +02:00
committed by GitHub
10 changed files with 88 additions and 41 deletions

View File

@@ -8,6 +8,7 @@
#![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)]
#![warn(unused_import_braces)]
#![cfg_attr(feature = "std", deny(unstable_features))]
#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
#![cfg_attr(feature = "cargo-clippy", allow(clippy::new_without_default))]
#![cfg_attr(
@@ -23,19 +24,32 @@
clippy::use_self
)
)]
#![no_std]
#[cfg(not(feature = "std"))]
#[macro_use]
extern crate alloc as std;
#[cfg(feature = "std")]
#[macro_use]
extern crate std;
#[cfg(all(feature = "std", feature = "core"))]
compile_error!(
"The `std` and `core` features are both enabled, which is an error. Please enable only once."
);
#[cfg(not(feature = "std"))]
use hashbrown::HashMap;
#[cfg(feature = "std")]
use std::collections::HashMap;
#[cfg(all(not(feature = "std"), not(feature = "core")))]
compile_error!("Both the `std` and `core` features are disabled. Please enable one of them.");
#[cfg(feature = "core")]
extern crate alloc;
mod lib {
#[cfg(feature = "core")]
pub mod std {
#[macro_use]
pub use alloc::{boxed, string, vec};
pub use core::fmt;
pub use hashbrown as collections;
}
#[cfg(feature = "std")]
pub mod std {
pub use std::{boxed, collections, fmt, string, vec};
}
}
mod address_map;
#[cfg(feature = "translator")]