Skip to content

Commit

Permalink
Optimize ObjectLike::to_string for tables and userdata
Browse files Browse the repository at this point in the history
  • Loading branch information
khvzak committed Aug 30, 2024
1 parent 4018a17 commit d6b27de
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ impl ObjectLike for Table {

#[inline]
fn to_string(&self) -> Result<StdString> {
Value::Table(self.clone()).to_string()
Value::Table(Table(self.0.copy())).to_string()
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/userdata/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,6 @@ impl ObjectLike for AnyUserData {

#[inline]
fn to_string(&self) -> Result<StdString> {
Value::UserData(self.clone()).to_string()
Value::UserData(AnyUserData(self.0.copy(), self.1)).to_string()
}
}

0 comments on commit d6b27de

Please sign in to comment.