Rollup merge of #89483 - hkmatsumoto:patch-diagnostics-2, r=estebank

Practice diagnostic message convention

Detected by #89455.

r? ```@estebank```
This commit is contained in:
Jubilee 2021-10-04 13:58:15 -07:00 committed by GitHub
commit 5352e17df3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
63 changed files with 167 additions and 168 deletions

View file

@ -124,7 +124,7 @@ impl<'tcx> LateLintPass<'tcx> for ArrayIntoIter {
let mut diag = lint.build(&format!(
"this method call resolves to `<&{} as IntoIterator>::into_iter` \
(due to backwards compatibility), \
but will resolve to <{} as IntoIterator>::into_iter in Rust 2021.",
but will resolve to <{} as IntoIterator>::into_iter in Rust 2021",
target, target,
));
diag.span_suggestion(

View file

@ -918,7 +918,7 @@ impl EarlyLintPass for AnonymousParameters {
lint.build(
"anonymous parameters are deprecated and will be \
removed in the next edition.",
removed in the next edition",
)
.span_suggestion(
arg.pat.span,
@ -1629,9 +1629,9 @@ impl<'tcx> LateLintPass<'tcx> for TrivialConstraints {
let predicates = cx.tcx.predicates_of(item.def_id);
for &(predicate, span) in predicates.predicates {
let predicate_kind_name = match predicate.kind().skip_binder() {
Trait(..) => "Trait",
Trait(..) => "trait",
TypeOutlives(..) |
RegionOutlives(..) => "Lifetime",
RegionOutlives(..) => "lifetime",
// Ignore projections, as they can only be global
// if the trait bound is global

View file

@ -331,9 +331,9 @@ impl EarlyLintPass for NonAsciiIdents {
for ((sp, ch_list), script_set) in lint_reports {
cx.struct_span_lint(MIXED_SCRIPT_CONFUSABLES, sp, |lint| {
let message = format!(
"The usage of Script Group `{}` in this crate consists solely of mixed script confusables",
"the usage of Script Group `{}` in this crate consists solely of mixed script confusables",
script_set);
let mut note = "The usage includes ".to_string();
let mut note = "the usage includes ".to_string();
for (idx, ch) in ch_list.into_iter().enumerate() {
if idx != 0 {
note += ", ";
@ -341,8 +341,7 @@ impl EarlyLintPass for NonAsciiIdents {
let char_info = format!("'{}' (U+{:04X})", ch, ch as u32);
note += &char_info;
}
note += ".";
lint.build(&message).note(&note).note("Please recheck to make sure their usages are indeed what you want.").emit()
lint.build(&message).note(&note).note("please recheck to make sure their usages are indeed what you want").emit()
});
}
}