Files
rust/clippy_lints/src/write/use_debug.rs
T
2025-10-31 17:40:14 +01:00

19 lines
566 B
Rust

use clippy_utils::diagnostics::span_lint;
use rustc_ast::{FormatArgs, FormatArgsPiece, FormatPlaceholder, FormatTrait};
use rustc_lint::LateContext;
use super::USE_DEBUG;
pub(super) fn check(cx: &LateContext<'_>, format_args: &FormatArgs) {
for piece in &format_args.template {
if let &FormatArgsPiece::Placeholder(FormatPlaceholder {
span: Some(span),
format_trait: FormatTrait::Debug,
..
}) = piece
{
span_lint(cx, USE_DEBUG, span, "use of `Debug`-based formatting");
}
}
}