Skip to content

Commit c1216c5

Browse files
committed
fix core import error
1 parent f4f36ec commit c1216c5

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
@@ -35,16 +35,18 @@ mod parse;
3535
#[cfg(feature = "arbitrary")]
3636
extern crate arbitrary;
3737

38-
#[cfg(any(feature = "std", not(all(not(feature = "std"), test))))]
39-
extern crate core;
38+
// Alias `std` as core when `std` is enabled
39+
#[cfg(feature = "std")]
40+
use std as core;
41+
// In tests bring in `std` even when `no_std`
4042
#[cfg(all(not(feature = "std"), test))]
4143
extern crate std;
4244

4345
#[cfg(feature = "serde")]
4446
extern crate serde;
4547
#[cfg(feature = "serde")]
4648
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
47-
#[cfg(feature = "serde")]
49+
#[cfg(all(feature = "std", feature = "serde"))]
4850
use std::convert::TryFrom;
4951

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

0 commit comments

Comments
 (0)