fix(ci): satisfy Rust 1.98 clippy checks

This commit is contained in:
leokun
2026-09-04 16:35:37 +08:00
parent edcdd77cad
commit 2f3bffd15a
2 changed files with 11 additions and 9 deletions
+4 -2
View File
@@ -39,8 +39,10 @@ impl StaticEmbedder {
let dimensions = tensor.shape()[1]; let dimensions = tensor.shape()[1];
let embeddings = tensor let embeddings = tensor
.data() .data()
.chunks_exact(2) .as_chunks::<2>()
.map(|value| f16::from_le_bytes([value[0], value[1]])) .0
.iter()
.map(|value| f16::from_le_bytes(*value))
.collect(); .collect();
let tokenizer = let tokenizer =
Tokenizer::from_file(tokenizer).map_err(|error| Error::Model(error.to_string()))?; Tokenizer::from_file(tokenizer).map_err(|error| Error::Model(error.to_string()))?;
+7 -7
View File
@@ -41,7 +41,7 @@ pub async fn consume_model_cycle(
mut stream: ProviderStream, mut stream: ProviderStream,
client: &mpsc::Sender<RunEvent>, client: &mpsc::Sender<RunEvent>,
cancellation: &CancellationToken, cancellation: &CancellationToken,
) -> std::result::Result<ModelCycleResult, ModelCycleFailure> { ) -> std::result::Result<ModelCycleResult, Box<ModelCycleFailure>> {
let mut model_call_id = None; let mut model_call_id = None;
let mut text = String::new(); let mut text = String::new();
let mut reasoning = String::new(); let mut reasoning = String::new();
@@ -372,15 +372,15 @@ fn failure(
partial_text: String, partial_text: String,
partial_reasoning: String, partial_reasoning: String,
usage: Option<Usage>, usage: Option<Usage>,
) -> ModelCycleFailure { ) -> Box<ModelCycleFailure> {
let retryable = matches!(failure, RunFailure::Protocol(_) | RunFailure::Provider(_)); let retryable = matches!(failure, RunFailure::Protocol(_) | RunFailure::Provider(_));
ModelCycleFailure { Box::new(ModelCycleFailure {
failure, failure,
partial_text, partial_text,
partial_reasoning, partial_reasoning,
usage, usage,
retryable, retryable,
} })
} }
fn terminal_failure( fn terminal_failure(
@@ -388,14 +388,14 @@ fn terminal_failure(
partial_text: String, partial_text: String,
partial_reasoning: String, partial_reasoning: String,
usage: Option<Usage>, usage: Option<Usage>,
) -> ModelCycleFailure { ) -> Box<ModelCycleFailure> {
ModelCycleFailure { Box::new(ModelCycleFailure {
failure, failure,
partial_text, partial_text,
partial_reasoning, partial_reasoning,
usage, usage,
retryable: false, retryable: false,
} })
} }
#[cfg(test)] #[cfg(test)]