Skip to content

Commit

Permalink
refactor: simplify ErasedSegment::make_mut
Browse files Browse the repository at this point in the history
  • Loading branch information
gvozdvmozgu authored and benfdking committed Jan 17, 2025
1 parent 6ce4f66 commit 3dad147
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions crates/lib-core/src/parser/segments/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -605,9 +605,7 @@ impl ErasedSegment {

#[track_caller]
pub(crate) fn make_mut(&mut self) -> &mut NodeOrToken {
let mut this = self.deep_clone();
std::mem::swap(self, &mut this);
Rc::get_mut(&mut self.value).unwrap()
Rc::make_mut(&mut self.value)
}

pub fn reference(&self) -> ObjectReferenceSegment {
Expand Down

0 comments on commit 3dad147

Please sign in to comment.