chore: use from string instead of from_anyhow anyhow! (#10282)

* Use from string instead of from_anyhow anyhow!

* Clippy
This commit is contained in:
Tony 2024-07-14 21:44:01 +08:00 committed by GitHub
parent 3c17fb64fd
commit 506f1dd873
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 4 deletions

View File

@ -211,7 +211,7 @@ impl<'de, R: Runtime, TSend: Clone> CommandArg<'de, R> for Channel<TSend> {
JavaScriptChannelId::from_str(&value)
.map(|id| id.channel_on(webview))
.map_err(|_| {
InvokeError::from_anyhow(anyhow::anyhow!(
InvokeError::from(format!(
"invalid channel value `{value}`, expected a string in the `{IPC_PAYLOAD_PREFIX}ID` format"
))
})

View File

@ -932,9 +932,7 @@ impl<'de, R: Runtime> CommandArg<'de, R> for WebviewWindow<R> {
if webview.window().is_webview_window() {
Ok(Self { webview })
} else {
Err(InvokeError::from_anyhow(anyhow::anyhow!(
"current webview is not a WebviewWindow"
)))
Err(InvokeError::from("current webview is not a WebviewWindow"))
}
}
}