rustc_errors: take self by value in DiagnosticBuilder::cancel.

This commit is contained in:
Eduard-Mihai Burtescu 2022-01-26 03:39:14 +00:00
parent 88483bd4b7
commit 881b8cb704
2 changed files with 4 additions and 6 deletions

View File

@ -628,9 +628,7 @@ fn has_needless_main(code: String, edition: Edition) -> bool {
let mut parser = match maybe_new_parser_from_source_str(&sess, filename, code) {
Ok(p) => p,
Err(errs) => {
for mut err in errs {
err.cancel();
}
drop(errs);
return false;
},
};
@ -668,7 +666,7 @@ fn has_needless_main(code: String, edition: Edition) -> bool {
_ => {},
},
Ok(None) => break,
Err(mut e) => {
Err(e) => {
e.cancel();
return false;
},

View File

@ -534,7 +534,7 @@ fn check_tts<'a>(&self, cx: &EarlyContext<'a>, tts: TokenStream, is_write: bool)
match parser
.parse_expr()
.map(rustc_ast::ptr::P::into_inner)
.map_err(|mut e| e.cancel())
.map_err(|e| e.cancel())
{
// write!(e, ...)
Ok(p) if parser.eat(&token::Comma) => Some(p),
@ -563,7 +563,7 @@ fn check_tts<'a>(&self, cx: &EarlyContext<'a>, tts: TokenStream, is_write: bool)
}
let comma_span = parser.prev_token.span;
let token_expr = if let Ok(expr) = parser.parse_expr().map_err(|mut err| err.cancel()) {
let token_expr = if let Ok(expr) = parser.parse_expr().map_err(|err| err.cancel()) {
expr
} else {
return (Some(fmtstr), None);