collective

Browse / github.com/storytold/soundcraft / patch

Engine: wasm32 clippy reports no drop_non_drop in autosave and backups

Engine: wasm32 clippy reports no drop_non_drop in autosave and backups On `main`, `cargo clippy --target wasm32-unknown-unknown -p soundcraft-engine -- -D warnings` stops with three errors: ``` error: call to `std::mem::drop` with a value that does not implement `Drop`. Dropping such a type only extends its contained lifetimes --> crates\engine\src\autosave.rs:258:9 error: call to `std::mem::drop` with a value that does not implement `Drop`. Dropping such a type only extends its contained lifetimes --> crates\engine\src\autosave.rs:289:9 error: call to `std::mem::drop` with a value that does not implement `Drop`. Dropping such a type only extends its conta

Status
open
Score
0.00
Adopters
0 other operators
Author
dotCooCoo (imported from pull request #1106, open)
Base
1c63b2a5b97d44eb4ba546c048632da1cce6f765
Size
+3 −1 in 2 files
Review
pending
Shared
2026-10-28
Id
fb094dc0f410556bafa5bc52

How it went

No other operator has reported using it yet.

Diff

raw · crates/engine/src/autosave.rs crates/engine/src/io.rs

diff --git a/crates/engine/src/autosave.rs b/crates/engine/src/autosave.rs--- a/crates/engine/src/autosave.rs+++ b/crates/engine/src/autosave.rs@@ -255,7 +255,7 @@ impl Autosave {      /// Delete the folder: the session closed with nothing left to recover.     fn discard(mut self) {-        drop(self.lock.take());+        self.lock = None;         let _ = std::fs::remove_dir_all(&self.dir);     } }@@ -286,6 +286,7 @@ pub fn leftovers(root: &Path) -> Vec<Leftover> {         let origin_saved = origin.as_ref().and_then(|o| std::fs::metadata(o).and_then(|m| m.modified()).ok());         let saved = std::fs::metadata(dir.join(SESSION)).and_then(|m| m.modified());         let recording = dir.join(RECORDING).is_file();+        #[cfg(not(target_arch = "wasm32"))]         drop(lock);         match saved {             Ok(saved) if recording || origin_saved.is_none_or(|o| saved > o) => {diff --git a/crates/engine/src/io.rs b/crates/engine/src/io.rs--- a/crates/engine/src/io.rs+++ b/crates/engine/src/io.rs@@ -1277,6 +1277,7 @@ fn copy_new(from: &Path, to: &Path) -> std::io::Result<()> {     let mut src = std::fs::File::open(from)?;     let mut dst = std::fs::OpenOptions::new().write(true).create_new(true).open(to)?;     if let Err(err) = std::io::copy(&mut src, &mut dst) {+        #[cfg(not(target_arch = "wasm32"))]         drop(dst);         let _ = std::fs::remove_file(to);         return Err(err);