mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-02 15:56:09 +03:00
core: convert io::Res over to the Drop trait
This commit is contained in:
+6
-3
@@ -1108,10 +1108,13 @@ pub enum Level {
|
||||
// Artifacts that need to fsync on destruction
|
||||
pub struct Res<t: Copy> {
|
||||
arg: Arg<t>,
|
||||
drop {
|
||||
}
|
||||
|
||||
impl<T: Copy> Res<T>: Drop {
|
||||
fn finalize(&self) {
|
||||
match self.arg.opt_level {
|
||||
option::None => (),
|
||||
option::Some(level) => {
|
||||
None => (),
|
||||
Some(level) => {
|
||||
// fail hard if not succesful
|
||||
assert((self.arg.fsync_fn)(self.arg.val, level) != -1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user