diff --git a/canvas/integration_patterns.rs b/canvas/integration_patterns.rs index 015607d..5d3641c 100644 --- a/canvas/integration_patterns.rs +++ b/canvas/integration_patterns.rs @@ -114,7 +114,7 @@ async fn state_machine_example() { } } - fn handle_feature_action(&mut self, action: &CanvasAction, _context: &ActionContext) -> Option { + fn handle_feature_action(&mut self, action: &CanvasAction, context: &ActionContext) -> Option { match action { CanvasAction::Custom(cmd) => match cmd.as_str() { "submit" => { @@ -147,7 +147,7 @@ async fn state_machine_example() { println!(" Initial state: {:?}", form.state); // Type some text to trigger state change - let _result = ActionDispatcher::dispatch( + let result = ActionDispatcher::dispatch( CanvasAction::InsertChar('u'), &mut form, &mut ideal_cursor, @@ -231,7 +231,7 @@ async fn event_driven_example() { self.has_changes = changed; } - fn handle_feature_action(&mut self, action: &CanvasAction, _context: &ActionContext) -> Option { + fn handle_feature_action(&mut self, action: &CanvasAction, context: &ActionContext) -> Option { match action { CanvasAction::Custom(cmd) => match cmd.as_str() { "validate" => { @@ -384,7 +384,7 @@ async fn validation_pipeline_example() { fn has_unsaved_changes(&self) -> bool { self.has_changes } fn set_has_unsaved_changes(&mut self, changed: bool) { self.has_changes = changed; } - fn handle_feature_action(&mut self, action: &CanvasAction, _context: &ActionContext) -> Option { + fn handle_feature_action(&mut self, action: &CanvasAction, context: &ActionContext) -> Option { match action { CanvasAction::Custom(cmd) => match cmd.as_str() { "validate" => { diff --git a/canvas/src/canvas/gui.rs b/canvas/src/canvas/gui.rs index 777ff61..37ba8d3 100644 --- a/canvas/src/canvas/gui.rs +++ b/canvas/src/canvas/gui.rs @@ -269,7 +269,7 @@ where { let mut active_field_input_rect = None; - for (i, _input) in inputs.iter().enumerate() { + for (i, input) in inputs.iter().enumerate() { let is_active = i == *current_field_idx; let typed_text = get_display_value(i); @@ -323,7 +323,7 @@ fn apply_highlighting<'a, T: CanvasTheme>( current_cursor_pos: usize, highlight_state: &HighlightState, theme: &T, - _is_active: bool, + is_active: bool, ) -> Line<'a> { let text_len = text.chars().count(); @@ -335,10 +335,10 @@ fn apply_highlighting<'a, T: CanvasTheme>( )) } HighlightState::Characterwise { anchor } => { - apply_characterwise_highlighting(text, text_len, field_index, current_field_idx, current_cursor_pos, anchor, theme, _is_active) + apply_characterwise_highlighting(text, text_len, field_index, current_field_idx, current_cursor_pos, anchor, theme, is_active) } HighlightState::Linewise { anchor_line } => { - apply_linewise_highlighting(text, field_index, current_field_idx, anchor_line, theme, _is_active) + apply_linewise_highlighting(text, field_index, current_field_idx, anchor_line, theme, is_active) } } } @@ -353,7 +353,7 @@ fn apply_characterwise_highlighting<'a, T: CanvasTheme>( current_cursor_pos: usize, anchor: &(usize, usize), theme: &T, - _is_active: bool, + is_active: bool, ) -> Line<'a> { let (anchor_field, anchor_char) = *anchor; let start_field = min(anchor_field, *current_field_idx); @@ -456,7 +456,7 @@ fn apply_linewise_highlighting<'a, T: CanvasTheme>( current_field_idx: &usize, anchor_line: &usize, theme: &T, - _is_active: bool, + is_active: bool, ) -> Line<'a> { let start_field = min(*anchor_line, *current_field_idx); let end_field = max(*anchor_line, *current_field_idx); @@ -487,7 +487,7 @@ fn set_cursor_position( field_rect: Rect, text: &str, current_cursor_pos: usize, - _has_display_override: bool, + has_display_override: bool, ) { // Sum display widths of the first current_cursor_pos characters let mut cols: u16 = 0; diff --git a/canvas/src/computed/provider.rs b/canvas/src/computed/provider.rs index 8ac2a01..33f255d 100644 --- a/canvas/src/computed/provider.rs +++ b/canvas/src/computed/provider.rs @@ -25,7 +25,7 @@ pub trait ComputedProvider { /// Get list of field dependencies for optimization. /// If field A depends on fields [1, 3], only recompute A when fields 1 or 3 change. /// Default: depend on all fields (always recompute) with a reasonable upper bound. - fn field_dependencies(&self, _field_index: usize) -> Vec { + fn field_dependencies(&self, field_index: usize) -> Vec { (0..100).collect() } -} \ No newline at end of file +} diff --git a/canvas/src/data_provider.rs b/canvas/src/data_provider.rs index 4afac75..a5eb6f7 100644 --- a/canvas/src/data_provider.rs +++ b/canvas/src/data_provider.rs @@ -19,33 +19,33 @@ pub trait DataProvider { fn set_field_value(&mut self, index: usize, value: String); /// Check if field supports suggestions (optional) - fn supports_suggestions(&self, _field_index: usize) -> bool { + fn supports_suggestions(&self, field_index: usize) -> bool { false } /// Get display value (for password masking, etc.) - optional - fn display_value(&self, _index: usize) -> Option<&str> { + fn display_value(&self, index: usize) -> Option<&str> { None // Default: use actual value } /// Get validation configuration for a field (optional) /// Only available when the 'validation' feature is enabled #[cfg(feature = "validation")] - fn validation_config(&self, _field_index: usize) -> Option { + fn validation_config(&self, field_index: usize) -> Option { None } /// Check if field is computed (display-only, skip in navigation) /// Default: not computed #[cfg(feature = "computed")] - fn is_computed_field(&self, _field_index: usize) -> bool { + fn is_computed_field(&self, field_index: usize) -> bool { false } /// Get computed field value if this is a computed field. /// Returns None for regular fields. Default: not computed. #[cfg(feature = "computed")] - fn computed_field_value(&self, _field_index: usize) -> Option { + fn computed_field_value(&self, field_index: usize) -> Option { None } } diff --git a/canvas/src/editor.rs b/canvas/src/editor.rs index ee3eea6..0698d18 100644 --- a/canvas/src/editor.rs +++ b/canvas/src/editor.rs @@ -7,7 +7,10 @@ use crate::canvas::CursorManager; use anyhow::Result; use crate::canvas::state::EditorState; -use crate::data_provider::{DataProvider, SuggestionsProvider, SuggestionItem}; +use crate::{DataProvider, SuggestionItem}; +#[cfg(feature = "suggestions")] +use crate::SuggestionsProvider; + use crate::canvas::modes::AppMode; use crate::canvas::state::SelectionState; @@ -157,7 +160,7 @@ impl FormEditor { if matches!(self.ui_state.current_mode, AppMode::Edit) { return raw.to_string(); } - if let Some((formatted, _mapper, _warning)) = cfg.run_custom_formatter(raw) { + if let Some((formatted, mapper, warning)) = cfg.run_custom_formatter(raw) { return formatted; } } @@ -254,7 +257,7 @@ impl FormEditor { return raw.to_string(); } // Not editing -> formatted - if let Some((formatted, _mapper, _warning)) = cfg.run_custom_formatter(raw) { + if let Some((formatted, mapper, warning)) = cfg.run_custom_formatter(raw) { return formatted; } } @@ -768,7 +771,7 @@ impl FormEditor { pub fn current_formatter_warning(&self) -> Option { let idx = self.ui_state.current_field; if let Some(cfg) = self.ui_state.validation.get_field_config(idx) { - if let Some((_fmt, _mapper, warn)) = cfg.run_custom_formatter(self.current_text()) { + if let Some((fmt, mapper, warn)) = cfg.run_custom_formatter(self.current_text()) { return warn; } } @@ -929,7 +932,7 @@ impl FormEditor { // Validate the new content if validation is enabled #[cfg(feature = "validation")] { - let _validation_result = self.ui_state.validation.validate_field_content( + let validation_result = self.ui_state.validation.validate_field_content( field_index, &suggestion.value_to_store, ); @@ -1373,7 +1376,7 @@ impl FormEditor { // Validate the new content if validation is enabled #[cfg(feature = "validation")] { - let _validation_result = self.ui_state.validation.validate_field_content( + let validation_result = self.ui_state.validation.validate_field_content( field_index, &value, ); @@ -1393,7 +1396,7 @@ impl FormEditor { // Validate the new content if validation is enabled #[cfg(feature = "validation")] { - let _validation_result = self.ui_state.validation.validate_field_content( + let validation_result = self.ui_state.validation.validate_field_content( field_index, &value, ); diff --git a/canvas/src/validation/limits.rs b/canvas/src/validation/limits.rs index 921cc8a..002c229 100644 --- a/canvas/src/validation/limits.rs +++ b/canvas/src/validation/limits.rs @@ -122,7 +122,7 @@ impl CharacterLimits { pub fn validate_insertion( &self, current_text: &str, - _position: usize, + position: usize, character: char, ) -> Option { let current_count = self.count(current_text);