Skip to content

Commit 60a4d8d

Browse files
authored
fix(clippy): resolve remaining sort_by and iter_without_into_iter warnings (#554)
- cortex-prompt-harness/builder.rs: use sort_by_key with Reverse for priority sorting - cortex-tui-input/reader.rs: add IntoIterator impl for &InputReader
1 parent 5ec3fa9 commit 60a4d8d

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

  • cortex-tui-framework/crates/cortex-tui-input/src
  • src/cortex-prompt-harness/src

cortex-tui-framework/crates/cortex-tui-input/src/reader.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,15 @@ impl InputReader {
503503
}
504504
}
505505

506+
impl<'a> IntoIterator for &'a InputReader {
507+
type Item = InputResult<Event>;
508+
type IntoIter = EventIterator<'a>;
509+
510+
fn into_iter(self) -> Self::IntoIter {
511+
self.iter()
512+
}
513+
}
514+
506515
/// Helper function to run a closure with terminal input configured.
507516
///
508517
/// This function:

src/cortex-prompt-harness/src/builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ impl SystemPromptBuilder {
162162

163163
// Sort sections by priority and add them
164164
let mut sections: Vec<_> = self.sections.values().collect();
165-
sections.sort_by(|a, b| b.priority.cmp(&a.priority));
165+
sections.sort_by_key(|s| std::cmp::Reverse(s.priority));
166166

167167
for section in sections {
168168
if section.enabled {

0 commit comments

Comments
 (0)