From ca9c6415d9a47cbe93647ee851dab95933996cad Mon Sep 17 00:00:00 2001 From: Rik Huijzer Date: Sat, 21 Dec 2024 20:05:19 +0100 Subject: [PATCH] Update --- xrcf/src/ir/mod.rs | 17 ++++++++--------- xrcf/src/parser/parser.rs | 4 ++-- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/xrcf/src/ir/mod.rs b/xrcf/src/ir/mod.rs index 7523000a..67fa39c6 100644 --- a/xrcf/src/ir/mod.rs +++ b/xrcf/src/ir/mod.rs @@ -86,11 +86,12 @@ fn test_llvm_string_to_bytes() { /// Convert a vector of bytes to a string while handling LLVM escape sequences. /// -// Explicitly print the null byte too or else the vector length will not match -// the text that is shown. - -// A backslash with two hex characters defines the byte in LLVM IR in hex, so -// \00 is the null byte in LLVM IR. +/// Explicitly print the null byte too or else the vector length will not match +/// the text that is shown. +/// +/// A backslash with two hex characters defines the byte in LLVM IR in hex, so A +/// backslash with two hex characters defines the byte in LLVM IR in hex, so \00 +/// is the null byte in LLVM IR. pub fn bytes_to_llvm_string(bytes: &[u8]) -> String { let src = String::from_utf8(bytes.to_vec()).unwrap(); src.replace("\0", "\\00").replace("\n", "\\0A") @@ -104,13 +105,11 @@ fn test_bytes_to_llvm_string() { } pub fn escape(src: &str) -> String { - let src = src.replace("\n", "\\n"); - src + src.replace("\n", "\\n") } pub fn unescape(src: &str) -> String { - let src = src.replace("\\n", "\n"); - src + src.replace("\\n", "\n") } /// Generate a new name as part of printing. diff --git a/xrcf/src/parser/parser.rs b/xrcf/src/parser/parser.rs index 1a84546b..96541b5c 100644 --- a/xrcf/src/parser/parser.rs +++ b/xrcf/src/parser/parser.rs @@ -153,7 +153,7 @@ pub struct Parser { src: String, tokens: Vec, current: usize, - parse_op: std::marker::PhantomData, + _marker: std::marker::PhantomData, } #[allow(dead_code)] @@ -357,7 +357,7 @@ impl Parser { src: src.to_string(), tokens: Scanner::scan(src)?, current: 0, - parse_op: std::marker::PhantomData, + _marker: std::marker::PhantomData, }; let op = T::parse_op(&mut parser, None)?; let op_rd = op.clone();