style: Addressed style issues
This commit is contained in:
@@ -311,10 +311,8 @@ impl JsonStreamParser {
|
|||||||
}
|
}
|
||||||
self.balances.push(ch);
|
self.balances.push(ch);
|
||||||
}
|
}
|
||||||
'[' => {
|
'[' if self.start.is_some() => {
|
||||||
if self.start.is_some() {
|
self.balances.push(ch);
|
||||||
self.balances.push(ch);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
'}' => {
|
'}' => {
|
||||||
self.balances.pop();
|
self.balances.pop();
|
||||||
|
|||||||
+1
-4
@@ -1066,10 +1066,7 @@ fn reciprocal_rank_fusion(
|
|||||||
) -> Vec<DocumentId> {
|
) -> Vec<DocumentId> {
|
||||||
let rrf_k = top_k * 2;
|
let rrf_k = top_k * 2;
|
||||||
let mut map: IndexMap<DocumentId, f32> = IndexMap::new();
|
let mut map: IndexMap<DocumentId, f32> = IndexMap::new();
|
||||||
for (document_ids, weight) in list_of_document_ids
|
for (document_ids, weight) in list_of_document_ids.into_iter().zip(list_of_weights) {
|
||||||
.into_iter()
|
|
||||||
.zip(list_of_weights.into_iter())
|
|
||||||
{
|
|
||||||
for (index, &item) in document_ids.iter().enumerate() {
|
for (index, &item) in document_ids.iter().enumerate() {
|
||||||
*map.entry(item).or_default() += (1.0 / ((rrf_k + index + 1) as f32)) * weight;
|
*map.entry(item).or_default() += (1.0 / ((rrf_k + index + 1) as f32)) * weight;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-4
@@ -20,10 +20,8 @@ pub fn read_single_key(valid_chars: &[char], default: char, prompt: &str) -> Res
|
|||||||
KeyCode::Char('c') if modifiers.contains(KeyModifiers::CONTROL) => {
|
KeyCode::Char('c') if modifiers.contains(KeyModifiers::CONTROL) => {
|
||||||
break Err(anyhow::anyhow!("Interrupted"));
|
break Err(anyhow::anyhow!("Interrupted"));
|
||||||
}
|
}
|
||||||
KeyCode::Char(c) => {
|
KeyCode::Char(c) if valid_chars.contains(&c) => {
|
||||||
if valid_chars.contains(&c) {
|
break Ok(c);
|
||||||
break Ok(c);
|
|
||||||
}
|
|
||||||
// Invalid character, continue loop
|
// Invalid character, continue loop
|
||||||
}
|
}
|
||||||
KeyCode::Enter => {
|
KeyCode::Enter => {
|
||||||
|
|||||||
+2
-2
@@ -33,7 +33,7 @@ use fuzzy_matcher::{FuzzyMatcher, skim::SkimMatcherV2};
|
|||||||
use is_terminal::IsTerminal;
|
use is_terminal::IsTerminal;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::sync::LazyLock;
|
use std::sync::LazyLock;
|
||||||
use std::{env, path::PathBuf, process};
|
use std::{cmp, env, path::PathBuf, process};
|
||||||
use unicode_segmentation::UnicodeSegmentation;
|
use unicode_segmentation::UnicodeSegmentation;
|
||||||
|
|
||||||
pub static CODE_BLOCK_RE: LazyLock<Regex> =
|
pub static CODE_BLOCK_RE: LazyLock<Regex> =
|
||||||
@@ -123,7 +123,7 @@ where
|
|||||||
Some((v, score))
|
Some((v, score))
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
list.sort_unstable_by(|a, b| b.1.cmp(&a.1));
|
list.sort_unstable_by_key(|b| cmp::Reverse(b.1));
|
||||||
list.into_iter().map(|(v, _)| v).collect()
|
list.into_iter().map(|(v, _)| v).collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user