aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTatsuyuki Ishi <ishitatsuyuki@google.com>2024-04-12 02:33:48 +0000
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2024-04-12 14:55:44 +0000
commit48b9e2d0f85f99e56e2df07ecc2d4f9b360f5216 (patch)
tree151d0d276c5f52da37179a4615aa3e3332f807b8
parent92a0ed1a7ab0db182820c2c20f57a64b9bd1fb7f (diff)
downloadtoolchain-utils-48b9e2d0f85f99e56e2df07ecc2d4f9b360f5216.tar.gz
rust-analyzer-chromiumos-wrapper: Simplify test output Vec initialization
The upper bound should be the byte length of json_expected, not str length of read. But it doesn't really matter since this is not performance critical test code, so just use the default constructor. BUG=b:333979840 TEST=cargo test Change-Id: I11e963d6f0fe65d08ba3b552ce24785ac51bfbd7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5446198 Reviewed-by: Bastian Kersting <bkersting@google.com> Reviewed-by: George Burgess <gbiv@chromium.org> Tested-by: Tatsuyuki Ishi <ishitatsuyuki@google.com> Reviewed-by: Allen Webb <allenwebb@google.com> Commit-Queue: George Burgess <gbiv@chromium.org> Auto-Submit: Tatsuyuki Ishi <ishitatsuyuki@google.com>
-rw-r--r--rust-analyzer-chromiumos-wrapper/src/main.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/rust-analyzer-chromiumos-wrapper/src/main.rs b/rust-analyzer-chromiumos-wrapper/src/main.rs
index f9f055e7..e293cdbf 100644
--- a/rust-analyzer-chromiumos-wrapper/src/main.rs
+++ b/rust-analyzer-chromiumos-wrapper/src/main.rs
@@ -354,7 +354,7 @@ mod test {
replacement: &str,
json_expected: &str,
) -> Result<()> {
- let mut w = Vec::<u8>::with_capacity(read.len());
+ let mut w = Vec::new();
let replacement_map = {
let mut m = HashMap::new();
m.insert(pattern, replacement);