fix(render): only output SPACE for strings that are just a space

This commit is contained in:
Amaan Qureshi 2023-08-16 13:44:44 -04:00
parent 28b831456e
commit e0434327d0
No known key found for this signature in database
GPG key ID: E67890ADC4227273

View file

@ -1538,7 +1538,7 @@ impl Generator {
} else {
'special_chars: {
let replacement = match c {
' ' => "SPACE",
' ' if name.len() == 1 => "SPACE",
'~' => "TILDE",
'`' => "BQUOTE",
'!' => "BANG",
@ -1613,6 +1613,7 @@ impl Generator {
break 'special_chars;
}
'0'..='9' | 'a'..='z' | 'A'..='Z' | '_' => unreachable!(),
' ' => break 'special_chars,
};
if !result.is_empty() && !result.ends_with("_") {
result.push('_');