Rollup merge of #100018 - nnethercote:clean-up-LitKind, r=petrochenkov
Clean up `LitKind` r? ``@petrochenkov``
This commit is contained in:
commit
37eeed701a
2 changed files with 9 additions and 9 deletions
|
|
@ -57,10 +57,10 @@ impl EarlyLintPass for OctalEscapes {
|
|||
}
|
||||
|
||||
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 @@ impl Write {
|
|||
},
|
||||
};
|
||||
|
||||
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 @@ impl Write {
|
|||
| 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 @@ impl Write {
|
|||
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…
Add table
Add a link
Reference in a new issue