Skip to content

Commit 870ed72

Browse files
authored
Rollup merge of rust-lang#100018 - nnethercote:clean-up-LitKind, r=petrochenkov
Clean up `LitKind` r? ``@petrochenkov``
2 parents e97825e + e5b5f56 commit 870ed72

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/expr.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ pub(crate) fn format_expr(
7979
if let Some(expr_rw) = rewrite_literal(context, l, shape) {
8080
Some(expr_rw)
8181
} else {
82-
if let LitKind::StrRaw(_) = l.token.kind {
82+
if let LitKind::StrRaw(_) = l.token_lit.kind {
8383
Some(context.snippet(l.span).trim().into())
8484
} else {
8585
None
@@ -1226,7 +1226,7 @@ fn rewrite_string_lit(context: &RewriteContext<'_>, span: Span, shape: Shape) ->
12261226

12271227
fn rewrite_int_lit(context: &RewriteContext<'_>, lit: &ast::Lit, shape: Shape) -> Option<String> {
12281228
let span = lit.span;
1229-
let symbol = lit.token.symbol.as_str();
1229+
let symbol = lit.token_lit.symbol.as_str();
12301230

12311231
if let Some(symbol_stripped) = symbol.strip_prefix("0x") {
12321232
let hex_lit = match context.config.hex_literal_case() {
@@ -1239,7 +1239,9 @@ fn rewrite_int_lit(context: &RewriteContext<'_>, lit: &ast::Lit, shape: Shape) -
12391239
format!(
12401240
"0x{}{}",
12411241
hex_lit,
1242-
lit.token.suffix.map_or(String::new(), |s| s.to_string())
1242+
lit.token_lit
1243+
.suffix
1244+
.map_or(String::new(), |s| s.to_string())
12431245
),
12441246
context.config.max_width(),
12451247
shape,

0 commit comments

Comments
 (0)