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

@@ -584,7 +584,7 @@ pub(super) enum SubdiagnosticKind {
suggestion_kind: SuggestionKind,
applicability: SpannedOption<Applicability>,
/// Identifier for variable used for formatted code, e.g. `___code_0`. Enables separation
/// of formatting and diagnostic emission so that `set_arg` calls can happen in-between..
/// of formatting and diagnostic emission so that `arg` calls can happen in-between..
code_field: syn::Ident,
/// Initialization logic for `code_field`'s variable, e.g.
/// `let __formatted_code = /* whatever */;`
@@ -863,9 +863,9 @@ impl quote::IdentFragment for SubdiagnosticKind {
}
}
/// Returns `true` if `field` should generate a `set_arg` call rather than any other diagnostic
/// Returns `true` if `field` should generate a `arg` call rather than any other diagnostic
/// call (like `span_label`).
pub(super) fn should_generate_set_arg(field: &Field) -> bool {
pub(super) fn should_generate_arg(field: &Field) -> bool {
// Perhaps this should be an exhaustive list...
field.attrs.iter().all(|attr| is_doc_comment(attr))
}