Rollup merge of #100018 - nnethercote:clean-up-LitKind, r=petrochenkov
Clean up `LitKind` r? ``@petrochenkov``
This commit is contained in:
commit
37eeed701a
@ -57,10 +57,10 @@ fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &Expr) {
|
||||
}
|
||||
|
||||
if let ExprKind::Lit(lit) = &expr.kind {
|
||||
if matches!(lit.token.kind, LitKind::Str) {
|
||||
check_lit(cx, &lit.token, lit.span, true);
|
||||
} else if matches!(lit.token.kind, LitKind::ByteStr) {
|
||||
check_lit(cx, &lit.token, lit.span, false);
|
||||
if matches!(lit.token_lit.kind, LitKind::Str) {
|
||||
check_lit(cx, &lit.token_lit, lit.span, true);
|
||||
} else if matches!(lit.token_lit.kind, LitKind::ByteStr) {
|
||||
check_lit(cx, &lit.token_lit, lit.span, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -589,12 +589,12 @@ fn check_tts<'a>(&self, cx: &EarlyContext<'a>, tts: TokenStream, is_write: bool)
|
||||
},
|
||||
};
|
||||
|
||||
let replacement: String = match lit.token.kind {
|
||||
let replacement: String = match lit.token_lit.kind {
|
||||
LitKind::StrRaw(_) | LitKind::ByteStrRaw(_) if matches!(fmtstr.style, StrStyle::Raw(_)) => {
|
||||
lit.token.symbol.as_str().replace('{', "{{").replace('}', "}}")
|
||||
lit.token_lit.symbol.as_str().replace('{', "{{").replace('}', "}}")
|
||||
},
|
||||
LitKind::Str | LitKind::ByteStr if matches!(fmtstr.style, StrStyle::Cooked) => {
|
||||
lit.token.symbol.as_str().replace('{', "{{").replace('}', "}}")
|
||||
lit.token_lit.symbol.as_str().replace('{', "{{").replace('}', "}}")
|
||||
},
|
||||
LitKind::StrRaw(_)
|
||||
| LitKind::Str
|
||||
@ -603,7 +603,7 @@ fn check_tts<'a>(&self, cx: &EarlyContext<'a>, tts: TokenStream, is_write: bool)
|
||||
| LitKind::Integer
|
||||
| LitKind::Float
|
||||
| LitKind::Err => continue,
|
||||
LitKind::Byte | LitKind::Char => match lit.token.symbol.as_str() {
|
||||
LitKind::Byte | LitKind::Char => match lit.token_lit.symbol.as_str() {
|
||||
"\"" if matches!(fmtstr.style, StrStyle::Cooked) => "\\\"",
|
||||
"\"" if matches!(fmtstr.style, StrStyle::Raw(0)) => continue,
|
||||
"\\\\" if matches!(fmtstr.style, StrStyle::Raw(_)) => "\\",
|
||||
@ -614,7 +614,7 @@ fn check_tts<'a>(&self, cx: &EarlyContext<'a>, tts: TokenStream, is_write: bool)
|
||||
x => x,
|
||||
}
|
||||
.into(),
|
||||
LitKind::Bool => lit.token.symbol.as_str().deref().into(),
|
||||
LitKind::Bool => lit.token_lit.symbol.as_str().deref().into(),
|
||||
};
|
||||
|
||||
if !fmt_spans.is_empty() {
|
||||
|
Loading…
Reference in New Issue
Block a user