From aaa27987c56c020ed0a78602432d1f29189afcfb Mon Sep 17 00:00:00 2001 From: Karl Meakin Date: Thu, 22 Aug 2024 23:21:40 +0100 Subject: [PATCH] Use `split_first_chunk` instead of splitting manually Copyright (c) 2024, Arm Limited. Signed-off-by: Karl Meakin --- pulley/src/decode.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pulley/src/decode.rs b/pulley/src/decode.rs index 09f4da80d901..54c84304f1c5 100644 --- a/pulley/src/decode.rs +++ b/pulley/src/decode.rs @@ -147,13 +147,13 @@ impl<'a> SafeBytecodeStream<'a> { impl BytecodeStream for SafeBytecodeStream<'_> { fn read(&mut self) -> Result<[u8; N], Self::Error> { - let bytes = *self + let (bytes, rest) = self .bytecode - .first_chunk::() + .split_first_chunk() .ok_or_else(|| self.unexpected_eof())?; - self.bytecode = &self.bytecode[N..]; + self.bytecode = rest; self.position += N; - Ok(bytes) + Ok(*bytes) } type Error = DecodingError;