Merge pull request #2793 from zeroclaw-labs/issue-2747-clippy-critical-debt-dev

chore(quality): reduce high-impact clippy debt in critical modules
This commit is contained in:
Argenis 2026-03-05 01:54:41 -05:00 committed by GitHub
commit bc923335cb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 33 additions and 19 deletions

View File

@ -290,13 +290,23 @@ fn is_audio_attachment(content_type: &str, filename: &str, url: &str) -> bool {
}
fn parse_attachment_duration_secs(attachment: &serde_json::Value) -> Option<u64> {
let raw = attachment
.get("duration_secs")
.and_then(|value| value.as_f64().or_else(|| value.as_u64().map(|v| v as f64)))?;
let value = attachment.get("duration_secs")?;
if let Some(seconds) = value.as_u64() {
return Some(seconds);
}
let raw = value.as_f64()?;
if !raw.is_finite() || raw.is_sign_negative() {
return None;
}
Some(raw.ceil() as u64)
let rounded = raw.ceil();
if rounded > u64::MAX as f64 {
return None;
}
format!("{rounded:.0}").parse().ok()
}
fn extension_from_media_path(value: &str) -> Option<String> {

View File

@ -3350,11 +3350,11 @@ Reminder set successfully."#;
event_tx: tokio::sync::broadcast::channel(16).0,
};
let response = handle_nextcloud_talk_webhook(
let response = Box::pin(handle_nextcloud_talk_webhook(
State(state),
HeaderMap::new(),
Bytes::from_static(br#"{"type":"message"}"#),
)
))
.await
.into_response();
@ -3419,9 +3419,13 @@ Reminder set successfully."#;
HeaderValue::from_str(invalid_signature).unwrap(),
);
let response = handle_nextcloud_talk_webhook(State(state), headers, Bytes::from(body))
.await
.into_response();
let response = Box::pin(handle_nextcloud_talk_webhook(
State(state),
headers,
Bytes::from(body),
))
.await
.into_response();
assert_eq!(response.status(), StatusCode::UNAUTHORIZED);
assert_eq!(provider_impl.calls.load(Ordering::SeqCst), 0);
}
@ -3461,11 +3465,11 @@ Reminder set successfully."#;
event_tx: tokio::sync::broadcast::channel(16).0,
};
let response = handle_qq_webhook(
let response = Box::pin(handle_qq_webhook(
State(state),
HeaderMap::new(),
Bytes::from_static(br#"{"op":13,"d":{"plain_token":"p","event_ts":"1"}}"#),
)
))
.await
.into_response();
assert_eq!(response.status(), StatusCode::NOT_FOUND);
@ -3515,13 +3519,13 @@ Reminder set successfully."#;
let mut headers = HeaderMap::new();
headers.insert("X-Bot-Appid", HeaderValue::from_static("11111111"));
let response = handle_qq_webhook(
let response = Box::pin(handle_qq_webhook(
State(state),
headers,
Bytes::from_static(
br#"{"op":13,"d":{"plain_token":"Arq0D5A61EgUu4OxUvOp","event_ts":"1725442341"}}"#,
),
)
))
.await
.into_response();
assert_eq!(response.status(), StatusCode::OK);

View File

@ -814,17 +814,17 @@ async fn main() -> Result<()> {
bail!("--channels-only does not accept --force");
}
let config = if channels_only {
onboard::run_channels_repair_wizard().await
Box::pin(onboard::run_channels_repair_wizard()).await
} else if interactive {
onboard::run_wizard(force).await
Box::pin(onboard::run_wizard(force)).await
} else {
onboard::run_quick_setup(
Box::pin(onboard::run_quick_setup(
api_key.as_deref(),
provider.as_deref(),
model.as_deref(),
memory.as_deref(),
force,
)
))
.await
}?;
// Auto-start channels if user said yes during wizard
@ -886,7 +886,7 @@ async fn main() -> Result<()> {
if let Some(ref backend) = memory_backend {
config.memory.backend = backend.clone();
}
agent::run(
Box::pin(agent::run(
config,
message,
provider,
@ -894,7 +894,7 @@ async fn main() -> Result<()> {
temperature,
peripheral,
true,
)
))
.await
.map(|_| ())
}