diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2021-03-23 00:19:59 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-03-23 00:19:59 +0000 |
commit | 5b90ed74042ab38c85134b87824d65775d888ce5 (patch) | |
tree | fc7457eb594973b505dc7dc8d225cad29a41b1ca | |
parent | c8ddd414fd760e99f46ab9b486cb4eb943f20315 (diff) | |
parent | 3460fdd5d7b13f67048a5204361940a19291ee86 (diff) | |
download | serde_json-5b90ed74042ab38c85134b87824d65775d888ce5.tar.gz |
Merge "Upgrade rust/crates/serde_json to 1.0.62" am: c1f979a6e9 am: 8e7fc59742 am: da48820dc5 am: 3460fdd5d7
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/serde_json/+/1582271
Change-Id: I1e5ea956012fb3fa364a574e43bbb7b99ba0e266
-rw-r--r-- | .cargo_vcs_info.json | 2 | ||||
-rw-r--r-- | Android.bp | 6 | ||||
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | Cargo.toml.orig | 2 | ||||
-rw-r--r-- | METADATA | 10 | ||||
-rw-r--r-- | TEST_MAPPING | 8 | ||||
-rw-r--r-- | src/de.rs | 2 | ||||
-rw-r--r-- | src/lib.rs | 2 | ||||
-rw-r--r-- | src/value/mod.rs | 47 |
9 files changed, 46 insertions, 35 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json index 62188b9..a1a51ce 100644 --- a/.cargo_vcs_info.json +++ b/.cargo_vcs_info.json @@ -1,5 +1,5 @@ { "git": { - "sha1": "613d66e9c5bec9b6eb07e296958553ab1f65522d" + "sha1": "8d78020522b4d3001be5f9c613bf4b5a6e63618a" } } @@ -66,7 +66,7 @@ rust_library { // proc-macro2-1.0.24 "default,proc-macro" // quote-1.0.8 "default,proc-macro" // ryu-1.0.5 -// serde-1.0.118 "default,derive,serde_derive,std" -// serde_derive-1.0.118 "default" -// syn-1.0.56 "clone-impls,default,derive,parsing,printing,proc-macro,quote,visit" +// serde-1.0.123 "default,derive,serde_derive,std" +// serde_derive-1.0.123 "default" +// syn-1.0.60 "clone-impls,default,derive,parsing,printing,proc-macro,quote" // unicode-xid-0.2.1 "default" @@ -13,7 +13,7 @@ [package] edition = "2018" name = "serde_json" -version = "1.0.61" +version = "1.0.62" authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"] include = ["build.rs", "src/**/*.rs", "README.md", "LICENSE-APACHE", "LICENSE-MIT"] description = "A JSON serialization file format" diff --git a/Cargo.toml.orig b/Cargo.toml.orig index 8e40912..c837c78 100644 --- a/Cargo.toml.orig +++ b/Cargo.toml.orig @@ -1,6 +1,6 @@ [package] name = "serde_json" -version = "1.0.61" # remember to update html_root_url +version = "1.0.62" # remember to update html_root_url authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"] license = "MIT OR Apache-2.0" description = "A JSON serialization file format" @@ -7,13 +7,13 @@ third_party { } url { type: ARCHIVE - value: "https://static.crates.io/crates/serde_json/serde_json-1.0.61.crate" + value: "https://static.crates.io/crates/serde_json/serde_json-1.0.62.crate" } - version: "1.0.61" + version: "1.0.62" license_type: NOTICE last_upgrade_date { - year: 2020 - month: 12 - day: 29 + year: 2021 + month: 2 + day: 9 } } diff --git a/TEST_MAPPING b/TEST_MAPPING new file mode 100644 index 0000000..22969ba --- /dev/null +++ b/TEST_MAPPING @@ -0,0 +1,8 @@ +// Generated by update_crate_tests.py for tests that depend on this crate. +{ + "presubmit": [ + { + "name": "url_device_test_src_lib" + } + ] +} @@ -2432,7 +2432,7 @@ where /// location: String, /// } /// -/// fn read_user_from_file<P: AsRef<Path>>(path: P) -> Result<User, Box<Error>> { +/// fn read_user_from_file<P: AsRef<Path>>(path: P) -> Result<User, Box<dyn Error>> { /// // Open the file in read-only mode with buffer. /// let file = File::open(path)?; /// let reader = BufReader::new(file); @@ -300,7 +300,7 @@ //! [macro]: https://docs.serde.rs/serde_json/macro.json.html //! [`serde-json-core`]: https://japaric.github.io/serde-json-core/serde_json_core/ -#![doc(html_root_url = "https://docs.rs/serde_json/1.0.61")] +#![doc(html_root_url = "https://docs.rs/serde_json/1.0.62")] #![deny(clippy::all, clippy::pedantic)] // Ignored clippy lints #![allow( diff --git a/src/value/mod.rs b/src/value/mod.rs index 07f4cc2..88d2ef6 100644 --- a/src/value/mod.rs +++ b/src/value/mod.rs @@ -106,7 +106,7 @@ pub use crate::raw::{to_raw_value, RawValue}; /// Represents any valid JSON value. /// -/// See the `serde_json::value` module documentation for usage examples. +/// See the [`serde_json::value` module documentation](self) for usage examples. #[derive(Clone, Eq, PartialEq)] pub enum Value { /// Represents a JSON null value. @@ -191,27 +191,6 @@ impl Debug for Value { } } -struct WriterFormatter<'a, 'b: 'a> { - inner: &'a mut fmt::Formatter<'b>, -} - -impl<'a, 'b> io::Write for WriterFormatter<'a, 'b> { - fn write(&mut self, buf: &[u8]) -> io::Result<usize> { - fn io_error<E>(_: E) -> io::Error { - // Error value does not matter because fmt::Display impl below just - // maps it to fmt::Error - io::Error::new(io::ErrorKind::Other, "fmt error") - } - let s = tri!(str::from_utf8(buf).map_err(io_error)); - tri!(self.inner.write_str(s).map_err(io_error)); - Ok(buf.len()) - } - - fn flush(&mut self) -> io::Result<()> { - Ok(()) - } -} - impl fmt::Display for Value { /// Display a JSON value as a string. /// @@ -238,6 +217,30 @@ impl fmt::Display for Value { /// "{\n \"city\": \"London\",\n \"street\": \"10 Downing Street\"\n}"); /// ``` fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + struct WriterFormatter<'a, 'b: 'a> { + inner: &'a mut fmt::Formatter<'b>, + } + + impl<'a, 'b> io::Write for WriterFormatter<'a, 'b> { + fn write(&mut self, buf: &[u8]) -> io::Result<usize> { + // Safety: the serializer below only emits valid utf8 when using + // the default formatter. + let s = unsafe { str::from_utf8_unchecked(buf) }; + tri!(self.inner.write_str(s).map_err(io_error)); + Ok(buf.len()) + } + + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } + } + + fn io_error(_: fmt::Error) -> io::Error { + // Error value does not matter because Display impl just maps it + // back to fmt::Error. + io::Error::new(io::ErrorKind::Other, "fmt error") + } + let alternate = f.alternate(); let mut wr = WriterFormatter { inner: f }; if alternate { |