Skip to content

Commit

Permalink
CI: Address new Clippy needless_as_bytes lint.
Browse files Browse the repository at this point in the history
  • Loading branch information
briansmith committed Jan 21, 2025
1 parent 8912a57 commit bf00807
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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'\\') => {
Expand Down

0 comments on commit bf00807

Please sign in to comment.