Skip to content

Commit aad1acd

Browse files
committed
Remove the is_empty method on Captures.
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
1 parent 30d6b93 commit aad1acd

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

src/re_bytes.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -791,16 +791,13 @@ impl<'t> Captures<'t> {
791791
}
792792

793793
/// Returns the number of captured groups.
794+
///
795+
/// This is always at least `1`, since every regex has at least one capture
796+
/// group that corresponds to the full match.
794797
#[inline]
795798
pub fn len(&self) -> usize {
796799
self.slots.len() / 2
797800
}
798-
799-
/// Returns true if and only if there are no captured groups.
800-
#[inline]
801-
pub fn is_empty(&self) -> bool {
802-
self.len() == 0
803-
}
804801
}
805802

806803
impl<'t> fmt::Debug for Captures<'t> {

src/re_unicode.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -940,16 +940,13 @@ impl<'t> Captures<'t> {
940940
}
941941

942942
/// Returns the number of captured groups.
943+
///
944+
/// This is always at least `1`, since every regex has at least one capture
945+
/// group that corresponds to the full match.
943946
#[inline]
944947
pub fn len(&self) -> usize {
945948
self.slots.len() / 2
946949
}
947-
948-
/// Returns true if and only if there are no captured groups.
949-
#[inline]
950-
pub fn is_empty(&self) -> bool {
951-
self.len() == 0
952-
}
953950
}
954951

955952
impl<'t> fmt::Debug for Captures<'t> {

0 commit comments

Comments
 (0)