Skip to content

Commit

Permalink
Apply suggestions from review
Browse files Browse the repository at this point in the history
Co-authored-by: Magnus Ulimoen <[email protected]>
Signed-off-by: Craig Watson <686868 [email protected]>
  • Loading branch information
watsaig and mulimoen committed Feb 13, 2024
1 parent cb2a88b commit 1455a77
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
6 changes: 2 additions & 4 deletions hdf5-types/src/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 142,9 @@ impl<T: Copy fmt::Debug> fmt::Debug for VarLenArray<T> {
}
}

// Safety: `VarLenArray` allocates and frees memory for its data, which is copied
// from its original location; it never holds a reference to the data used to create it.
// Therefore if `T` is Send, so is `VarLenArray<T>`
// Safety: Memory backed by `VarLenArray` can be accessed and freed from any thread
unsafe impl<T: Copy Send> Send for VarLenArray<T> {}
// Safety: No interior mutability or potential for data races if `T` is `Sync`.
// Safety: `VarLenArray` has no interior mutability
unsafe impl<T: Copy Sync> Sync for VarLenArray<T> {}

#[cfg(test)]
Expand Down
10 changes: 4 additions & 6 deletions hdf5-types/src/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 282,9 @@ impl AsAsciiStr for VarLenAscii {
}
}

// Safety: `VarLenAscii` allocates and frees memory for its data, which is copied
// from its original location; it never holds a reference to the data used to create it.
// Safety: Memory backed by `VarLenAscii` can be accessed and freed from any thread
unsafe impl Send for VarLenAscii {}
// Safety: No interior mutability or potential for data races.
// Safety: `VarLenAscii` has no interior mutability
unsafe impl Sync for VarLenAscii {}

// ================================================================================
Expand Down Expand Up @@ -377,10 376,9 @@ impl FromStr for VarLenUnicode {
}
}

// Safety: `VarLenUnicode` allocates and frees memory for its data, which is copied
// from its original location; it never holds a reference to the data used to create it.
// Safety: Memory backed by `VarLenUnicode` can be accessed and freed from any thread
unsafe impl Send for VarLenUnicode {}
// Safety: No interior mutability or potential for data races.
// Safety: `VarLenUnicode` has no interior mutability
unsafe impl Sync for VarLenUnicode {}

// ================================================================================
Expand Down

0 comments on commit 1455a77

Please sign in to comment.