Skip to content

Commit 44def06

Browse files
Arylmeraclaude
andcommitted
fix(codex): satisfy newer clippy in the codex event parser
CI runs dtolnay/rust-toolchain@stable with no rust-toolchain.toml pin, so its clippy moved ahead of the local one and started flagging two spots in providers/codex.rs that predate this branch: - manual_filter: `.and_then(|i| if i.is_null() { None } else { Some(i) })` is `.filter(|i| !i.is_null())` - question_mark: the trailing `else { return None }` on the tool-argument extraction is `val.as_array()?` Both rewrites are behaviour-preserving; the codex provider tests cover them. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent fd0aca4 commit 44def06

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

  • crates/token-dashboard-core/src/providers

crates/token-dashboard-core/src/providers/codex.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ fn handle_event_msg(
329329
"token_count" => {
330330
if let Some(last) = payload
331331
.get("info")
332-
.and_then(|i| if i.is_null() { None } else { Some(i) })
332+
.filter(|i| !i.is_null())
333333
.and_then(|i| i.get("last_token_usage"))
334334
{
335335
let u = Usage {
@@ -599,13 +599,12 @@ fn target_from_args(name: &str, args: &str) -> Option<String> {
599599
let val = v.get(key)?;
600600
let raw = if let Some(s) = val.as_str() {
601601
s.to_string()
602-
} else if let Some(arr) = val.as_array() {
603-
arr.iter()
602+
} else {
603+
val.as_array()?
604+
.iter()
604605
.filter_map(|x| x.as_str())
605606
.collect::<Vec<_>>()
606607
.join(" ")
607-
} else {
608-
return None;
609608
};
610609
Some(raw.chars().take(500).collect())
611610
}

0 commit comments

Comments
 (0)