Use chaining for DiagnosticBuilder construction and emit.
To avoid the use of a mutable local variable, and because it reads more nicely.
This commit is contained in:
@@ -190,7 +190,7 @@ pub fn recursive_type_error(
|
||||
}
|
||||
s
|
||||
};
|
||||
let mut err = struct_span_err!(
|
||||
struct_span_err!(
|
||||
tcx.dcx(),
|
||||
err_span,
|
||||
E0072,
|
||||
@@ -198,13 +198,13 @@ pub fn recursive_type_error(
|
||||
pluralize!(cycle_len),
|
||||
items_list,
|
||||
pluralize!("has", cycle_len),
|
||||
);
|
||||
err.multipart_suggestion(
|
||||
)
|
||||
.multipart_suggestion_mv(
|
||||
"insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle",
|
||||
suggestion,
|
||||
Applicability::HasPlaceholders,
|
||||
);
|
||||
err.emit();
|
||||
)
|
||||
.emit();
|
||||
}
|
||||
|
||||
fn find_item_ty_spans(
|
||||
|
||||
Reference in New Issue
Block a user