From b12f156a1b5fb4f1e577b72926954b1a20865e03 Mon Sep 17 00:00:00 2001 From: Austin Schaefer Date: Mon, 17 Aug 2026 12:30:21 +0200 Subject: [PATCH] simplify: match the streamed Text item without destructuring its fields No destructuring needed since only .text is used; matching the whole Text struct and drops the now-unused rig::message::Text import. Co-Authored-By: Claude Sonnet 5 --- deep_research/src/core.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/deep_research/src/core.rs b/deep_research/src/core.rs index e1e0dcb..50ae6e4 100644 --- a/deep_research/src/core.rs +++ b/deep_research/src/core.rs @@ -5,7 +5,6 @@ use clap::Parser; use futures::StreamExt; use rig::agent::MultiTurnStreamItem; use rig::client::{AgentClientExt, Nothing}; -use rig::message::Text; use rig::providers::ollama; use rig::streaming::{StreamedAssistantContent, StreamingPrompt}; use std::io::Write; @@ -186,15 +185,12 @@ async fn write_report( while let Some(chunk) = response_stream.next().await { match chunk? { - MultiTurnStreamItem::StreamAssistantItem(StreamedAssistantContent::Text(Text { - text, - .. - })) => { - report.push_str(&text); + MultiTurnStreamItem::StreamAssistantItem(StreamedAssistantContent::Text(text)) => { + report.push_str(&text.text); // Terminal stdout is line-buffered, so a flush is needed here — // otherwise a chunk without a trailing newline sits in the // buffer instead of appearing as it streams in. - write!(handle, "{text}")?; + write!(handle, "{}", text.text)?; handle.flush()?; } _ => continue,