Skip to content

Commit e22d2bc

Browse files
committed
core: convert io::Res over to the Drop trait
1 parent e4d4a14 commit e22d2bc

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/libcore/io.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,10 +1108,13 @@ pub mod fsync {
11081108
// Artifacts that need to fsync on destruction
11091109
pub struct Res<t: Copy> {
11101110
arg: Arg<t>,
1111-
drop {
1111+
}
1112+
1113+
impl<T: Copy> Res<T>: Drop {
1114+
fn finalize(&self) {
11121115
match self.arg.opt_level {
1113-
option::None => (),
1114-
option::Some(level) => {
1116+
None => (),
1117+
Some(level) => {
11151118
// fail hard if not succesful
11161119
assert((self.arg.fsync_fn)(self.arg.val, level) != -1);
11171120
}

0 commit comments

Comments
 (0)