Rollup merge of #99987 - Alexendoo:parse-format-position-span, r=fee1-dead

Always include a position span in `rustc_parse_format::Argument`

Moves the spans from the `Position` enum to always be included in the `Argument` struct. Doesn't make any changes to use it in rustc, but it will be useful for some upcoming Clippy lints
This commit is contained in:
Matthias Krüger 2022-08-02 17:17:30 +02:00 committed by GitHub
commit 4546f5d1dc

View File

@ -441,7 +441,7 @@ fn push(&mut self, arg: rustc_parse_format::Argument<'_>, span: Span) {
};
match arg.position {
ArgumentIs(n, _) | ArgumentImplicitlyIs(n) => {
ArgumentIs(n) | ArgumentImplicitlyIs(n) => {
if self.unnamed.len() <= n {
// Use a dummy span to mark all unseen arguments.
self.unnamed.resize_with(n, || vec![DUMMY_SP]);
@ -462,7 +462,7 @@ fn push(&mut self, arg: rustc_parse_format::Argument<'_>, span: Span) {
}
}
},
ArgumentNamed(n, _) => {
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() {