Skip to content

Commit

Permalink
[stdlib] Do not use _StringRepr for StringRef.__repr__()
Browse files Browse the repository at this point in the history
We will take advantage of a faster StringRef.__repr__() when
#3686 was merged

Signed-off-by: Manuel Saelices <[email protected]>
  • Loading branch information
msaelices committed Nov 12, 2024
1 parent 1ee14b1 commit cb66ec9
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions stdlib/src/utils/stringref.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

from bit import count_trailing_zeros
from builtin.dtype import _uint_type_of_width
from collections.string import _atol, _isspace, _StringRepr
from collections.string import _atol, _isspace
from hashlib._hasher import _HashableWithHasher, _Hasher
from memory import UnsafePointer, memcmp, pack_bits
from memory.memory import _memcmp_impl_unconstrained
Expand Down Expand Up @@ -404,14 +404,7 @@ struct StringRef(
Returns:
The String representation of the StringRef.
"""
var output = String()
var to_str = str(self)

output.write("StringRef(")
_StringRepr(to_str).write_to(output)
output.write(")")
_ = to_str
return output
return String.write("StringRef(", repr(str(self)), ")")

@no_inline
fn write_to[W: Writer](self, inout writer: W):
Expand Down

0 comments on commit cb66ec9

Please sign in to comment.