Rename some Diagnostic setters.

`Diagnostic` has 40 methods that return `&mut Self` and could be
considered setters. Four of them have a `set_` prefix. This doesn't seem
necessary for a type that implements the builder pattern. This commit
removes the `set_` prefixes on those four methods.
This commit is contained in:
Nicholas Nethercote 2023-12-24 09:08:41 +11:00
parent e51e98dde6
commit 505c1371d0
53 changed files with 274 additions and 281 deletions

View file

@ -174,7 +174,7 @@ impl<'a> Parser<'a> {
) {
Ok(Some(item)) => {
// FIXME(#100717)
err.set_arg("item", item.kind.descr());
err.arg("item", item.kind.descr());
err.span_label(item.span, fluent::parse_label_does_not_annotate_this);
err.span_suggestion_verbose(
replacement_span,

View file

@ -846,7 +846,7 @@ impl<'a> Parser<'a> {
) =>
{
let n_hashes: u8 = *n_hashes;
err.set_primary_message("too many `#` when terminating raw string");
err.primary_message("too many `#` when terminating raw string");
let str_span = self.prev_token.span;
let mut span = self.token.span;
let mut count = 0;
@ -857,7 +857,7 @@ impl<'a> Parser<'a> {
self.bump();
count += 1;
}
err.set_span(span);
err.span(span);
err.span_suggestion(
span,
format!("remove the extra `#`{}", pluralize!(count)),

View file

@ -925,9 +925,8 @@ impl<'a> Parser<'a> {
});
}
expect_err.set_primary_message(
"closure bodies that contain statements must be surrounded by braces",
);
expect_err
.primary_message("closure bodies that contain statements must be surrounded by braces");
let preceding_pipe_span = closure_spans.closing_pipe;
let following_token_span = self.token.span;
@ -951,7 +950,7 @@ impl<'a> Parser<'a> {
);
expect_err.span_note(second_note, "the closure body may be incorrectly delimited");
expect_err.set_span(vec![preceding_pipe_span, following_token_span]);
expect_err.span(vec![preceding_pipe_span, following_token_span]);
let opening_suggestion_str = " {".to_string();
let closing_suggestion_str = "}".to_string();