2
0
Fork 1
mirror of https://github.com/async-rs/async-std.git synced 2025-10-20 09:06:36 +00:00
This commit is contained in:
l 2025-08-19 00:25:50 +08:00 committed by GitHub
commit c01ba6d1d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -11,7 +11,6 @@ use crate::fs::{Metadata, Permissions};
use crate::future; use crate::future;
use crate::io::{self, Read, Seek, SeekFrom, Write}; use crate::io::{self, Read, Seek, SeekFrom, Write};
use crate::path::Path; use crate::path::Path;
use crate::prelude::*;
use crate::task::{spawn_blocking, Context, Poll, Waker}; use crate::task::{spawn_blocking, Context, Poll, Waker};
use crate::utils::Context as _; use crate::utils::Context as _;
@ -317,7 +316,7 @@ impl Drop for File {
// non-blocking fashion, but our only other option here is losing data remaining in the // non-blocking fashion, but our only other option here is losing data remaining in the
// write cache. Good task schedulers should be resilient to occasional blocking hiccups in // write cache. Good task schedulers should be resilient to occasional blocking hiccups in
// file destructors so we don't expect this to be a common problem in practice. // file destructors so we don't expect this to be a common problem in practice.
let _ = futures_lite::future::block_on(self.flush()); (&*self.file).flush().ok();
} }
} }
@ -957,6 +956,7 @@ impl LockGuard<State> {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use crate::prelude::*;
#[test] #[test]
fn async_file_drop() { fn async_file_drop() {