Skip to content

Commit 63b8426

Browse files
committed
Migrate to edition 2024
1 parent 31f59c1 commit 63b8426

File tree

5 files changed

+12
-7
lines changed

5 files changed

+12
-7
lines changed

splashsurf/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ description = "Command-line tool for surface reconstruction of SPH particle data
77
keywords = ["sph", "particle", "surface", "reconstruction", "marching-cubes"]
88
categories = ["command-line-utilities", "graphics", "science", "simulation", "visualization"]
99
readme = "README.md"
10-
edition = "2021"
10+
edition = "2024"
1111

1212
homepage = "https://splashsurf.physics-simulation.org"
1313
repository = "https://github.com/InteractiveComputerGraphics/splashsurf"

splashsurf/src/allocator.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ pub struct CountingAllocator<A: GlobalAlloc> {
1111
// TODO: Is Ordering::AcqRel ok to use?
1212

1313
unsafe impl<A: GlobalAlloc> GlobalAlloc for CountingAllocator<A> {
14+
/// Allocates memory and counts the number of bytes allocated (current and peak allocation).
15+
/// Safety: See [`GlobalAlloc::alloc`].
1416
unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
15-
let ret = self.allocator.alloc(layout);
17+
let ret = unsafe { self.allocator.alloc(layout) };
1618
if !ret.is_null() {
1719
let old_allocation = self
1820
.current_allocation
@@ -24,8 +26,10 @@ unsafe impl<A: GlobalAlloc> GlobalAlloc for CountingAllocator<A> {
2426
ret
2527
}
2628

29+
/// Deallocates memory and counts the number of bytes deallocated.
30+
/// Safety: See [`GlobalAlloc::dealloc`].
2731
unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) {
28-
self.allocator.dealloc(ptr, layout);
32+
unsafe { self.allocator.dealloc(ptr, layout) };
2933
self.current_allocation
3034
.fetch_sub(layout.size() as u64, Ordering::AcqRel);
3135
}

splashsurf_lib/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ description = "Library for surface reconstruction of SPH particle data"
77
keywords = ["sph", "particle", "surface", "reconstruction", "marching-cubes"]
88
categories = ["graphics", "science", "simulation", "visualization", "rendering"]
99
readme = "README.md"
10-
edition = "2021"
10+
edition = "2024"
1111

1212
homepage = "https://splashsurf.physics-simulation.org"
1313
repository = "https://github.com/InteractiveComputerGraphics/splashsurf"

splashsurf_lib/src/mesh.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -751,8 +751,8 @@ impl<R: Real> TriMesh3d<R> {
751751
/// The other mesh will be empty after this operation.
752752
pub fn append(&mut self, other: &mut TriMesh3d<R>) {
753753
let TriMesh3d {
754-
vertices: ref mut new_verts,
755-
triangles: ref mut new_tris,
754+
vertices: new_verts,
755+
triangles: new_tris,
756756
} = other;
757757

758758
let vertex_offset = self.vertices.len();

splashsurf_lib/src/utils.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,11 @@ impl<'a, T> UnsafeSlice<'a, T> {
163163

164164
/// Returns a mutable reference to an element of the wrapped slice without doing bounds checking, simultaneous access has to be disjoint!
165165
/// SAFETY: It is unsound to obtain two mutable references to the same index.
166+
/// SAFETY: Calling this method with an out-of-bounds index is undefined behavior.
166167
#[allow(clippy::mut_from_ref)]
167168
pub unsafe fn get_mut_unchecked(&self, i: usize) -> &mut T {
168169
debug_assert!(i < self.len(), "index out of bounds");
169-
&mut *self.slice.get_unchecked(i).get()
170+
unsafe { &mut *self.slice.get_unchecked(i).get() }
170171
}
171172
}
172173

0 commit comments

Comments
 (0)