From 99043c9dd2c66d71b400a880e34a7647674d1fd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Mon, 15 Nov 2021 16:14:08 +0100 Subject: [PATCH] pkstrings: Don't consume PKString when converting to String MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maxime “pep” Buquet --- pkstrings/src/pkstring.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkstrings/src/pkstring.rs b/pkstrings/src/pkstring.rs index f2f0a5d..9441d6e 100644 --- a/pkstrings/src/pkstring.rs +++ b/pkstrings/src/pkstring.rs @@ -202,13 +202,13 @@ impl From for Vec { } } -impl From for String { - fn from(pkstr: PKString) -> String { +impl From<&PKString> for String { + fn from(pkstr: &PKString) -> String { let placeholder = '_'; let mut buf = String::new(); - for ord in pkstr.0 { - match hextochr(ord) { + for ord in &pkstr.0 { + match hextochr(*ord) { Some(chr) => buf.push(chr), None => buf.push(placeholder.clone()), }