Skip to content

Commit d6b27de

Browse files
committed
Optimize ObjectLike::to_string for tables and userdata
1 parent 4018a17 commit d6b27de

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/table.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,7 @@ impl ObjectLike for Table {
941941

942942
#[inline]
943943
fn to_string(&self) -> Result<StdString> {
944-
Value::Table(self.clone()).to_string()
944+
Value::Table(Table(self.0.copy())).to_string()
945945
}
946946
}
947947

src/userdata/object.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,6 @@ impl ObjectLike for AnyUserData {
8888

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

0 commit comments

Comments
 (0)