From 8dd7a22f8b68790e930b2d518eb668c3dea5445c Mon Sep 17 00:00:00 2001 From: matejcik Date: Tue, 15 Mar 2022 12:34:44 +0100 Subject: [PATCH] refactor(core/rust): disallow creating byte buffers from &str --- core/embed/rust/src/micropython/buffer.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/embed/rust/src/micropython/buffer.rs b/core/embed/rust/src/micropython/buffer.rs index 59e702474b..b2c4f151ca 100644 --- a/core/embed/rust/src/micropython/buffer.rs +++ b/core/embed/rust/src/micropython/buffer.rs @@ -24,7 +24,7 @@ pub struct Buffer { impl Buffer { pub fn empty() -> Self { - Self::from("") + Self::from(b"") } } @@ -70,8 +70,8 @@ impl From<&'static [u8]> for Buffer { } } -impl From<&'static str> for Buffer { - fn from(val: &'static str) -> Self { +impl From<&'static [u8; N]> for Buffer { + fn from(val: &'static [u8; N]) -> Self { Buffer { ptr: val.as_ptr(), len: val.len(),