aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Galenson <jgalenson@google.com>2021-05-25 15:15:19 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-05-25 15:15:19 +0000
commit3b719dbcf8fc11ef43968ca00f4c17fb499f4fcf (patch)
tree2d40aeccbf398a4c84a3ee38303459327f8d0427
parenta37fd9052ca548430a4337b7b06d5744fd081874 (diff)
parente2a090d30261ed100b099d5640ae67e6fce7f5c5 (diff)
downloadserde_json-3b719dbcf8fc11ef43968ca00f4c17fb499f4fcf.tar.gz
Upgrade rust/crates/serde_json to 1.0.64 am: 308069c537 am: 3115b28ef9 am: 1ee72c3be5 am: e2a090d302
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/serde_json/+/1712599 Change-Id: Ic5dbc59acea3a7704e4e4adba8178b687c3dc6ef
-rw-r--r--.cargo_vcs_info.json2
-rw-r--r--Android.bp8
-rw-r--r--Cargo.toml2
-rw-r--r--Cargo.toml.orig2
-rw-r--r--METADATA8
-rw-r--r--TEST_MAPPING15
-rw-r--r--src/de.rs4
-rw-r--r--src/lib.rs2
-rw-r--r--src/map.rs34
-rw-r--r--src/read.rs10
10 files changed, 71 insertions, 16 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index a1a51ce..dd6bf24 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,5 +1,5 @@
{
"git": {
- "sha1": "8d78020522b4d3001be5f9c613bf4b5a6e63618a"
+ "sha1": "d0d80783d31161c869922fad933b3623715506d2"
}
}
diff --git a/Android.bp b/Android.bp
index 7af1a94..60fe7bf 100644
--- a/Android.bp
+++ b/Android.bp
@@ -65,7 +65,7 @@ rust_library {
// proc-macro2-1.0.26 "default,proc-macro"
// quote-1.0.9 "default,proc-macro"
// ryu-1.0.5
-// serde-1.0.125 "default,derive,serde_derive,std"
-// serde_derive-1.0.125 "default"
-// syn-1.0.71 "clone-impls,default,derive,parsing,printing,proc-macro,quote"
-// unicode-xid-0.2.1 "default"
+// serde-1.0.126 "default,derive,serde_derive,std"
+// serde_derive-1.0.126 "default"
+// syn-1.0.72 "clone-impls,default,derive,parsing,printing,proc-macro,quote"
+// unicode-xid-0.2.2 "default"
diff --git a/Cargo.toml b/Cargo.toml
index 19e5e6f..fe399a8 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,7 +13,7 @@
[package]
edition = "2018"
name = "serde_json"
-version = "1.0.62"
+version = "1.0.64"
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 c837c78..6ecb159 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,6 +1,6 @@
[package]
name = "serde_json"
-version = "1.0.62" # remember to update html_root_url
+version = "1.0.64" # 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"
diff --git a/METADATA b/METADATA
index 4d16a38..46bb276 100644
--- a/METADATA
+++ b/METADATA
@@ -7,13 +7,13 @@ third_party {
}
url {
type: ARCHIVE
- value: "https://static.crates.io/crates/serde_json/serde_json-1.0.62.crate"
+ value: "https://static.crates.io/crates/serde_json/serde_json-1.0.64.crate"
}
- version: "1.0.62"
+ version: "1.0.64"
license_type: NOTICE
last_upgrade_date {
year: 2021
- month: 2
- day: 9
+ month: 5
+ day: 19
}
}
diff --git a/TEST_MAPPING b/TEST_MAPPING
index 22969ba..a76284a 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -2,7 +2,22 @@
{
"presubmit": [
{
+ "name": "ZipFuseTest"
+ },
+ {
+ "name": "authfs_device_test_src_lib"
+ },
+ {
+ "name": "either_device_test_src_lib"
+ },
+ {
"name": "url_device_test_src_lib"
+ },
+ {
+ "name": "url_device_test_tests_data"
+ },
+ {
+ "name": "url_device_test_tests_unit"
}
]
}
diff --git a/src/de.rs b/src/de.rs
index 4abe7ef..15c8236 100644
--- a/src/de.rs
+++ b/src/de.rs
@@ -41,7 +41,7 @@ where
/// Typically it is more convenient to use one of these methods instead:
///
/// - Deserializer::from_str
- /// - Deserializer::from_bytes
+ /// - Deserializer::from_slice
/// - Deserializer::from_reader
pub fn new(read: R) -> Self {
Deserializer {
@@ -2250,7 +2250,7 @@ where
/// Typically it is more convenient to use one of these methods instead:
///
/// - Deserializer::from_str(...).into_iter()
- /// - Deserializer::from_bytes(...).into_iter()
+ /// - Deserializer::from_slice(...).into_iter()
/// - Deserializer::from_reader(...).into_iter()
pub fn new(read: R) -> Self {
let offset = read.byte_offset();
diff --git a/src/lib.rs b/src/lib.rs
index c3766b5..1d75083 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -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.62")]
+#![doc(html_root_url = "https://docs.rs/serde_json/1.0.64")]
#![deny(clippy::all, clippy::pedantic)]
// Ignored clippy lints
#![allow(
diff --git a/src/map.rs b/src/map.rs
index f09d840..b564446 100644
--- a/src/map.rs
+++ b/src/map.rs
@@ -542,6 +542,40 @@ impl<'a> Entry<'a> {
Entry::Occupied(entry) => entry.into_mut(),
}
}
+
+ /// Provides in-place mutable access to an occupied entry before any
+ /// potential inserts into the map.
+ ///
+ /// # Examples
+ ///
+ /// ```
+ /// # use serde_json::json;
+ /// #
+ /// let mut map = serde_json::Map::new();
+ /// map.entry("serde")
+ /// .and_modify(|e| *e = json!("rust"))
+ /// .or_insert(json!("cpp"));
+ ///
+ /// assert_eq!(map["serde"], "cpp");
+ ///
+ /// map.entry("serde")
+ /// .and_modify(|e| *e = json!("rust"))
+ /// .or_insert(json!("cpp"));
+ ///
+ /// assert_eq!(map["serde"], "rust");
+ /// ```
+ pub fn and_modify<F>(self, f: F) -> Self
+ where
+ F: FnOnce(&mut Value),
+ {
+ match self {
+ Entry::Occupied(mut entry) => {
+ f(entry.get_mut());
+ Entry::Occupied(entry)
+ }
+ Entry::Vacant(entry) => Entry::Vacant(entry),
+ }
+ }
}
impl<'a> VacantEntry<'a> {
diff --git a/src/read.rs b/src/read.rs
index 522c0e0..d247c30 100644
--- a/src/read.rs
+++ b/src/read.rs
@@ -377,7 +377,10 @@ where
V: Visitor<'de>,
{
let raw = self.raw_buffer.take().unwrap();
- let raw = String::from_utf8(raw).unwrap();
+ let raw = match String::from_utf8(raw) {
+ Ok(raw) => raw,
+ Err(_) => return error(self, ErrorCode::InvalidUnicodeCodePoint),
+ };
visitor.visit_map(OwnedRawDeserializer {
raw_value: Some(raw),
})
@@ -587,7 +590,10 @@ impl<'a> Read<'a> for SliceRead<'a> {
V: Visitor<'a>,
{
let raw = &self.slice[self.raw_buffering_start_index..self.index];
- let raw = str::from_utf8(raw).unwrap();
+ let raw = match str::from_utf8(raw) {
+ Ok(raw) => raw,
+ Err(_) => return error(self, ErrorCode::InvalidUnicodeCodePoint),
+ };
visitor.visit_map(BorrowedRawDeserializer {
raw_value: Some(raw),
})