1414
1515use crate :: lua_value:: { Chunk , LuaThread , LuaUserdata } ;
1616use crate :: { LuaString , LuaTable , LuaValue } ;
17- use slotmap:: { new_key_type , SlotMap } ;
17+ use slotmap:: { SlotMap , new_key_type } ;
1818use std:: hash:: Hash ;
1919use std:: rc:: Rc ;
2020
@@ -626,7 +626,7 @@ impl ObjectPool {
626626 strings : Arena :: with_capacity ( 256 ) ,
627627 tables : Arena :: with_capacity ( 64 ) ,
628628 functions : Arena :: with_capacity ( 32 ) ,
629- upvalues : SlotMap :: with_capacity_and_key ( 32 ) , // SlotMap for O(1) access
629+ upvalues : SlotMap :: with_capacity_and_key ( 32 ) , // SlotMap for O(1) access
630630 userdata : Arena :: new ( ) ,
631631 threads : Arena :: with_capacity ( 8 ) ,
632632 string_intern : StringInternTable :: with_capacity ( 256 ) ,
@@ -901,24 +901,24 @@ impl ObjectPool {
901901 return self . create_string ( "" ) ;
902902 } ;
903903 let s = gs. data . as_str ( ) ;
904-
904+
905905 // Clamp indices
906906 let start = start. min ( s. len ( ) ) ;
907907 let end = end. min ( s. len ( ) ) ;
908-
908+
909909 if start >= end {
910910 return self . create_string ( "" ) ;
911911 }
912-
912+
913913 // Fast path: return original if full range
914914 if start == 0 && end == s. len ( ) {
915915 return source_id;
916916 }
917-
917+
918918 let slice = & s[ start..end] ;
919919 let len = slice. len ( ) ;
920920 let hash = Self :: hash_string ( slice) ;
921-
921+
922922 // For short strings, check intern table first before allocating
923923 if len <= self . max_intern_length {
924924 let compare = |id : StringId | -> bool {
@@ -943,7 +943,7 @@ impl ObjectPool {
943943 Some ( ( slice. to_string ( ) , hash, usize:: MAX ) )
944944 }
945945 } ;
946-
946+
947947 // Second phase: allocate and insert (if needed)
948948 if let Some ( ( substring, hash, insert_idx) ) = intern_result {
949949 if insert_idx != usize:: MAX {
0 commit comments