1
Fork 0

Use identifiers in diagnostics more often

This commit is contained in:
Michael Goulet 2025-01-27 01:16:12 +00:00
parent f85c6de552
commit ac1c6c50f4
21 changed files with 83 additions and 72 deletions

View file

@ -141,7 +141,7 @@ fn lint_expr(cx: &LateContext<'_>, expr: &Expr<'_>) {
expr.hir_id,
method.ident.span,
DanglingPointersFromTemporaries {
callee: method.ident.name,
callee: method.ident,
ty,
ptr_span: method.ident.span,
temporary_span: receiver.span,

View file

@ -1132,7 +1132,7 @@ pub(crate) struct IgnoredUnlessCrateSpecified<'a> {
#[help(lint_help_visit)]
// FIXME: put #[primary_span] on `ptr_span` once it does not cause conflicts
pub(crate) struct DanglingPointersFromTemporaries<'tcx> {
pub callee: Symbol,
pub callee: Ident,
pub ty: Ty<'tcx>,
#[label(lint_label_ptr)]
pub ptr_span: Span,
@ -1333,7 +1333,7 @@ pub(crate) enum NonUpperCaseGlobalSub {
#[diag(lint_noop_method_call)]
#[note]
pub(crate) struct NoopMethodCallDiag<'a> {
pub method: Symbol,
pub method: Ident,
pub orig_ty: Ty<'a>,
pub trait_: Symbol,
#[suggestion(code = "", applicability = "machine-applicable")]

View file

@ -129,7 +129,7 @@ impl<'tcx> LateLintPass<'tcx> for NoopMethodCall {
_ => None,
};
cx.emit_span_lint(NOOP_METHOD_CALL, span, NoopMethodCallDiag {
method: call.ident.name,
method: call.ident,
orig_ty,
trait_,
label: span,