Remove all eight DiagnosticBuilder::*_with_code
methods.
These all have relatively low use, and can be perfectly emulated with a simpler construction method combined with `code` or `code_mv`.
This commit is contained in:
parent
bd4e623485
commit
6682f243dc
14 changed files with 84 additions and 180 deletions
|
@ -2356,15 +2356,15 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||
},
|
||||
};
|
||||
|
||||
let mut err = self.tcx.dcx().struct_span_err_with_code(
|
||||
span,
|
||||
format!("{labeled_user_string} may not live long enough"),
|
||||
match sub.kind() {
|
||||
ty::ReEarlyParam(_) | ty::ReLateParam(_) if sub.has_name() => error_code!(E0309),
|
||||
ty::ReStatic => error_code!(E0310),
|
||||
_ => error_code!(E0311),
|
||||
},
|
||||
);
|
||||
let mut err = self
|
||||
.tcx
|
||||
.dcx()
|
||||
.struct_span_err(span, format!("{labeled_user_string} may not live long enough"));
|
||||
err.code(match sub.kind() {
|
||||
ty::ReEarlyParam(_) | ty::ReLateParam(_) if sub.has_name() => error_code!(E0309),
|
||||
ty::ReStatic => error_code!(E0310),
|
||||
_ => error_code!(E0311),
|
||||
});
|
||||
|
||||
'_explain: {
|
||||
let (description, span) = match sub.kind() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue