From bf8152b4b8eb3da66e4e00293e148d8e7c8211ad Mon Sep 17 00:00:00 2001 From: "Jeong, YunWon" <69878+youknowone@users.noreply.github.com> Date: Tue, 2 Dec 2025 10:11:04 +0900 Subject: [PATCH] Remove unused _membership_iter_search (#6318) --- crates/vm/src/builtins/range.rs | 2 -- crates/vm/src/vm/vm_ops.rs | 24 ++---------------------- 2 files changed, 2 insertions(+), 24 deletions(-) diff --git a/crates/vm/src/builtins/range.rs b/crates/vm/src/builtins/range.rs index ef55feed6..3edd130ee 100644 --- a/crates/vm/src/builtins/range.rs +++ b/crates/vm/src/builtins/range.rs @@ -28,8 +28,6 @@ enum SearchType { Index, } -// Note: might be a good idea to merge with _membership_iter_search or generalize (_sequence_iter_check?) -// and place in vm.rs for all sequences to be able to use it. #[inline] fn iter_search( obj: &PyObject, diff --git a/crates/vm/src/vm/vm_ops.rs b/crates/vm/src/vm/vm_ops.rs index a5656250c..e30e19981 100644 --- a/crates/vm/src/vm/vm_ops.rs +++ b/crates/vm/src/vm/vm_ops.rs @@ -2,9 +2,9 @@ use super::VirtualMachine; use crate::stdlib::warnings; use crate::{ PyRef, - builtins::{PyInt, PyIntRef, PyStr, PyStrRef, PyUtf8Str}, + builtins::{PyInt, PyStr, PyStrRef, PyUtf8Str}, object::{AsObject, PyObject, PyObjectRef, PyResult}, - protocol::{PyIterReturn, PyNumberBinaryOp, PyNumberTernaryOp, PySequence}, + protocol::{PyNumberBinaryOp, PyNumberTernaryOp, PySequence}, types::PyComparisonOp, }; use num_traits::ToPrimitive; @@ -529,26 +529,6 @@ impl VirtualMachine { self.format(obj, format_spec)?.try_into_utf8(self) } - // https://docs.python.org/3/reference/expressions.html#membership-test-operations - fn _membership_iter_search( - &self, - haystack: &PyObject, - needle: PyObjectRef, - ) -> PyResult { - let iter = haystack.get_iter(self)?; - loop { - if let PyIterReturn::Return(element) = iter.next(self)? { - if self.bool_eq(&element, &needle)? { - return Ok(self.ctx.new_bool(true)); - } else { - continue; - } - } else { - return Ok(self.ctx.new_bool(false)); - } - } - } - pub fn _contains(&self, haystack: &PyObject, needle: &PyObject) -> PyResult { let seq = haystack.to_sequence(); seq.contains(needle, self)