Simpler way to get single element from vector

This commit is contained in:
David Tolnay 2019-01-18 22:33:43 -08:00
parent a9c5df5da1
commit aeae265777
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -120,7 +120,7 @@ impl<'c, T> VecAttr<'c, T> {
.error_spanned_by(dup_token, format!("duplicate serde attribute `{}`", self.name)); .error_spanned_by(dup_token, format!("duplicate serde attribute `{}`", self.name));
Err(()) Err(())
} else { } else {
Ok(self.values.drain(..).next()) Ok(self.values.pop())
} }
} }