Skip to content

Commit

Permalink
Auto merge of rust-lang#9598 - nyurik:fix-comment, r=Alexendoo
Browse files Browse the repository at this point in the history
lint: fix a few comments

minor cleanup per `@Alexendoo` [comment](rust-lang/rust-clippy#9586 (comment))

changelog: none
  • Loading branch information
bors committed Oct 6, 2022
2 parents ac0e10a + c251f8d commit 45343e2
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
12 changes: 0 additions & 12 deletions clippy_lints/src/format_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,18 +173,6 @@ fn check_uninlined_args(cx: &LateContext<'_>, args: &FormatArgsExpn<'_>, call_si
return;
}

// FIXME: Properly ignore a rare case where the format string is wrapped in a macro.
// Example: `format!(indoc!("{}"), foo);`
// If inlined, they will cause a compilation error:
// > to avoid ambiguity, `format_args!` cannot capture variables
// > when the format string is expanded from a macro
// @Alexendoo explanation:
// > indoc! is a proc macro that is producing a string literal with its span
// > set to its input it's not marked as from expansion, and since it's compatible
// > tokenization wise clippy_utils::is_from_proc_macro wouldn't catch it either
// This might be a relatively expensive test, so do it only we are ready to replace.
// See more examples in tests/ui/uninlined_format_args.rs

span_lint_and_then(
cx,
UNINLINED_FORMAT_ARGS,
Expand Down
2 changes: 1 addition & 1 deletion clippy_utils/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ impl FormatString {

struct FormatArgsValues<'tcx> {
/// Values passed after the format string and implicit captures. `[1, z + 2, x]` for
/// `format!("{x} {} {y}", 1, z + 2)`.
/// `format!("{x} {} {}", 1, z + 2)`.
value_args: Vec<&'tcx Expr<'tcx>>,
/// Maps an `rt::v1::Argument::position` or an `rt::v1::Count::Param` to its index in
/// `value_args`
Expand Down

0 comments on commit 45343e2

Please sign in to comment.