Streamline attribute stitching on AST nodes.

It can be done more concisely.
This commit is contained in:
Nicholas Nethercote
2024-07-31 19:16:09 +10:00
parent fe647f0538
commit 2eb2ef1684
2 changed files with 10 additions and 15 deletions

View File

@@ -53,10 +53,9 @@ impl AttrWrapper {
/// Prepend `self.attrs` to `attrs`.
// FIXME: require passing an NT to prevent misuse of this method
pub(crate) fn prepend_to_nt_inner(self, attrs: &mut AttrVec) {
let mut self_attrs = self.attrs;
mem::swap(attrs, &mut self_attrs);
attrs.extend(self_attrs);
pub(crate) fn prepend_to_nt_inner(mut self, attrs: &mut AttrVec) {
mem::swap(attrs, &mut self.attrs);
attrs.extend(self.attrs);
}
pub fn is_empty(&self) -> bool {