Use DiagnosticMessage for BufferedEarlyLint.msg
This commit is contained in:
parent
d6fdf14eb7
commit
80451de390
@ -1176,7 +1176,7 @@ fn create_lints_for_named_arguments_used_positionally(cx: &mut Context<'_, '_>)
|
||||
|
||||
cx.ecx.buffered_early_lint.push(BufferedEarlyLint {
|
||||
span: MultiSpan::from_span(named_arg.positional_named_arg_span),
|
||||
msg: msg.clone(),
|
||||
msg: msg.clone().into(),
|
||||
node_id: ast::CRATE_NODE_ID,
|
||||
lint_id: LintId::of(&NAMED_ARGUMENTS_USED_POSITIONALLY),
|
||||
diagnostic: BuiltinLintDiagnostics::NamedArgumentUsedPositionally {
|
||||
|
@ -45,7 +45,7 @@ impl<'a, T: EarlyLintPass> EarlyContextAndPass<'a, T> {
|
||||
lint_id.lint,
|
||||
Some(span),
|
||||
|lint| {
|
||||
lint.build(&msg).emit();
|
||||
lint.build(msg).emit();
|
||||
},
|
||||
diagnostic,
|
||||
);
|
||||
|
@ -9,7 +9,7 @@ pub use self::Level::*;
|
||||
use rustc_ast::node_id::{NodeId, NodeMap};
|
||||
use rustc_ast::{AttrId, Attribute};
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher, ToStableHashKey};
|
||||
use rustc_error_messages::MultiSpan;
|
||||
use rustc_error_messages::{MultiSpan, DiagnosticMessage};
|
||||
use rustc_hir::HashStableContext;
|
||||
use rustc_hir::HirId;
|
||||
use rustc_span::edition::Edition;
|
||||
@ -491,7 +491,7 @@ pub struct BufferedEarlyLint {
|
||||
pub span: MultiSpan,
|
||||
|
||||
/// The lint message.
|
||||
pub msg: String,
|
||||
pub msg: DiagnosticMessage,
|
||||
|
||||
/// The `NodeId` of the AST node that generated the lint.
|
||||
pub node_id: NodeId,
|
||||
@ -520,11 +520,11 @@ impl LintBuffer {
|
||||
lint: &'static Lint,
|
||||
node_id: NodeId,
|
||||
span: MultiSpan,
|
||||
msg: &str,
|
||||
msg: impl Into<DiagnosticMessage>,
|
||||
diagnostic: BuiltinLintDiagnostics,
|
||||
) {
|
||||
let lint_id = LintId::of(lint);
|
||||
let msg = msg.to_string();
|
||||
let msg = msg.into();
|
||||
self.add_early_lint(BufferedEarlyLint { lint_id, node_id, span, msg, diagnostic });
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user