Skip to content

Commit

Permalink
fix more uses of string buffer constructor
Browse files Browse the repository at this point in the history
Signed-off-by: martinvuyk <martin.vuyklop@gmail.com>
  • Loading branch information
martinvuyk committed Feb 2, 2025
1 parent 58b81a5 commit 87a1a53
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions stdlib/src/collections/string/string.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ struct String(
for i in r:
buffer.append(ptr[i])
buffer.append(0)
return Self(buffer=buffer^)
return String(buffer=buffer^)

@always_inline
fn __eq__(self, other: String) -> Bool:
Expand Down Expand Up @@ -995,7 +995,7 @@ struct String(
buffer.extend(lhs)
buffer.extend(rhs)
buffer.append(0)
return Self(buffer^)
return String(buffer=buffer^)

@always_inline
fn __add__(self, other: StringSlice) -> String:
Expand Down Expand Up @@ -1975,8 +1975,7 @@ struct String(
buffer.resize(width, fillbyte)
buffer.append(0)
memcpy(buffer.unsafe_ptr().offset(start), self.unsafe_ptr(), len(self))
var result = String(buffer=buffer)
return result^
return String(buffer=buffer)

fn reserve(mut self, new_capacity: Int):
"""Reserves the requested capacity.
Expand Down

0 comments on commit 87a1a53

Please sign in to comment.