Skip to content

Commit 1455a77

Browse files
watsaigmulimoen
andauthored
Apply suggestions from review
Co-authored-by: Magnus Ulimoen <[email protected]> Signed-off-by: Craig Watson <[email protected]>
1 parent cb2a88b commit 1455a77

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

hdf5-types/src/array.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,9 @@ impl<T: Copy + fmt::Debug> fmt::Debug for VarLenArray<T> {
142142
}
143143
}
144144

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

152150
#[cfg(test)]

hdf5-types/src/string.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -282,10 +282,9 @@ impl AsAsciiStr for VarLenAscii {
282282
}
283283
}
284284

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

291290
// ================================================================================
@@ -377,10 +376,9 @@ impl FromStr for VarLenUnicode {
377376
}
378377
}
379378

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

386384
// ================================================================================

0 commit comments

Comments
 (0)