@@ -41,11 +41,11 @@ pub const String = struct {
41
41
pub fn allocate (self : * String , bytes : usize ) Error ! void {
42
42
if (self .buffer ) | buffer | {
43
43
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 {
45
45
return Error .OutOfMemory ;
46
46
};
47
47
} else {
48
- self .buffer = self .allocator .alloc (u8 , bytes ) catch | _ | {
48
+ self .buffer = self .allocator .alloc (u8 , bytes ) catch {
49
49
return Error .OutOfMemory ;
50
50
};
51
51
}
@@ -139,7 +139,7 @@ pub const String = struct {
139
139
140
140
/// Returns an owned slice of this string
141
141
pub fn toOwned (self : String ) Error ! ? []u8 {
142
- if (self .buffer ) | buffer | {
142
+ if (self .buffer ) {
143
143
const string = self .str ();
144
144
if (self .allocator .alloc (u8 , string .len )) | newStr | {
145
145
std .mem .copy (u8 , newStr , string );
@@ -227,7 +227,7 @@ pub const String = struct {
227
227
}
228
228
229
229
if (String .getIndex (buffer , i , false )) | k | {
230
- self .removeRange (0 , k ) catch | _ | {};
230
+ self .removeRange (0 , k ) catch {};
231
231
}
232
232
}
233
233
}
@@ -452,7 +452,7 @@ pub const String = struct {
452
452
453
453
/// Returns the UTF-8 character's size
454
454
inline fn getUTF8Size (char : u8 ) u3 {
455
- return std .unicode .utf8ByteSequenceLength (char ) catch | _ | {
455
+ return std .unicode .utf8ByteSequenceLength (char ) catch {
456
456
return 1 ;
457
457
};
458
458
}
0 commit comments