Skip to content

Commit

Permalink
remove a TODO
Browse files Browse the repository at this point in the history
Despite the comment, I don't want to remove the `&str` version: it'll be
useful when I want to write a matcher against URLs, for links and images
(and also for alt text for images). But, anywhere that I'm using it to
check for an inline, I should use `matches_inlines` instead.
  • Loading branch information
yshavit authored Jun 21, 2024
1 parent 737235c commit be38af7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
1 change: 0 additions & 1 deletion src/matcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ impl PartialEq for StringMatcher {

impl StringMatcher {
pub fn matches(&self, haystack: &str) -> bool {
// TODO deprecate in favor of matches_inlines
match self {
StringMatcher::Any => true,
StringMatcher::Substring(look_for) => haystack.contains(look_for),
Expand Down
4 changes: 1 addition & 3 deletions src/select/section.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use crate::fmt_str::inlines_to_plain_string;
use crate::matcher::StringMatcher;
use crate::parsing_iter::ParsingIterator;
use crate::select::base::Selector;
Expand All @@ -19,8 +18,7 @@ impl SectionSelector {

impl<'a> Selector<'a, &'a Section> for SectionSelector {
fn matches(&self, section: &'a Section) -> bool {
let header_text = inlines_to_plain_string(&section.title);
self.matcher.matches(&header_text)
self.matcher.matches_inlines(&section.title)
}

fn pick(&self, item: &'a Section) -> SelectResult<'a> {
Expand Down

0 comments on commit be38af7

Please sign in to comment.