Skip to content

cleanup: thread []*html.Node through winnow, drop temp Selection#585

Merged
mna merged 1 commit into
PuerkitoBio:masterfrom
jvoisin:winnow_cleanup
Jun 10, 2026
Merged

cleanup: thread []*html.Node through winnow, drop temp Selection#585
mna merged 1 commit into
PuerkitoBio:masterfrom
jvoisin:winnow_cleanup

Conversation

@jvoisin

@jvoisin jvoisin commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

winnow only ever reads sel.Nodes; the *Selection parameter was incidental. Change its signature to winnow(nodes []*html.Node, ...) and update its three callers (FilterMatcher, NotMatcher, filterAndPush). filterAndPush no longer needs to fabricate a throwaway Selection to satisfy the call.

While this change has o measurable runtime effect, it simplifies the code a bit, by making winnow's signature clearer, and removes a now-useless line and its associated comment in filterAndPush

winnow only ever reads sel.Nodes; the *Selection parameter was
incidental. Change its signature to winnow(nodes []*html.Node, ...)
and update its three callers (FilterMatcher, NotMatcher,
filterAndPush). filterAndPush no longer needs to fabricate a
throwaway Selection to satisfy the call.

While this change has o measurable runtime effect, it simplifies the code a bit,
by making winnow's signature clearer, and removes a now-useless line and its
associated comment in filterAndPush
@mna mna merged commit e665839 into PuerkitoBio:master Jun 10, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants