fix(compiler) Make it compile with or without std.

This commit is contained in:
Ivan Enderlin
2020-05-19 09:24:16 +02:00
parent e70ed0303d
commit 63f5cd5302
8 changed files with 25 additions and 20 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,22 @@
clippy::use_self
)
)]
#![no_std]
#[cfg(not(feature = "std"))]
#[macro_use]
extern crate alloc as std;
#[cfg(feature = "std")]
#[macro_use]
extern crate std;
mod lib {
#[cfg(not(feature = "std"))]
pub mod std {
#[cfg(feature = "core")]
pub use alloc::{boxed, fmt, string, vec};
#[cfg(not(feature = "std"))]
use hashbrown::HashMap;
#[cfg(feature = "std")]
use std::collections::HashMap;
#[cfg(feature = "core")]
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")]