about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2023-12-13 09:46:21 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2023-12-13 10:06:13 +1100
commita50efe265309d0fee0661121508f77d23aecd82e (patch)
tree45f517066a6fb7d549d5b1be4c4ef40a1b30faed
parent29c5158ef5772351475d650ffbee417b36885766 (diff)
downloadrust-a50efe265309d0fee0661121508f77d23aecd82e.tar.gz
rust-a50efe265309d0fee0661121508f77d23aecd82e.zip
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.
-rw-r--r--compiler/rustc_ast/src/util/literal.rs1
1 files changed, 0 insertions, 1 deletions
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())
                     }