diff options
| author | bjorn3 <bjorn3@users.noreply.github.com> | 2022-04-29 18:48:58 +0200 |
|---|---|---|
| committer | bjorn3 <bjorn3@users.noreply.github.com> | 2022-05-03 11:26:58 +0200 |
| commit | 34760560ed8b1462b5dd0604fee5bd8dc071a6eb (patch) | |
| tree | dd8caeeafde6397b9c9cb43b120b4ea5cdc3d95f | |
| parent | 5ffe8a1a9049c58501132a07f1567605acff4541 (diff) | |
| download | rust-34760560ed8b1462b5dd0604fee5bd8dc071a6eb.tar.gz rust-34760560ed8b1462b5dd0604fee5bd8dc071a6eb.zip | |
Make rustc_parse_format compile on stable
This allows it to be used by lightweight formatting systems and may allow it to be used by rust-analyzer.
| -rw-r--r-- | clippy_lints/src/write.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/clippy_lints/src/write.rs b/clippy_lints/src/write.rs index f3d818cc348..54b93a20a05 100644 --- a/clippy_lints/src/write.rs +++ b/clippy_lints/src/write.rs @@ -13,7 +13,7 @@ use rustc_lint::{EarlyContext, EarlyLintPass, LintContext}; use rustc_parse::parser; use rustc_session::{declare_tool_lint, impl_lint_pass}; use rustc_span::symbol::{kw, Symbol}; -use rustc_span::{sym, BytePos, Span, DUMMY_SP}; +use rustc_span::{sym, BytePos, InnerSpan, Span, DUMMY_SP}; declare_clippy_lint! { /// ### What it does @@ -454,6 +454,7 @@ impl SimpleFormatArgs { } }, ArgumentNamed(n, _) => { + let n = Symbol::intern(n); if let Some(x) = self.named.iter_mut().find(|x| x.0 == n) { match x.1.as_slice() { // A non-empty format string has been seen already. @@ -495,7 +496,7 @@ impl Write { let span = parser .arg_places .last() - .map_or(DUMMY_SP, |&x| str_lit.span.from_inner(x)); + .map_or(DUMMY_SP, |&x| str_lit.span.from_inner(InnerSpan::new(x.start, x.end))); if !self.in_debug_impl && arg.format.ty == "?" { // FIXME: modify rustc's fmt string parser to give us the current span |
