From bf00807af42f97b47c0f2c275a3605bd5bca01bc Mon Sep 17 00:00:00 2001
From: Brian Smith <brian@briansmith.org>
Date: Tue, 21 Jan 2025 13:59:03 -0800
Subject: [PATCH] CI: Address new Clippy needless_as_bytes lint.

---
 src/test.rs | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/test.rs b/src/test.rs
index 922ee30e7d..076e31b5ba 100644
--- a/src/test.rs
+++ b/src/test.rs
@@ -201,11 +201,10 @@ impl TestCase {
     /// doesn't have the attribute.
     pub fn consume_optional_bytes(&mut self, key: &str) -> Option<Vec<u8>> {
         let s = self.consume_optional_string(key)?;
-        let result = if s.starts_with('\"') {
+        let result = if let [b'\"', s@..] = s.as_bytes() {
             // The value is a quoted UTF-8 string.
-
-            let mut bytes = Vec::with_capacity(s.as_bytes().len() - 2);
-            let mut s = s.as_bytes().iter().skip(1);
+            let mut s = s.iter();
+            let mut bytes = Vec::with_capacity(s.len() - 1);
             loop {
                 let b = match s.next() {
                     Some(b'\\') => {