Skip to content

Commit 64a64dd

Browse files
committed
Remove unused _membership_iter_search
1 parent 9130dd8 commit 64a64dd

File tree

2 files changed

+2
-24
lines changed

2 files changed

+2
-24
lines changed

crates/vm/src/builtins/range.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ enum SearchType {
2828
Index,
2929
}
3030

31-
// Note: might be a good idea to merge with _membership_iter_search or generalize (_sequence_iter_check?)
32-
// and place in vm.rs for all sequences to be able to use it.
3331
#[inline]
3432
fn iter_search(
3533
obj: &PyObject,

crates/vm/src/vm/vm_ops.rs

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ use super::VirtualMachine;
22
use crate::stdlib::warnings;
33
use crate::{
44
PyRef,
5-
builtins::{PyInt, PyIntRef, PyStr, PyStrRef, PyUtf8Str},
5+
builtins::{PyInt, PyStr, PyStrRef, PyUtf8Str},
66
object::{AsObject, PyObject, PyObjectRef, PyResult},
7-
protocol::{PyIterReturn, PyNumberBinaryOp, PyNumberTernaryOp, PySequence},
7+
protocol::{PyNumberBinaryOp, PyNumberTernaryOp, PySequence},
88
types::PyComparisonOp,
99
};
1010
use num_traits::ToPrimitive;
@@ -529,26 +529,6 @@ impl VirtualMachine {
529529
self.format(obj, format_spec)?.try_into_utf8(self)
530530
}
531531

532-
// https://docs.python.org/3/reference/expressions.html#membership-test-operations
533-
fn _membership_iter_search(
534-
&self,
535-
haystack: &PyObject,
536-
needle: PyObjectRef,
537-
) -> PyResult<PyIntRef> {
538-
let iter = haystack.get_iter(self)?;
539-
loop {
540-
if let PyIterReturn::Return(element) = iter.next(self)? {
541-
if self.bool_eq(&element, &needle)? {
542-
return Ok(self.ctx.new_bool(true));
543-
} else {
544-
continue;
545-
}
546-
} else {
547-
return Ok(self.ctx.new_bool(false));
548-
}
549-
}
550-
}
551-
552532
pub fn _contains(&self, haystack: &PyObject, needle: &PyObject) -> PyResult<bool> {
553533
let seq = haystack.to_sequence();
554534
seq.contains(needle, self)

0 commit comments

Comments
 (0)