From 115812ef524c47ae76afa0f0b0cc987161f3055c Mon Sep 17 00:00:00 2001 From: echobt Date: Mon, 2 Feb 2026 05:12:23 +0000 Subject: [PATCH] fix(clippy): resolve remaining sort_by and iter_without_into_iter warnings - cortex-prompt-harness/builder.rs: use sort_by_key with Reverse for priority sorting - cortex-tui-input/reader.rs: add IntoIterator impl for &InputReader --- .../crates/cortex-tui-input/src/reader.rs | 9 +++++++++ src/cortex-prompt-harness/src/builder.rs | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/cortex-tui-framework/crates/cortex-tui-input/src/reader.rs b/cortex-tui-framework/crates/cortex-tui-input/src/reader.rs index 6eeec126..1dd2a1a1 100644 --- a/cortex-tui-framework/crates/cortex-tui-input/src/reader.rs +++ b/cortex-tui-framework/crates/cortex-tui-input/src/reader.rs @@ -503,6 +503,15 @@ impl InputReader { } } +impl<'a> IntoIterator for &'a InputReader { + type Item = InputResult; + type IntoIter = EventIterator<'a>; + + fn into_iter(self) -> Self::IntoIter { + self.iter() + } +} + /// Helper function to run a closure with terminal input configured. /// /// This function: diff --git a/src/cortex-prompt-harness/src/builder.rs b/src/cortex-prompt-harness/src/builder.rs index 0fb2b41b..b233181b 100644 --- a/src/cortex-prompt-harness/src/builder.rs +++ b/src/cortex-prompt-harness/src/builder.rs @@ -162,7 +162,7 @@ impl SystemPromptBuilder { // Sort sections by priority and add them let mut sections: Vec<_> = self.sections.values().collect(); - sections.sort_by(|a, b| b.priority.cmp(&a.priority)); + sections.sort_by_key(|s| std::cmp::Reverse(s.priority)); for section in sections { if section.enabled {