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.
This commit is contained in:
parent
29c5158ef5
commit
a50efe2653
1 changed files with 0 additions and 1 deletions
|
@ -161,7 +161,6 @@ impl LitKind {
|
||||||
error = Err(LitError::NulInCStr(span));
|
error = Err(LitError::NulInCStr(span));
|
||||||
}
|
}
|
||||||
Ok(CStrUnit::Byte(b)) => buf.push(b),
|
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)) => {
|
Ok(CStrUnit::Char(c)) => {
|
||||||
buf.extend_from_slice(c.encode_utf8(&mut [0; 4]).as_bytes())
|
buf.extend_from_slice(c.encode_utf8(&mut [0; 4]).as_bytes())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue