1
Fork 0

Rename BuiltinLintDiagnostics as BuiltinLintDiag.

Not the dropping of the trailing `s` -- this type describes a single
diagnostic and its name should be singular.
This commit is contained in:
Nicholas Nethercote 2024-02-29 16:40:44 +11:00
parent d98ad0a181
commit 7aa0eea19c
23 changed files with 105 additions and 113 deletions

View file

@ -1603,9 +1603,10 @@ impl<'a> TraitDef<'a> {
// Once use of `icu4x-0.9.0` has dropped sufficiently, this
// exception should be removed.
let is_simple_path = |ty: &P<ast::Ty>, sym| {
if let TyKind::Path(None, ast::Path { segments, .. }) = &ty.kind &&
let [seg] = segments.as_slice() &&
seg.ident.name == sym && seg.args.is_none()
if let TyKind::Path(None, ast::Path { segments, .. }) = &ty.kind
&& let [seg] = segments.as_slice()
&& seg.ident.name == sym
&& seg.args.is_none()
{
true
} else {
@ -1613,8 +1614,8 @@ impl<'a> TraitDef<'a> {
}
};
let exception = if let TyKind::Slice(ty) = &struct_field.ty.kind &&
is_simple_path(ty, sym::u8)
let exception = if let TyKind::Slice(ty) = &struct_field.ty.kind
&& is_simple_path(ty, sym::u8)
{
Some("byte")
} else if is_simple_path(&struct_field.ty, sym::str) {
@ -1631,7 +1632,7 @@ impl<'a> TraitDef<'a> {
format!(
"{ty} slice in a packed struct that derives a built-in trait"
),
rustc_lint_defs::BuiltinLintDiagnostics::ByteSliceInPackedStructWithDerive
rustc_lint_defs::BuiltinLintDiag::ByteSliceInPackedStructWithDerive,
);
} else {
// Wrap the expression in `{...}`, causing a copy.

View file

@ -16,7 +16,7 @@ use rustc_span::symbol::{Ident, Symbol};
use rustc_span::{BytePos, ErrorGuaranteed, InnerSpan, Span};
use rustc_lint_defs::builtin::NAMED_ARGUMENTS_USED_POSITIONALLY;
use rustc_lint_defs::{BufferedEarlyLint, BuiltinLintDiagnostics, LintId};
use rustc_lint_defs::{BufferedEarlyLint, BuiltinLintDiag, LintId};
// The format_args!() macro is expanded in three steps:
// 1. First, `parse_args` will parse the `(literal, arg, arg, name=arg, name=arg)` syntax,
@ -553,7 +553,7 @@ fn make_format_args(
msg: format!("named argument `{}` is not used by name", arg_name.name).into(),
node_id: rustc_ast::CRATE_NODE_ID,
lint_id: LintId::of(NAMED_ARGUMENTS_USED_POSITIONALLY),
diagnostic: BuiltinLintDiagnostics::NamedArgumentUsedPositionally {
diagnostic: BuiltinLintDiag::NamedArgumentUsedPositionally {
position_sp_to_replace,
position_sp_for_msg,
named_arg_sp: arg_name.span,