acpi_tables: Fix clippy (unnecessary_to_owned) issues

warning: unnecessary use of `to_vec`
    --> acpi_tables/src/aml.rs:1395:38
     |
1395 |         assert_eq!(create_pkg_length(&[0u8; 62].to_vec(), true), vec![63]);
     |                                      ^^^^^^^^^^^^^^^^^^^ help: use: `[0u8; 62].as_ref()`
     |
     = note: `#[warn(clippy::unnecessary_to_owned)]` on by default
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_to_owned

warning: unnecessary use of `to_vec`
    --> acpi_tables/src/aml.rs:1397:31
     |
1397 |             create_pkg_length(&[0u8; 64].to_vec(), true),
     |                               ^^^^^^^^^^^^^^^^^^^ help: use: `[0u8; 64].as_ref()`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_to_owned

warning: unnecessary use of `to_vec`
    --> acpi_tables/src/aml.rs:1401:31
     |
1401 |             create_pkg_length(&[0u8; 4096].to_vec(), true),
     |                               ^^^^^^^^^^^^^^^^^^^^^ help: use: `[0u8; 4096].as_ref()`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_to_owned

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2022-01-07 10:18:21 +00:00 committed by Bo Chen
parent 936237d4d6
commit f6333a39a5

View File

@ -1392,13 +1392,13 @@ mod tests {
#[test]
fn test_pkg_length() {
assert_eq!(create_pkg_length(&[0u8; 62].to_vec(), true), vec![63]);
assert_eq!(create_pkg_length(&[0u8; 62], true), vec![63]);
assert_eq!(
create_pkg_length(&[0u8; 64].to_vec(), true),
create_pkg_length(&[0u8; 64], true),
vec![1 << 6 | (66 & 0xf), 66 >> 4]
);
assert_eq!(
create_pkg_length(&[0u8; 4096].to_vec(), true),
create_pkg_length(&[0u8; 4096], true),
vec![
2 << 6 | (4099 & 0xf) as u8,
(4099 >> 4) as u8,