Skip to content

Migrate format_args!() lints to to ast::FormatArgs #10233

@m-ou-se

Description

@m-ou-se

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 special ast::FormatArgs AST node, which contains nothing that is specific to the standard library's fmt::Arguments implementation. During AST lowering, this node is expanded into HIR that is specific to how fmt::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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions