Skip to content

Commit e8a0a4f

Browse files
committed
fix core import error
1 parent 04e30f3 commit e8a0a4f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/lib.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,18 @@
3030

3131
mod parse;
3232

33-
#[cfg(any(feature = "std", not(all(not(feature = "std"), test))))]
34-
extern crate core;
33+
// Alias `std` as core when `std` is enabled
34+
#[cfg(feature = "std")]
35+
use std as core;
36+
// In tests bring in `std` even when `no_std`
3537
#[cfg(all(not(feature = "std"), test))]
3638
extern crate std;
3739

3840
#[cfg(feature = "serde")]
3941
extern crate serde;
4042
#[cfg(feature = "serde")]
4143
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
42-
#[cfg(feature = "serde")]
44+
#[cfg(all(feature = "std", feature = "serde"))]
4345
use std::convert::TryFrom;
4446

4547
use core::fmt::{self, Debug, Display, Formatter};

0 commit comments

Comments
 (0)