diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-08-17 12:32:49 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-17 12:32:49 +0200 |
| commit | d5dca26a94437d9b2c2d37cd515f2ac32c30919b (patch) | |
| tree | 4145261e4bd8e70cd79e7422f507c5684ee42eb4 /src/tools/rustfmt | |
| parent | bb77336c0a6708bdebcbf3a1df19b258919b582e (diff) | |
| parent | 5d3cc1713a8816e3b4f10dc2cbaf910b16dc8763 (diff) | |
| download | rust-d5dca26a94437d9b2c2d37cd515f2ac32c30919b.tar.gz rust-d5dca26a94437d9b2c2d37cd515f2ac32c30919b.zip | |
Rollup merge of #100018 - nnethercote:clean-up-LitKind, r=petrochenkov
Clean up `LitKind` r? ``@petrochenkov``
Diffstat (limited to 'src/tools/rustfmt')
| -rw-r--r-- | src/tools/rustfmt/src/expr.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/tools/rustfmt/src/expr.rs b/src/tools/rustfmt/src/expr.rs index a7b73ba78c5..3105882e2d3 100644 --- a/src/tools/rustfmt/src/expr.rs +++ b/src/tools/rustfmt/src/expr.rs @@ -79,7 +79,7 @@ pub(crate) fn format_expr( if let Some(expr_rw) = rewrite_literal(context, l, shape) { Some(expr_rw) } else { - if let LitKind::StrRaw(_) = l.token.kind { + if let LitKind::StrRaw(_) = l.token_lit.kind { Some(context.snippet(l.span).trim().into()) } else { None @@ -1226,7 +1226,7 @@ fn rewrite_string_lit(context: &RewriteContext<'_>, span: Span, shape: Shape) -> fn rewrite_int_lit(context: &RewriteContext<'_>, lit: &ast::Lit, shape: Shape) -> Option<String> { let span = lit.span; - let symbol = lit.token.symbol.as_str(); + let symbol = lit.token_lit.symbol.as_str(); if let Some(symbol_stripped) = symbol.strip_prefix("0x") { let hex_lit = match context.config.hex_literal_case() { @@ -1239,7 +1239,9 @@ fn rewrite_int_lit(context: &RewriteContext<'_>, lit: &ast::Lit, shape: Shape) - format!( "0x{}{}", hex_lit, - lit.token.suffix.map_or(String::new(), |s| s.to_string()) + lit.token_lit + .suffix + .map_or(String::new(), |s| s.to_string()) ), context.config.max_width(), shape, |
