Rollup merge of #99480 - miam-miam100:arg-format, r=oli-obk
Diagnostic width span is not added when '0$' is used as width in format strings When the following code is run rustc does not add diagnostic spans for the width argument. Such spans are necessary for a clippy lint that I am currently writing. ```rust println!("Hello {1:0$}!", 5, "x"); // ^^ // Should have a span here ```
This commit is contained in:
commit
9e197b75f0
5 changed files with 36 additions and 4 deletions
|
@ -485,7 +485,7 @@ impl<'a, 'b> Context<'a, 'b> {
|
|||
if let Some(span) = fmt.width_span {
|
||||
let span = self.fmtsp.from_inner(InnerSpan::new(span.start, span.end));
|
||||
match fmt.width {
|
||||
parse::CountIsParam(pos) if pos > self.num_args() => {
|
||||
parse::CountIsParam(pos) if pos >= self.num_args() => {
|
||||
e.span_label(
|
||||
span,
|
||||
&format!(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue