Skip to content

Commit 14e37b8

Browse files
committed
fix bug in Ptr::with that it was writing back changes in a read-only method
1 parent 5be4f50 commit 14e37b8

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

libcc2rs/src/rc.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -485,10 +485,7 @@ impl<T> Ptr<T> {
485485
let mut buf = vec![0u8; std::mem::size_of::<T>()];
486486
data.read_bytes(self.offset, &mut buf);
487487
let val = T::from_bytes(&buf);
488-
let ret = f(&val);
489-
val.to_bytes(&mut buf);
490-
data.write_bytes(self.offset, &buf);
491-
ret
488+
f(&val)
492489
}
493490
}
494491
}

0 commit comments

Comments
 (0)