dom: html_collection: remove useless error union

This commit is contained in:
Pierre Tachoire
2023-11-20 14:44:55 +01:00
parent b06083e250
commit 1d5eb47732

View File

@@ -28,7 +28,7 @@ pub const MatchByTagName = struct {
tag: []const u8, tag: []const u8,
is_wildcard: bool, is_wildcard: bool,
fn init(tag_name: []const u8) !MatchByTagName { fn init(tag_name: []const u8) MatchByTagName {
return MatchByTagName{ return MatchByTagName{
.tag = tag_name, .tag = tag_name,
.is_wildcard = std.mem.eql(u8, tag_name, "*"), .is_wildcard = std.mem.eql(u8, tag_name, "*"),
@@ -40,11 +40,11 @@ pub const MatchByTagName = struct {
} }
}; };
pub fn HTMLCollectionByTagName(root: *parser.Node, tag_name: []const u8) !HTMLCollection { pub fn HTMLCollectionByTagName(root: *parser.Node, tag_name: []const u8) HTMLCollection {
return HTMLCollection{ return HTMLCollection{
.root = root, .root = root,
.match = Match{ .match = Match{
.matchByTagName = try MatchByTagName.init(tag_name), .matchByTagName = MatchByTagName.init(tag_name),
}, },
}; };
} }
@@ -52,7 +52,7 @@ pub fn HTMLCollectionByTagName(root: *parser.Node, tag_name: []const u8) !HTMLCo
pub const MatchByClassName = struct { pub const MatchByClassName = struct {
classNames: []const u8, classNames: []const u8,
fn init(classNames: []const u8) !MatchByClassName { fn init(classNames: []const u8) MatchByClassName {
return MatchByClassName{ return MatchByClassName{
.classNames = classNames, .classNames = classNames,
}; };
@@ -71,11 +71,11 @@ pub const MatchByClassName = struct {
} }
}; };
pub fn HTMLCollectionByClassName(root: *parser.Node, classNames: []const u8) !HTMLCollection { pub fn HTMLCollectionByClassName(root: *parser.Node, classNames: []const u8) HTMLCollection {
return HTMLCollection{ return HTMLCollection{
.root = root, .root = root,
.match = Match{ .match = Match{
.matchByClassName = try MatchByClassName.init(classNames), .matchByClassName = MatchByClassName.init(classNames),
}, },
}; };
} }