Skip to content

Commit 68fdc6c

Browse files
authored
inline take_inner impl
1 parent bbdeb5f commit 68fdc6c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/libs/maintaining-std.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,10 @@ struct OptionCell<T> {
201201

202202
impl<T> Drop for OptionCell<T> {
203203
fn drop(&mut self) {
204-
// Safety: The cell is being dropped, so it can't be accessed again.
205-
unsafe { self.take_inner() };
204+
if self.is_init {
205+
// Safety: The cell is being dropped, so it can't be accessed again.
206+
let _ = unsafe { self.value.read() };
207+
}
206208
}
207209
}
208210
```

0 commit comments

Comments
 (0)