diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:06:37 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:06:37 +0000 |
commit | 246f239d9f40f633160f0c18f87a20922d4e77bb (patch) | |
tree | 5a88572663584b3d4d28e5a20e10abab1be40884 /vendor/serde_json/src | |
parent | Releasing progress-linux version 1.64.0+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-246f239d9f40f633160f0c18f87a20922d4e77bb.tar.xz rustc-246f239d9f40f633160f0c18f87a20922d4e77bb.zip |
Merging debian version 1.65.0+dfsg1-2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/serde_json/src')
-rw-r--r-- | vendor/serde_json/src/lib.rs | 3 | ||||
-rw-r--r-- | vendor/serde_json/src/number.rs | 35 | ||||
-rw-r--r-- | vendor/serde_json/src/value/mod.rs | 22 |
3 files changed, 20 insertions, 40 deletions
diff --git a/vendor/serde_json/src/lib.rs b/vendor/serde_json/src/lib.rs index 736ab8472..cf4b83d19 100644 --- a/vendor/serde_json/src/lib.rs +++ b/vendor/serde_json/src/lib.rs @@ -300,7 +300,7 @@ //! [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.82")] +#![doc(html_root_url = "https://docs.rs/serde_json/1.0.85")] // Ignored clippy lints #![allow( clippy::collapsible_else_if, @@ -308,6 +308,7 @@ clippy::deprecated_cfg_attr, clippy::doc_markdown, clippy::excessive_precision, + clippy::explicit_auto_deref, clippy::float_cmp, clippy::manual_range_contains, clippy::match_like_matches_macro, diff --git a/vendor/serde_json/src/number.rs b/vendor/serde_json/src/number.rs index b965271fd..df8819259 100644 --- a/vendor/serde_json/src/number.rs +++ b/vendor/serde_json/src/number.rs @@ -292,9 +292,9 @@ impl Display for Number { #[cfg(not(feature = "arbitrary_precision"))] fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { match self.n { - N::PosInt(u) => Display::fmt(&u, formatter), - N::NegInt(i) => Display::fmt(&i, formatter), - N::Float(f) => Display::fmt(&f, formatter), + N::PosInt(u) => formatter.write_str(itoa::Buffer::new().format(u)), + N::NegInt(i) => formatter.write_str(itoa::Buffer::new().format(i)), + N::Float(f) => formatter.write_str(ryu::Buffer::new().format_finite(f)), } } @@ -305,29 +305,8 @@ impl Display for Number { } impl Debug for Number { - #[cfg(not(feature = "arbitrary_precision"))] - fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - let mut debug = formatter.debug_tuple("Number"); - match self.n { - N::PosInt(i) => { - debug.field(&i); - } - N::NegInt(i) => { - debug.field(&i); - } - N::Float(f) => { - debug.field(&f); - } - } - debug.finish() - } - - #[cfg(feature = "arbitrary_precision")] fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - formatter - .debug_tuple("Number") - .field(&format_args!("{}", self.n)) - .finish() + write!(formatter, "Number({})", self) } } @@ -752,13 +731,15 @@ impl_from_signed!(i8, i16, i32, i64, isize); serde_if_integer128! { impl From<i128> for Number { fn from(i: i128) -> Self { - Number { n: i.to_string() } + let n = itoa::Buffer::new().format(i).to_owned(); + Number { n } } } impl From<u128> for Number { fn from(u: u128) -> Self { - Number { n: u.to_string() } + let n = itoa::Buffer::new().format(u).to_owned(); + Number { n } } } } diff --git a/vendor/serde_json/src/value/mod.rs b/vendor/serde_json/src/value/mod.rs index 4793e93ec..c467df6cc 100644 --- a/vendor/serde_json/src/value/mod.rs +++ b/vendor/serde_json/src/value/mod.rs @@ -177,19 +177,17 @@ pub enum Value { impl Debug for Value { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { match self { - Value::Null => formatter.debug_tuple("Null").finish(), - Value::Bool(v) => formatter.debug_tuple("Bool").field(v).finish(), - Value::Number(v) => Debug::fmt(v, formatter), - Value::String(v) => formatter.debug_tuple("String").field(v).finish(), - Value::Array(v) => { - formatter.write_str("Array(")?; - Debug::fmt(v, formatter)?; - formatter.write_str(")") + Value::Null => formatter.write_str("Null"), + Value::Bool(boolean) => write!(formatter, "Bool({})", boolean), + Value::Number(number) => Debug::fmt(number, formatter), + Value::String(string) => write!(formatter, "String({:?})", string), + Value::Array(vec) => { + formatter.write_str("Array ")?; + Debug::fmt(vec, formatter) } - Value::Object(v) => { - formatter.write_str("Object(")?; - Debug::fmt(v, formatter)?; - formatter.write_str(")") + Value::Object(map) => { + formatter.write_str("Object ")?; + Debug::fmt(map, formatter) } } } |