Skip to content

Commit 3a729d4

Browse files
trepidityclaude
andcommitted
Fix clippy warnings: use clamp, strip_prefix, and remove redundant branch
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 1412bae commit 3a729d4

2 files changed

Lines changed: 5 additions & 9 deletions

File tree

crates/loom-tui/src/app.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2536,7 +2536,7 @@ impl App {
25362536
(vec![String::new()], 0, 0, Vec::new())
25372537
};
25382538
let input_height = if self.command_panel.input_active {
2539-
(formatted_lines.len() as u16).max(1).min(8)
2539+
(formatted_lines.len() as u16).clamp(1, 8)
25402540
} else {
25412541
1
25422542
};

crates/loom-tui/src/components/command_panel.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -437,8 +437,8 @@ impl CommandPanel {
437437
let prefix_end = self.cursor_pos - partial.len();
438438
let suffix = &self.input_buffer[self.cursor_pos..];
439439
// Skip the auto-inserted ')' since we're adding our own
440-
let suffix = if suffix.starts_with(')') {
441-
suffix[1..].to_string()
440+
let suffix = if let Some(stripped) = suffix.strip_prefix(')') {
441+
stripped.to_string()
442442
} else {
443443
suffix.to_string()
444444
};
@@ -854,11 +854,7 @@ impl CommandPanel {
854854
current_line = String::new();
855855
} else {
856856
// Closing paren for a child filter — stays on same line
857-
let row = if current_line.is_empty() {
858-
lines.len()
859-
} else {
860-
lines.len()
861-
};
857+
let row = lines.len();
862858
let col = current_line.len();
863859
cursor_map.push((row, col));
864860
current_line.push(ch);
@@ -1216,7 +1212,7 @@ impl Component for CommandPanel {
12161212
} else {
12171213
(vec![String::new()], 0, 0, Vec::new())
12181214
};
1219-
let input_height = (formatted_lines.len() as u16).max(1).min(8);
1215+
let input_height = (formatted_lines.len() as u16).clamp(1, 8);
12201216

12211217
// Layout: messages (flex) | input area (dynamic height)
12221218
let layout =

0 commit comments

Comments
 (0)