diff --git a/src/lexical/bignum.rs b/src/lexical/bignum.rs index f9551f534..4fa7eed6d 100644 --- a/src/lexical/bignum.rs +++ b/src/lexical/bignum.rs @@ -3,6 +3,7 @@ //! Big integer type definition. use super::math::*; +#[allow(unused_imports)] use alloc::vec::Vec; /// Storage for a big integer type. diff --git a/src/lib.rs b/src/lib.rs index aa3fcfc8d..876ff199d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -360,11 +360,14 @@ #![deny(clippy::question_mark_used)] #![allow(non_upper_case_globals)] #![deny(missing_docs)] -#![cfg_attr(not(feature = "std"), no_std)] +#![no_std] #![cfg_attr(docsrs, feature(doc_cfg))] extern crate alloc; +#[cfg(feature = "std")] +extern crate std; + #[cfg(feature = "std")] #[cfg_attr(docsrs, doc(cfg(feature = "std")))] #[doc(inline)] diff --git a/src/map.rs b/src/map.rs index 1d74e1b2b..520cd6cf5 100644 --- a/src/map.rs +++ b/src/map.rs @@ -20,7 +20,7 @@ use serde::de; #[cfg(not(feature = "preserve_order"))] use alloc::collections::{btree_map, BTreeMap}; #[cfg(feature = "preserve_order")] -use indexmap::{self, IndexMap}; +use indexmap::IndexMap; /// Represents a JSON key/value type. pub struct Map { @@ -176,6 +176,8 @@ impl Map { /// Like [`Vec::swap_remove`], the entry is removed by swapping it with the /// last element of the map and popping it off. This perturbs the position /// of what used to be the last element! + /// + /// [`Vec::swap_remove`]: std::vec::Vec::swap_remove #[cfg(feature = "preserve_order")] #[cfg_attr(docsrs, doc(cfg(feature = "preserve_order")))] #[inline] @@ -192,6 +194,8 @@ impl Map { /// Like [`Vec::swap_remove`], the entry is removed by swapping it with the /// last element of the map and popping it off. This perturbs the position /// of what used to be the last element! + /// + /// [`Vec::swap_remove`]: std::vec::Vec::swap_remove #[cfg(feature = "preserve_order")] #[cfg_attr(docsrs, doc(cfg(feature = "preserve_order")))] #[inline] @@ -208,6 +212,8 @@ impl Map { /// Like [`Vec::remove`], the entry is removed by shifting all of the /// elements that follow it, preserving their relative order. This perturbs /// the index of all of those elements! + /// + /// [`Vec::remove`]: std::vec::Vec::remove #[cfg(feature = "preserve_order")] #[cfg_attr(docsrs, doc(cfg(feature = "preserve_order")))] #[inline] @@ -224,6 +230,8 @@ impl Map { /// Like [`Vec::remove`], the entry is removed by shifting all of the /// elements that follow it, preserving their relative order. This perturbs /// the index of all of those elements! + /// + /// [`Vec::remove`]: std::vec::Vec::remove #[cfg(feature = "preserve_order")] #[cfg_attr(docsrs, doc(cfg(feature = "preserve_order")))] #[inline] diff --git a/src/read.rs b/src/read.rs index 7446f28b9..06ac907e2 100644 --- a/src/read.rs +++ b/src/read.rs @@ -14,6 +14,8 @@ use crate::iter::LineColIterator; use crate::raw::BorrowedRawDeserializer; #[cfg(all(feature = "raw_value", feature = "std"))] use crate::raw::OwnedRawDeserializer; +#[cfg(all(feature = "raw_value", feature = "std"))] +use alloc::string::String; #[cfg(feature = "raw_value")] use serde::de::Visitor; diff --git a/tests/test.rs b/tests/test.rs index 9a8e7ca73..543dbd0b1 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -43,7 +43,6 @@ use std::iter; use std::marker::PhantomData; use std::mem; use std::str::FromStr; -use std::string::ToString; use std::{f32, f64}; use std::{i16, i32, i64, i8}; use std::{u16, u32, u64, u8};