diff options
| author | bors <bors@rust-lang.org> | 2023-01-26 12:44:47 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-01-26 12:44:47 +0000 |
| commit | 3e977638728922d3a6cc7bea34a2fdb8ae97f7c0 (patch) | |
| tree | ccf38bab26084eb37c133e60987ba7bd4318ec9b /src/tools/clippy/clippy_lints | |
| parent | 40fda7b3fe2b10c6e1a0568b59516f5e7f381886 (diff) | |
| parent | db731e42b3c139587cd7a87acaa92cd82ab8a11c (diff) | |
| download | rust-3e977638728922d3a6cc7bea34a2fdb8ae97f7c0.tar.gz rust-3e977638728922d3a6cc7bea34a2fdb8ae97f7c0.zip | |
Auto merge of #106745 - m-ou-se:format-args-ast, r=oli-obk
Move format_args!() into AST (and expand it during AST lowering) Implements https://github.com/rust-lang/compiler-team/issues/541 This moves FormatArgs from rustc_builtin_macros to rustc_ast_lowering. For now, the end result is the same. But this allows for future changes to do smarter things with format_args!(). It also allows Clippy to directly access the ast::FormatArgs, making things a lot easier. This change turns the format args types into lang items. The builtin macro used to refer to them by their path. After this change, the path is no longer relevant, making it easier to make changes in `core`. This updates clippy to use the new language items, but this doesn't yet make clippy use the ast::FormatArgs structure that's now available. That should be done after this is merged.
Diffstat (limited to 'src/tools/clippy/clippy_lints')
| -rw-r--r-- | src/tools/clippy/clippy_lints/src/format_args.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/tools/clippy/clippy_lints/src/format_args.rs b/src/tools/clippy/clippy_lints/src/format_args.rs index 043112bbc95..70a80d40f46 100644 --- a/src/tools/clippy/clippy_lints/src/format_args.rs +++ b/src/tools/clippy/clippy_lints/src/format_args.rs @@ -7,14 +7,14 @@ use clippy_utils::macros::{ }; use clippy_utils::msrvs::{self, Msrv}; use clippy_utils::source::snippet_opt; -use clippy_utils::ty::{implements_trait, is_type_diagnostic_item}; +use clippy_utils::ty::{implements_trait, is_type_lang_item}; use if_chain::if_chain; use itertools::Itertools; use rustc_errors::{ Applicability, SuggestionStyle::{CompletelyHidden, ShowCode}, }; -use rustc_hir::{Expr, ExprKind, HirId, QPath}; +use rustc_hir::{Expr, ExprKind, HirId, LangItem, QPath}; use rustc_lint::{LateContext, LateLintPass, LintContext}; use rustc_middle::ty::adjustment::{Adjust, Adjustment}; use rustc_middle::ty::Ty; @@ -237,7 +237,7 @@ fn check_unused_format_specifier(cx: &LateContext<'_>, arg: &FormatArg<'_>) { ); } - if is_type_diagnostic_item(cx, param_ty, sym::Arguments) && !arg.format.is_default_for_trait() { + if is_type_lang_item(cx, param_ty, LangItem::FormatArguments) && !arg.format.is_default_for_trait() { span_lint_and_then( cx, UNUSED_FORMAT_SPECS, |
