From 7b9768ae23f9efa822742a4acdebf3f45901ae92 Mon Sep 17 00:00:00 2001 From: Wildan M Date: Mon, 6 Jul 2026 00:17:55 +0700 Subject: [PATCH] Set ByteLiteral::cast_cchar as const fn --- src/byte_literal.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/byte_literal.rs b/src/byte_literal.rs index 8af314f79e..8d0a5280f7 100644 --- a/src/byte_literal.rs +++ b/src/byte_literal.rs @@ -16,7 +16,7 @@ impl ByteLiteral { /// - Decimal: `30`..=`126` /// - Hexadecimal: `20`..=`7E` /// - Byte literals: The space character (` `) upto and including tilde (`~`) - pub fn cast_cchar(input: u8) -> c_char { + pub const fn cast_cchar(input: u8) -> c_char { match input { b' '..=b'~' => { // `c_char` is an `i8` on these arches @@ -27,7 +27,7 @@ impl ByteLiteral { // `c_char` is already a `u8` on these arches #[cfg(any(target_arch = "aarch64", target_arch = "riscv64"))] { - input.into() + input } } _ => panic!("Not a printable ascii character!"),