};
use rustc_ast_pretty::pprust;
use rustc_data_structures::fx::FxHashSet;
-use rustc_errors::{pluralize, struct_span_err};
+use rustc_errors::{pluralize, struct_span_err, Diagnostic};
use rustc_errors::{Applicability, DiagnosticBuilder, Handler, PResult};
use rustc_span::source_map::Spanned;
use rustc_span::symbol::{kw, Ident};
Err(err)
}
- fn check_too_many_raw_str_terminators(&mut self, err: &mut DiagnosticBuilder<'_>) -> bool {
+ fn check_too_many_raw_str_terminators(&mut self, err: &mut Diagnostic) -> bool {
match (&self.prev_token.kind, &self.token.kind) {
(
TokenKind::Literal(Lit {
pub fn maybe_annotate_with_ascription(
&mut self,
- err: &mut DiagnosticBuilder<'_>,
+ err: &mut Diagnostic,
maybe_expected_semicolon: bool,
) {
if let Some((sp, likely_path)) = self.last_type_ascription.take() {
/// parenthesising the leftmost comparison.
fn attempt_chained_comparison_suggestion(
&mut self,
- err: &mut DiagnosticBuilder<'_>,
+ err: &mut Diagnostic,
inner_op: &Expr,
outer_op: &Spanned<AssocOp>,
) -> bool /* advanced the cursor */ {
"comparison operators cannot be chained",
);
- let suggest = |err: &mut DiagnosticBuilder<'_>| {
+ let suggest = |err: &mut Diagnostic| {
err.span_suggestion_verbose(
op.span.shrink_to_lo(),
TURBOFISH_SUGGESTION_STR,
pub(super) fn parameter_without_type(
&mut self,
- err: &mut DiagnosticBuilder<'_>,
+ err: &mut Diagnostic,
pat: P<ast::Pat>,
require_name: bool,
first_param: bool,
| PatKind::TupleStruct(qself @ None, path, _)
| PatKind::Path(qself @ None, path) => match &first_pat.kind {
PatKind::Ident(_, ident, _) => {
- path.segments.insert(0, PathSegment::from_ident(ident.clone()));
+ path.segments.insert(0, PathSegment::from_ident(*ident));
path.span = new_span;
show_sugg = true;
first_pat = pat;
Path {
span: new_span,
segments: vec![
- PathSegment::from_ident(old_ident.clone()),
- PathSegment::from_ident(ident.clone()),
+ PathSegment::from_ident(*old_ident),
+ PathSegment::from_ident(*ident),
],
tokens: None,
},
}
PatKind::Path(old_qself, old_path) => {
let mut segments = old_path.segments.clone();
- segments.push(PathSegment::from_ident(ident.clone()));
+ segments.push(PathSegment::from_ident(*ident));
let path = PatKind::Path(
old_qself.clone(),
Path { span: new_span, segments, tokens: None },