Skip to content

Commit 8be86fc

Browse files
committed
Auto merge of rust-lang#96558 - bjorn3:librarify_parse_format, r=davidtwco
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.
2 parents 8172166 + 3476056 commit 8be86fc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

clippy_lints/src/write.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use rustc_lint::{EarlyContext, EarlyLintPass, LintContext};
1313
use rustc_parse::parser;
1414
use rustc_session::{declare_tool_lint, impl_lint_pass};
1515
use rustc_span::symbol::{kw, Symbol};
16-
use rustc_span::{sym, BytePos, Span, DUMMY_SP};
16+
use rustc_span::{sym, BytePos, InnerSpan, Span, DUMMY_SP};
1717

1818
declare_clippy_lint! {
1919
/// ### What it does
@@ -454,6 +454,7 @@ impl SimpleFormatArgs {
454454
}
455455
},
456456
ArgumentNamed(n, _) => {
457+
let n = Symbol::intern(n);
457458
if let Some(x) = self.named.iter_mut().find(|x| x.0 == n) {
458459
match x.1.as_slice() {
459460
// A non-empty format string has been seen already.
@@ -495,7 +496,7 @@ impl Write {
495496
let span = parser
496497
.arg_places
497498
.last()
498-
.map_or(DUMMY_SP, |&x| str_lit.span.from_inner(x));
499+
.map_or(DUMMY_SP, |&x| str_lit.span.from_inner(InnerSpan::new(x.start, x.end)));
499500

500501
if !self.in_debug_impl && arg.format.ty == "?" {
501502
// FIXME: modify rustc's fmt string parser to give us the current span

0 commit comments

Comments
 (0)