Split Handler::emit_diagnostic in two.
Currently, `emit_diagnostic` takes `&mut self`. This commit changes it so `emit_diagnostic` takes `self` and the new `emit_diagnostic_without_consuming` function takes `&mut self`. I find the distinction useful. The former case is much more common, and avoids a bunch of `mut` and `&mut` occurrences. We can also restrict the latter with `pub(crate)` which is nice.
This commit is contained in:
parent
948c9047d5
commit
7045cad330
1 changed files with 2 additions and 4 deletions
|
|
@ -284,10 +284,8 @@ impl ParseSess {
|
|||
// Methods that should be restricted within the parse module.
|
||||
impl ParseSess {
|
||||
pub(super) fn emit_diagnostics(&self, diagnostics: Vec<Diagnostic>) {
|
||||
for mut diagnostic in diagnostics {
|
||||
self.parse_sess
|
||||
.span_diagnostic
|
||||
.emit_diagnostic(&mut diagnostic);
|
||||
for diagnostic in diagnostics {
|
||||
self.parse_sess.span_diagnostic.emit_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue