aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2022-03-08 21:25:21 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-03-08 21:25:21 +0000
commit32d47430b7c92129423fa862b61fce050fce3a59 (patch)
tree58f7f050cf3633807c295fb927d3752b7b5a1a0d /src/lib.rs
parent31ab3915db76513fc54b5bae7019bea259d792cd (diff)
parenta24a741dd2eef268bc820818304fbcd9cee39c6b (diff)
downloadserde_json-32d47430b7c92129423fa862b61fce050fce3a59.tar.gz
Merge "Update serde_json to 1.0.79" am: e3041fe03f am: a24a741dd2
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/serde_json/+/2005037 Change-Id: If7169283873d2810fbe69cac219f77ff85b2edc4
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs76
1 files changed, 11 insertions, 65 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 319ce71..63846e7 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -300,10 +300,10 @@
//! [macro]: https://docs.serde.rs/serde_json/macro.json.html
//! [`serde-json-core`]: https://github.com/rust-embedded-community/serde-json-core
-#![doc(html_root_url = "https://docs.rs/serde_json/1.0.68")]
-#![deny(clippy::all, clippy::pedantic)]
+#![doc(html_root_url = "https://docs.rs/serde_json/1.0.79")]
// Ignored clippy lints
#![allow(
+ clippy::collapsible_else_if,
clippy::comparison_chain,
clippy::deprecated_cfg_attr,
clippy::doc_markdown,
@@ -313,6 +313,10 @@
clippy::match_like_matches_macro,
clippy::match_single_binding,
clippy::needless_doctest_main,
+ clippy::needless_late_init,
+ // clippy bug: https://github.com/rust-lang/rust-clippy/issues/8366
+ clippy::ptr_arg,
+ clippy::return_self_not_must_use,
clippy::transmute_ptr_to_ptr,
clippy::unnecessary_wraps,
// clippy bug: https://github.com/rust-lang/rust-clippy/issues/5704
@@ -320,6 +324,8 @@
)]
// Ignored clippy_pedantic lints
#![allow(
+ // buggy
+ clippy::iter_not_returning_iterator, // https://github.com/rust-lang/rust-clippy/issues/8285
// Deserializer::from_str, into_iter
clippy::should_implement_trait,
// integer and float ser/de requires these sorts of casts
@@ -359,65 +365,8 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(docsrs, feature(doc_cfg))]
-////////////////////////////////////////////////////////////////////////////////
-
-#[cfg(not(feature = "std"))]
extern crate alloc;
-/// A facade around all the types we need from the `std`, `core`, and `alloc`
-/// crates. This avoids elaborate import wrangling having to happen in every
-/// module.
-mod lib {
- mod core {
- #[cfg(not(feature = "std"))]
- pub use core::*;
- #[cfg(feature = "std")]
- pub use std::*;
- }
-
- pub use self::core::cell::{Cell, RefCell};
- pub use self::core::clone::{self, Clone};
- pub use self::core::convert::{self, From, Into};
- pub use self::core::default::{self, Default};
- pub use self::core::fmt::{self, Debug, Display};
- pub use self::core::hash::{self, Hash};
- pub use self::core::iter::FusedIterator;
- pub use self::core::marker::{self, PhantomData};
- pub use self::core::ops::{Bound, RangeBounds};
- pub use self::core::result::{self, Result};
- pub use self::core::{borrow, char, cmp, iter, mem, num, ops, slice, str};
-
- #[cfg(not(feature = "std"))]
- pub use alloc::borrow::{Cow, ToOwned};
- #[cfg(feature = "std")]
- pub use std::borrow::{Cow, ToOwned};
-
- #[cfg(not(feature = "std"))]
- pub use alloc::string::{String, ToString};
- #[cfg(feature = "std")]
- pub use std::string::{String, ToString};
-
- #[cfg(not(feature = "std"))]
- pub use alloc::vec::{self, Vec};
- #[cfg(feature = "std")]
- pub use std::vec::{self, Vec};
-
- #[cfg(not(feature = "std"))]
- pub use alloc::boxed::Box;
- #[cfg(feature = "std")]
- pub use std::boxed::Box;
-
- #[cfg(not(feature = "std"))]
- pub use alloc::collections::{btree_map, BTreeMap};
- #[cfg(feature = "std")]
- pub use std::collections::{btree_map, BTreeMap};
-
- #[cfg(feature = "std")]
- pub use std::error;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-
#[cfg(feature = "std")]
#[doc(inline)]
pub use crate::de::from_reader;
@@ -436,15 +385,12 @@ pub use crate::value::{from_value, to_value, Map, Number, Value};
// We only use our own error type; no need for From conversions provided by the
// standard library's try! macro. This reduces lines of LLVM IR by 4%.
macro_rules! tri {
- ($e:expr) => {
+ ($e:expr $(,)?) => {
match $e {
- crate::lib::Result::Ok(val) => val,
- crate::lib::Result::Err(err) => return crate::lib::Result::Err(err),
+ core::result::Result::Ok(val) => val,
+ core::result::Result::Err(err) => return core::result::Result::Err(err),
}
};
- ($e:expr,) => {
- tri!($e)
- };
}
#[macro_use]