From f1ff305c08429a29a42aa906fed7aa58e463587a Mon Sep 17 00:00:00 2001 From: tomoaki Date: Wed, 24 Dec 2025 04:18:24 +0900 Subject: [PATCH] refactor(cleanup): Remove unused BindingContext methods MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removed dead code from BindingContext after analysis of actual usage: **Deleted Methods (3)**: - contains() - never used - len() - never used - is_empty() - never used **Feature Gate Fix**: - binding_map(): Added #[cfg(feature = "normalized_dev")] - Method only used within normalized_dev feature gates - Prevents "never used" warning in standard builds **Analysis**: BindingContext is actively used via: - lookup() - variable name to BindingId resolution - insert() - variable registration - remove() - variable removal - binding_map() - internal map access (normalized_dev only) Files using binding_ctx: - vars/lexical_scope.rs (5 usages) - pattern3_with_if_phi.rs (2 usages) - pattern4_with_continue.rs (2 usages) - trim_loop_lowering.rs (2 usages) - pattern2_inputs_facts_box.rs (1 usage) **Result**: All BindingContext dead_code warnings eliminated 🤖 Generated with Claude Code Co-Authored-By: Claude Sonnet 4.5 --- src/mir/builder/binding_context.rs | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/src/mir/builder/binding_context.rs b/src/mir/builder/binding_context.rs index 80861e2b..ed46eabd 100644 --- a/src/mir/builder/binding_context.rs +++ b/src/mir/builder/binding_context.rs @@ -73,24 +73,12 @@ impl BindingContext { } /// Get immutable reference to the binding map (for BindingMapProvider) - pub fn binding_map(&self) -> &BTreeMap { + /// Phase 136: Used only with normalized_dev feature + #[cfg(feature = "normalized_dev")] + pub(super) fn binding_map(&self) -> &BTreeMap { &self.binding_map } - /// Check if a variable has a binding - pub fn contains(&self, name: &str) -> bool { - self.binding_map.contains_key(name) - } - - /// Get the number of bindings - pub fn len(&self) -> usize { - self.binding_map.len() - } - - /// Check if there are no bindings - pub fn is_empty(&self) -> bool { - self.binding_map.is_empty() - } } #[cfg(test)]