fmt and clippy

This commit is contained in:
geoffsee
2025-09-04 15:07:49 -04:00
parent 3ecdd9ffa0
commit 3992532f15
13 changed files with 28 additions and 43 deletions

View File

@@ -24,8 +24,7 @@ fn run_build() -> io::Result<()> {
let out_dir = PathBuf::from(env::var("OUT_DIR").expect("OUT_DIR not set by Cargo"));
let output_path = out_dir.join("client-cli");
let bun_tgt = BunTarget::from_cargo_env()
.map_err(|e| io::Error::other(e.to_string()))?;
let bun_tgt = BunTarget::from_cargo_env().map_err(|e| io::Error::other(e.to_string()))?;
// Optional: warn if using a Bun target thats marked unsupported in your chart
if matches!(bun_tgt, BunTarget::WindowsArm64) {
@@ -54,9 +53,9 @@ fn run_build() -> io::Result<()> {
if !install_status.success() {
let code = install_status.code().unwrap_or(1);
return Err(io::Error::other(
format!("bun install failed with status {code}"),
));
return Err(io::Error::other(format!(
"bun install failed with status {code}"
)));
}
let _target = env::var("TARGET").unwrap();

View File

@@ -25,7 +25,7 @@ fn main() -> io::Result<()> {
// Run it
let status = Command::new(&tmp).arg("--version").status()?;
if !status.success() {
return Err(io::Error::new(io::ErrorKind::Other, "client-cli failed"));
return Err(io::Error::other("client-cli failed"));
}
Ok(())

View File

@@ -205,7 +205,7 @@ impl TextGeneration {
let start_gen = std::time::Instant::now();
for (_generated_tokens, index) in (0..sample_len).enumerate() {
for index in 0..sample_len {
let context_size = if index > 0 { 1 } else { tokens.len() };
let start_pos = tokens.len().saturating_sub(context_size);
let ctxt = &tokens[start_pos..];

View File

@@ -6,10 +6,8 @@ mod gemma_api;
mod gemma_cli;
use anyhow::Error;
use clap::{Parser, ValueEnum};
use crate::gemma_cli::run_cli;
use std::io::Write;
/// just a placeholder, not used for anything
fn main() -> std::result::Result<(), Error> {

View File

@@ -28,7 +28,6 @@ struct KubeMetadata {
port: u16,
}
#[derive(Debug, Clone)]
struct ServiceInfo {
name: String,

View File

@@ -6,9 +6,6 @@ mod llama_api;
mod llama_cli;
use anyhow::Result;
use clap::{Parser, ValueEnum};
use std::io::Write;
use crate::llama_cli::run_cli;

View File

@@ -124,10 +124,7 @@ pub fn hub_load_safetensors(
}
let safetensors_files = safetensors_files
.iter()
.map(|v| {
repo.get(v)
.map_err(|e| std::io::Error::other(e))
})
.map(|v| repo.get(v).map_err(std::io::Error::other))
.collect::<Result<Vec<_>, std::io::Error>>()?;
Ok(safetensors_files)
}