Skip to content

Commit 59b5cdb

Browse files
committed
omitted discards
1 parent 23af51f commit 59b5cdb

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

zig-string.zig

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ pub const String = struct {
4141
pub fn allocate(self: *String, bytes: usize) Error!void {
4242
if (self.buffer) |buffer| {
4343
if (bytes < self.size) self.size = bytes; // Clamp size to capacity
44-
self.buffer = self.allocator.realloc(buffer, bytes) catch |_| {
44+
self.buffer = self.allocator.realloc(buffer, bytes) catch {
4545
return Error.OutOfMemory;
4646
};
4747
} else {
48-
self.buffer = self.allocator.alloc(u8, bytes) catch |_| {
48+
self.buffer = self.allocator.alloc(u8, bytes) catch {
4949
return Error.OutOfMemory;
5050
};
5151
}
@@ -139,7 +139,7 @@ pub const String = struct {
139139

140140
/// Returns an owned slice of this string
141141
pub fn toOwned(self: String) Error!?[]u8 {
142-
if (self.buffer) |buffer| {
142+
if (self.buffer) {
143143
const string = self.str();
144144
if (self.allocator.alloc(u8, string.len)) |newStr| {
145145
std.mem.copy(u8, newStr, string);
@@ -227,7 +227,7 @@ pub const String = struct {
227227
}
228228

229229
if (String.getIndex(buffer, i, false)) |k| {
230-
self.removeRange(0, k) catch |_| {};
230+
self.removeRange(0, k) catch {};
231231
}
232232
}
233233
}
@@ -452,7 +452,7 @@ pub const String = struct {
452452

453453
/// Returns the UTF-8 character's size
454454
inline fn getUTF8Size(char: u8) u3 {
455-
return std.unicode.utf8ByteSequenceLength(char) catch |_| {
455+
return std.unicode.utf8ByteSequenceLength(char) catch {
456456
return 1;
457457
};
458458
}

0 commit comments

Comments
 (0)