add clippy warning for string_slice (#5422)

Co-authored-by: Douwe Osinga <douwe@squareup.com>
This commit is contained in:
Zane
2025-11-04 14:46:25 -08:00
committed by GitHub
parent 687a007d26
commit 89f7384d57
22 changed files with 130 additions and 147 deletions
-8
View File
@@ -1365,17 +1365,9 @@ impl Agent {
.unwrap_or(&content)
.trim()
.to_string();
tracing::debug!(
"Cleaned content for parsing: {}",
&clean_content[..std::cmp::min(200, clean_content.len())]
);
// try to parse json response from the LLM
tracing::debug!("Attempting to parse recipe content as JSON");
let (instructions, activities) =
if let Ok(json_content) = serde_json::from_str::<Value>(&clean_content) {
tracing::debug!("Successfully parsed JSON content");
let instructions = json_content
.get("instructions")
.ok_or_else(|| anyhow!("Missing 'instructions' in json response"))?
@@ -249,7 +249,7 @@ fn extract_json_from_line(line: &str) -> Option<String> {
return None;
}
let potential_json = &line[start..=end];
let potential_json = line.get(start..=end)?;
if serde_json::from_str::<Value>(potential_json).is_ok() {
Some(potential_json.to_string())
} else {