Description
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:
- ManualAssert - MANUAL_ASSERT: Don't depend on FormatArgsExpn in ManualAssert. #10276
- Write: Migrate
write.rs
torustc_ast::FormatArgs
#10275- PRINT_WITH_NEWLINE
- PRINTLN_EMPTY_STRING
- PRINT_STDOUT
- PRINT_STDERR
- USE_DEBUG
- PRINT_LITERAL
- WRITE_WITH_NEWLINE
- WRITELN_EMPTY_STRING
- WRITE_LITERAL
- FormatArgs: Migrate
format_args.rs
torustc_ast::FormatArgs
#10484- FORMAT_IN_FORMAT_ARGS
- TO_STRING_IN_FORMAT_ARGS
- UNINLINED_FORMAT_ARGS
- UNUSED_FORMAT_SPECS
- Replace remaining usage of
FormatArgsExpn
#10561- FormatImpl
- RECURSIVE_FORMAT_IMPL
- PRINT_IN_FORMAT_IMPL
- ExplicitWrite - EXPLICIT_WRITE
- UselessFormat - USELESS_FORMAT
- Methods - EXPECT_FUN_CALL
-
PanicExpn::Format
- FormatImpl