Skip to content

Commit

Permalink
clean up this old PR; fixes #17
Browse files Browse the repository at this point in the history
  • Loading branch information
utkarshkukreti committed Oct 18, 2020
1 parent 19eadc7 commit 17b32dc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/selection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,10 @@ impl<'a> Selection<'a> {
}

pub fn last(&self) -> Option<Node<'a>> {
self.bit_set.iter().last().map(|index| self.document.nth(index).unwrap())
self.bit_set
.iter()
.last()
.map(|index| self.document.nth(index).unwrap())
}

pub fn len(&self) -> usize {
Expand Down
4 changes: 2 additions & 2 deletions tests/selection_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ speculate! {

let document = Document::from(include_str!("fixtures/struct.Vec.html"));

assert!(document.find(Name("div")).last().is_some());
assert!(document.find(Name("divv")).last().is_none());
assert!(document.select(Name("div")).into_selection().last().is_some());
assert!(document.select(Name("divv")).into_selection().last().is_none());
}

test "Selection::len() == Selection::iter().count()" {
Expand Down

0 comments on commit 17b32dc

Please sign in to comment.