fix: resolve clippy warnings (matches!, map_or, redundant guard, unnecessary allocations)
This commit is contained in:
@@ -141,6 +141,7 @@ pub(crate) struct OutputTokensDetails {
|
||||
}
|
||||
|
||||
#[derive(Serialize, Clone)]
|
||||
#[derive(Default)]
|
||||
pub(crate) struct Reasoning {
|
||||
pub effort: Option<String>,
|
||||
pub summary: Option<String>,
|
||||
@@ -161,8 +162,8 @@ impl Usage {
|
||||
/// Estimate token counts from actual text.
|
||||
/// Uses ~4 chars/token heuristic (standard GPT tokenizer average).
|
||||
pub fn estimate(input_text: &str, output_text: &str) -> Self {
|
||||
let input_tokens = (input_text.len() as u64 + 3) / 4;
|
||||
let output_tokens = (output_text.len() as u64 + 3) / 4;
|
||||
let input_tokens = (input_text.len() as u64).div_ceil(4);
|
||||
let output_tokens = (output_text.len() as u64).div_ceil(4);
|
||||
Self {
|
||||
input_tokens,
|
||||
input_tokens_details: InputTokensDetails { cached_tokens: 0 },
|
||||
@@ -189,14 +190,6 @@ impl Default for Usage {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Reasoning {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
effort: None,
|
||||
summary: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for TextFormat {
|
||||
fn default() -> Self {
|
||||
|
||||
Reference in New Issue
Block a user