Skip to content

Commit 92e698b

Browse files
committed
Remove unneeded flag
1 parent 780eac8 commit 92e698b

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/index.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ impl Index {
110110
pub struct ResultsIterator<'idx> {
111111
inner: *mut RSResultsIterator,
112112
index: &'idx Index,
113-
is_empty: bool,
114113
}
115114

116115
impl<'idx> ResultsIterator<'idx> {
@@ -119,8 +118,6 @@ impl<'idx> ResultsIterator<'idx> {
119118
index: &'idx Index,
120119
err_buf: Vec<u8>,
121120
) -> Result<Self, RedisError> {
122-
let mut is_empty = false;
123-
124121
if results_iter.is_null() {
125122
// Either we encountered an error, or there are no results.
126123
let err = String::from_utf8(err_buf)?;
@@ -129,15 +126,11 @@ impl<'idx> ResultsIterator<'idx> {
129126
if err.len() > 0 {
130127
return Err(err.into());
131128
}
132-
133-
// No results.
134-
is_empty = true;
135129
}
136130

137131
Ok(Self {
138132
inner: results_iter,
139133
index,
140-
is_empty,
141134
})
142135
}
143136
}
@@ -146,7 +139,8 @@ impl Iterator for ResultsIterator<'_> {
146139
type Item = String;
147140

148141
fn next(&mut self) -> Option<Self::Item> {
149-
if self.is_empty {
142+
if self.inner.is_null() {
143+
// A null pointer means we have no results.
150144
return None;
151145
}
152146

0 commit comments

Comments
 (0)