removed silenced variables

This commit is contained in:
Priec
2025-08-12 09:53:24 +02:00
parent 8b742bbe09
commit 2b16a80ef8
6 changed files with 29 additions and 26 deletions

View File

@@ -114,7 +114,7 @@ async fn state_machine_example() {
}
}
fn handle_feature_action(&mut self, action: &CanvasAction, _context: &ActionContext) -> Option<String> {
fn handle_feature_action(&mut self, action: &CanvasAction, context: &ActionContext) -> Option<String> {
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<String> {
fn handle_feature_action(&mut self, action: &CanvasAction, context: &ActionContext) -> Option<String> {
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<String> {
fn handle_feature_action(&mut self, action: &CanvasAction, context: &ActionContext) -> Option<String> {
match action {
CanvasAction::Custom(cmd) => match cmd.as_str() {
"validate" => {

View File

@@ -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;

View File

@@ -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<usize> {
fn field_dependencies(&self, field_index: usize) -> Vec<usize> {
(0..100).collect()
}
}
}

View File

@@ -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<crate::validation::ValidationConfig> {
fn validation_config(&self, field_index: usize) -> Option<crate::validation::ValidationConfig> {
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<String> {
fn computed_field_value(&self, field_index: usize) -> Option<String> {
None
}
}

View File

@@ -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<D: DataProvider> FormEditor<D> {
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<D: DataProvider> FormEditor<D> {
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<D: DataProvider> FormEditor<D> {
pub fn current_formatter_warning(&self) -> Option<String> {
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<D: DataProvider> FormEditor<D> {
// 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<D: DataProvider> FormEditor<D> {
// 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<D: DataProvider> FormEditor<D> {
// 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,
);

View File

@@ -122,7 +122,7 @@ impl CharacterLimits {
pub fn validate_insertion(
&self,
current_text: &str,
_position: usize,
position: usize,
character: char,
) -> Option<ValidationResult> {
let current_count = self.count(current_text);