From a50efe265309d0fee0661121508f77d23aecd82e Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Wed, 13 Dec 2023 09:46:21 +1100 Subject: [PATCH] Unify single-char and multi-char `CStrUnit::Char` handling. The two cases are equivalent. C string literals aren't common so there is no performance need here. --- compiler/rustc_ast/src/util/literal.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/compiler/rustc_ast/src/util/literal.rs b/compiler/rustc_ast/src/util/literal.rs index 76ddb6a3938..92b9adf1db7 100644 --- a/compiler/rustc_ast/src/util/literal.rs +++ b/compiler/rustc_ast/src/util/literal.rs @@ -161,7 +161,6 @@ impl LitKind { error = Err(LitError::NulInCStr(span)); } Ok(CStrUnit::Byte(b)) => buf.push(b), - Ok(CStrUnit::Char(c)) if c.len_utf8() == 1 => buf.push(c as u8), Ok(CStrUnit::Char(c)) => { buf.extend_from_slice(c.encode_utf8(&mut [0; 4]).as_bytes()) }