Skip to content

Commit

Permalink
Merge pull request #19 from dswij/patch-1
Browse files Browse the repository at this point in the history
fix syntax on pin-init rust code example
  • Loading branch information
ojeda authored Feb 11, 2024
2 parents 4864d53 + 582e154 commit 9734df2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/The-Safe-Pinned-Initialization-Problem.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ impl ListHead {
/// # Safety
///
/// Before using this [`ListHead`] the caller has to call [`ListHead::init`].
unsafe fn new() -> ListHead {
ListHead {
unsafe fn new() -> Self {
Self {
next: ptr::null_mut(),
prev: ptr::null_mut(),
}
Expand Down Expand Up @@ -86,8 +86,8 @@ impl DoubleList {
/// # Safety
///
/// Before using this [`DoubleList`] the caller has to call [`DoubleList::init`].
unsafe fn new() -> ListHead {
DoubleList {
unsafe fn new() -> Self {
Self {
// SAFETY: We call `ListHead::init` in our own initializer.
list_a: unsafe { ListHead::new() },
// SAFETY: We call `ListHead::init` in our own initializer.
Expand Down

0 comments on commit 9734df2

Please sign in to comment.