Skip to content

Commit

Permalink
perf: No need to group on individual text components
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus Westerlind committed Dec 8, 2021
1 parent 0845395 commit 9a67247
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,11 @@ where
#[inline]
pub fn group(self) -> DocBuilder<'a, D, A> {
match *self.1 {
Doc::Group(_) | Doc::Nil => self,
Doc::Group(_)
| Doc::OwnedText(_)
| Doc::BorrowedText(_)
| Doc::SmallText(_)
| Doc::Nil => self,
_ => {
let DocBuilder(allocator, this) = self;
DocBuilder(allocator, Doc::Group(allocator.alloc_cow(this)).into())
Expand Down

0 comments on commit 9a67247

Please sign in to comment.