diff --git a/crates/jstzd/src/docker/container.rs b/crates/jstzd/src/docker/container.rs index 7ba8239c5..7488f5d42 100644 --- a/crates/jstzd/src/docker/container.rs +++ b/crates/jstzd/src/docker/container.rs @@ -6,6 +6,7 @@ use bollard::Docker; use log::error; use std::sync::Arc; +#[derive(Default)] pub struct Container { pub id: String, client: Option>, @@ -13,17 +14,6 @@ pub struct Container { _private: (), } -impl Default for Container { - fn default() -> Self { - Self { - id: String::new(), - client: None, - dropped: false, - _private: (), - } - } -} - impl Container { /// Creates a new container with running `id` pub(super) fn new(client: Arc, id: String) -> Self { @@ -81,14 +71,10 @@ impl AsyncDrop for Container { } impl Drop for Container { - // same drop implementation as in async-dropper-simple crate - // https://github.com/t3hmrman/async-dropper/blob/ec6e5bbd6c894b23538cfec80375bcaefb8e5710/crates/async-dropper-simple/src/no_default_bound.rs#L111 fn drop(&mut self) { if !self.dropped { - // Prevent the copy `this` to drop again self.dropped = true; let mut this = std::mem::take(self); - // Prevent the original `self` to drop again self.dropped = true; TokioScope::scope_and_block(|s| { s.spawn(async move {