-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate format_args!() lints to to ast::FormatArgs #10233
Comments
Nice to see it merged, I'll take a look some time in the next few days |
Congratulations on merging!!! It only took 2 (?) weeks - kinda fast :) I would be very happy to participate, but don't have as good of the AST/HIR understanding as @Alexendoo, but will be happy to review and participate as much as possible. |
I've added a to do list above with the list of lints to migrate. I'll see if I can migrate some of them soon, because this issue is now blocking rust-lang/rust#106824 |
I've got
I'll open a PR for that soon-ish, just figuring out the nicest way of carrying over the AST parts in a way that's easily shared with other modules |
Nice! |
Opened ☝️ |
Don't depend on FormatArgsExpn in ManualAssert. Part of #10233 changelog: none
Is there anything I can do to move this forward? I think most (all) of the remaining lints are blocked on #10275? |
Migrate `write.rs` to `rustc_ast::FormatArgs` changelog: none Part 1 of #10233 The additions to `clippy_utils` are the main novelty of this PR, there's no removals yet since other parts still rely on `FormatArgsExpn` The changes to `write.rs` itself are relatively straightforward this time around, as there's no lints in it that rely on type checking format params r? `@flip1995`
Migrate `write.rs` to `rustc_ast::FormatArgs` changelog: none Part 1 of #10233 The additions to `clippy_utils` are the main novelty of this PR, there's no removals yet since other parts still rely on `FormatArgsExpn` The changes to `write.rs` itself are relatively straightforward this time around, as there's no lints in it that rely on type checking format params r? `@flip1995`
I'll take a look at the |
@Alexendoo are you address all of format-args users in rust-clippy? Anything I can help with? |
For the ones that don't need access to any hir I'll keep going until it's all migrated, hopefully after |
Opened: #10484 |
Migrate `format_args.rs` to `rustc_ast::FormatArgs` changelog: none Part of #10233 Empty precision specifiers are no longer linted as the span for that isn't present in [`FormatOptions`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_ast/format/struct.FormatOptions.html) ```rust format!("{:.}", ...) ``` That could be fixed later with some hackery or a change upstream r? `@flip1995`
There we are, #10561 takes care of the last bunch and was a bit more straight forward than the others |
Now that rust-lang/rust#106745 is merged, Clippy has access to the original parsed/processed format_args!() invocation. This hopefully means that Clippy no longer needs to do anything that depends on the exact expansion of format_args!() and implementation details of fmt::Arguments (which will undergo changes in the (near!) future).
Details:
As of rust-lang/rust#106745, the
format_args!()
builtin macro expands to a specialast::FormatArgs
AST node, which contains nothing that is specific to the standard library'sfmt::Arguments
implementation. During AST lowering, this node is expanded into HIR that is specific to howfmt::Arguments
is implemented, and will change in the (near) future.)Clippy's format_args lints are currently done in late passes that use the HIR. They should be changed to use the information from ast::FormatArgs instead. (Ideally by making them early passes, but that might not always be possible.)
This is part of rust-lang/rust#99012
Lints to migrate:
write.rs
torustc_ast::FormatArgs
#10275format_args.rs
torustc_ast::FormatArgs
#10484FormatArgsExpn
#10561PanicExpn::Format
The text was updated successfully, but these errors were encountered: