From f0a956318e2fec3ad91a9ec6727c3e04811cf846 Mon Sep 17 00:00:00 2001 From: copygirl Date: Fri, 8 Sep 2023 22:32:41 +0200 Subject: [PATCH] Make Path.fromParts not return error --- src/path.zig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/path.zig b/src/path.zig index c63660c..245093b 100644 --- a/src/path.zig +++ b/src/path.zig @@ -88,10 +88,10 @@ pub const Path = struct { return result; } - /// Creates a new `Path` from the specified string parts. + /// Creates a new `Path` from the specified parts. /// /// The resulting path does not own any of the given slices. - pub fn fromParts(absolute: bool, parts: []const EntityPart) !Path { + pub fn fromParts(absolute: bool, parts: []const EntityPart) Path { std.debug.assert(parts.len > 0); return .{ .absolute = absolute, .parts = parts }; } @@ -359,7 +359,7 @@ test Path { // To do this you can use the `buildParts` helper function, which is less // wordy than building `EntityPart` structs manually. const absolute1_parts = Path.buildParts(.{ "I'm", "absolute!" }); - const absolute1 = try Path.fromParts(true, &absolute1_parts); + const absolute1 = Path.fromParts(true, &absolute1_parts); // No need to call `deinit()`. The path does not own the `absolute1_parts` // array nor the string parts, which in this case are comptime constants. @@ -401,7 +401,7 @@ test Path { // Numeric ids can also be passed to `buildParts`. const numeric2_parts = Path.buildParts(.{ 100, 101, "bar" }); - const numeric2 = try Path.fromParts(false, &numeric2_parts); + const numeric2 = Path.fromParts(false, &numeric2_parts); try expect(numeric1.equals(numeric2)); // Paths are formattable. As format specifier you can use options defined