Skip to content

Commit

Permalink
Remove the is_empty method on Captures.
Browse files Browse the repository at this point in the history
It is useless because it will always return false (since every regex has
at least one capture group corresponding to the full match).

Fixes #179
  • Loading branch information
BurntSushi committed May 7, 2016
1 parent 30d6b93 commit aad1acd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
9 changes: 3 additions & 6 deletions src/re_bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -791,16 +791,13 @@ impl<'t> Captures<'t> {
}

/// Returns the number of captured groups.
///
/// This is always at least `1`, since every regex has at least one capture
/// group that corresponds to the full match.
#[inline]
pub fn len(&self) -> usize {
self.slots.len() / 2
}

/// Returns true if and only if there are no captured groups.
#[inline]
pub fn is_empty(&self) -> bool {
self.len() == 0
}
}

impl<'t> fmt::Debug for Captures<'t> {
Expand Down
9 changes: 3 additions & 6 deletions src/re_unicode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -940,16 +940,13 @@ impl<'t> Captures<'t> {
}

/// Returns the number of captured groups.
///
/// This is always at least `1`, since every regex has at least one capture
/// group that corresponds to the full match.
#[inline]
pub fn len(&self) -> usize {
self.slots.len() / 2
}

/// Returns true if and only if there are no captured groups.
#[inline]
pub fn is_empty(&self) -> bool {
self.len() == 0
}
}

impl<'t> fmt::Debug for Captures<'t> {
Expand Down

0 comments on commit aad1acd

Please sign in to comment.