Rename DiagnosticBuilder as Diag.

Much better!

Note that this involves renaming (and updating the value of)
`DIAGNOSTIC_BUILDER` in clippy.
This commit is contained in:
Nicholas Nethercote 2024-02-23 10:20:45 +11:00
parent 4e1f9bd528
commit 899cb40809
153 changed files with 1136 additions and 1367 deletions

View file

@ -1,6 +1,6 @@
use super::UnmatchedDelim;
use rustc_ast::token::Delimiter;
use rustc_errors::DiagnosticBuilder;
use rustc_errors::Diag;
use rustc_span::source_map::SourceMap;
use rustc_span::Span;
@ -30,10 +30,7 @@ pub fn same_indentation_level(sm: &SourceMap, open_sp: Span, close_sp: Span) ->
// When we get a `)` or `]` for `{`, we should emit help message here
// it's more friendly compared to report `unmatched error` in later phase
pub fn report_missing_open_delim(
err: &mut DiagnosticBuilder<'_>,
unmatched_delims: &[UnmatchedDelim],
) -> bool {
pub fn report_missing_open_delim(err: &mut Diag<'_>, unmatched_delims: &[UnmatchedDelim]) -> bool {
let mut reported_missing_open = false;
for unmatch_brace in unmatched_delims.iter() {
if let Some(delim) = unmatch_brace.found_delim
@ -55,7 +52,7 @@ pub fn report_missing_open_delim(
}
pub fn report_suspicious_mismatch_block(
err: &mut DiagnosticBuilder<'_>,
err: &mut Diag<'_>,
diag_info: &TokenTreeDiagInfo,
sm: &SourceMap,
delim: Delimiter,

View file

@ -7,7 +7,7 @@ use rustc_ast::ast::{self, AttrStyle};
use rustc_ast::token::{self, CommentKind, Delimiter, IdentIsRaw, Token, TokenKind};
use rustc_ast::tokenstream::TokenStream;
use rustc_ast::util::unicode::contains_text_flow_control_chars;
use rustc_errors::{codes::*, Applicability, DiagCtxt, DiagnosticBuilder, StashKey};
use rustc_errors::{codes::*, Applicability, Diag, DiagCtxt, StashKey};
use rustc_lexer::unescape::{self, EscapeError, Mode};
use rustc_lexer::{Base, DocStyle, RawStrError};
use rustc_lexer::{Cursor, LiteralKind};
@ -47,7 +47,7 @@ pub(crate) fn parse_token_trees<'sess, 'src>(
mut src: &'src str,
mut start_pos: BytePos,
override_span: Option<Span>,
) -> Result<TokenStream, Vec<DiagnosticBuilder<'sess>>> {
) -> Result<TokenStream, Vec<Diag<'sess>>> {
// Skip `#!`, if present.
if let Some(shebang_len) = rustc_lexer::strip_shebang(src) {
src = &src[shebang_len..];