Fix clippy::unused_async
This commit is contained in:
parent
f8f1a86344
commit
432d9f5f97
3 changed files with 22 additions and 12 deletions
|
|
@ -8,7 +8,8 @@ clippy --workspace --no-deps -- \
|
|||
-D clippy::match-wildcard-for-single-variants \
|
||||
-D clippy::redundant-closure-for-method-calls \
|
||||
-D clippy::filter_map_next \
|
||||
-D clippy::manual_let_else
|
||||
-D clippy::manual_let_else \
|
||||
-D clippy::unused_async
|
||||
"""
|
||||
|
||||
nitpick = """
|
||||
|
|
|
|||
|
|
@ -7,7 +7,11 @@ publish = false
|
|||
|
||||
[dependencies]
|
||||
iced.workspace = true
|
||||
iced.features = ["debug", "image", "advanced"]
|
||||
iced.features = ["debug", "image", "advanced", "tokio"]
|
||||
|
||||
image.workspace = true
|
||||
image.features = ["png"]
|
||||
|
||||
tokio.workspace = true
|
||||
|
||||
image = { workspace = true, features = ["png"]}
|
||||
tracing-subscriber = "0.3"
|
||||
|
|
@ -273,6 +273,8 @@ impl Application for Example {
|
|||
|
||||
async fn save_to_png(screenshot: Screenshot) -> Result<String, PngError> {
|
||||
let path = "screenshot.png".to_string();
|
||||
|
||||
tokio::task::spawn_blocking(move || {
|
||||
img::save_buffer(
|
||||
&path,
|
||||
&screenshot.bytes,
|
||||
|
|
@ -282,6 +284,9 @@ async fn save_to_png(screenshot: Screenshot) -> Result<String, PngError> {
|
|||
)
|
||||
.map(|_| path)
|
||||
.map_err(|err| PngError(format!("{err:?}")))
|
||||
})
|
||||
.await
|
||||
.expect("Blocking task to finish")
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue