From f51bad20bf06a7c31bb78fde2fd3e4a1a5622bc7 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Wed, 3 Nov 2021 14:44:07 +0000 Subject: [PATCH] acpi_tables: aml: Avoid extra vector allocation in number types Using extend_from_slice() on the number types removes an extra vector allocation. Signed-off-by: Rob Bradford --- acpi_tables/src/aml.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/acpi_tables/src/aml.rs b/acpi_tables/src/aml.rs index d3592ba80..f4d0205fd 100644 --- a/acpi_tables/src/aml.rs +++ b/acpi_tables/src/aml.rs @@ -109,7 +109,7 @@ pub type Word = u16; impl Aml for Word { fn append_aml_bytes(&self, bytes: &mut Vec) { bytes.push(0x0b); /* WordPrefix */ - bytes.append(&mut self.to_le_bytes().to_vec()); + bytes.extend_from_slice(&self.to_le_bytes()) } } @@ -118,7 +118,7 @@ pub type DWord = u32; impl Aml for DWord { fn append_aml_bytes(&self, bytes: &mut Vec) { bytes.push(0x0c); /* DWordPrefix */ - bytes.append(&mut self.to_le_bytes().to_vec()); + bytes.extend_from_slice(&self.to_le_bytes()) } } @@ -127,7 +127,7 @@ pub type QWord = u64; impl Aml for QWord { fn append_aml_bytes(&self, bytes: &mut Vec) { bytes.push(0x0e); /* QWordPrefix */ - bytes.append(&mut self.to_le_bytes().to_vec()); + bytes.extend_from_slice(&self.to_le_bytes()) } }