1
Fork 0

Refactor take_for_recovery call sites.

To make them more concise and similar to each other.
This commit is contained in:
Nicholas Nethercote 2024-02-19 09:59:56 +11:00
parent 62b4e55112
commit a8a486c846
2 changed files with 14 additions and 18 deletions

View file

@ -230,8 +230,7 @@ impl<'a> Parser<'a> {
/// Also error if the previous token was a doc comment.
fn error_outer_attrs(&self, attrs: AttrWrapper) {
if !attrs.is_empty()
&& let attrs = attrs.take_for_recovery(self.sess)
&& let attrs @ [.., last] = &*attrs
&& let attrs @ [.., last] = &*attrs.take_for_recovery(self.sess)
{
if last.is_doc_comment() {
self.dcx().emit_err(errors::DocCommentDoesNotDocumentAnything {