Skip to content

Commit bde76ac

Browse files
committed
chore: replace ".unwrap()" in the example with simple "if let"
1 parent b296411 commit bde76ac

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

examples/mcp-clients/rust-client/examples/basic_client.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,9 @@ async fn main() -> Result<()> {
105105
if !result.content.is_empty() {
106106
info!("Generated password:");
107107
for content_item in &result.content {
108-
let x = content_item.as_text().unwrap().text.to_string();
109-
info!("{}", x);
108+
if let Some(text) = content_item.as_text() {
109+
info!("{}", text.text);
110+
}
110111
}
111112
}
112113
}

0 commit comments

Comments
 (0)