From 59520781d8bfbd9849329ffca5b94ea0fd85e5d7 Mon Sep 17 00:00:00 2001 From: chasse20 Date: Sat, 14 Nov 2026 02:09:23 -0500 Subject: [PATCH] fix: keep CI green on stable Rust --- crates/automation/src/security.rs | 2 +- crates/formats/src/dds_image.rs | 2 +- crates/formats/src/image.rs | 2 +- crates/geom/src/mesh.rs | 8 ++++---- crates/nodes/src/atomic/text.rs | 2 +- crates/render/src/preview.rs | 2 +- crates/ui-egui/src/view2d.rs | 2 +- crates/ui-egui/tests/snapshot.rs | 6 +++--- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/crates/automation/src/security.rs b/crates/automation/src/security.rs index 33040fe..fb716ee 100644 --- a/crates/automation/src/security.rs +++ b/crates/automation/src/security.rs @@ -179,7 +179,7 @@ pub struct Permit(Arc); impl ConnectionLimiter { pub fn try_acquire(&self, max: usize) -> Option { - self.0.fetch_update(Ordering::AcqRel, Ordering::Acquire, |n| (n < max).then_some(n + 1)).ok().map(|_| Permit(self.0.clone())) + self.0.try_update(Ordering::AcqRel, Ordering::Acquire, |n| (n < max).then_some(n + 1)).ok().map(|_| Permit(self.0.clone())) } } diff --git a/crates/formats/src/dds_image.rs b/crates/formats/src/dds_image.rs index e9befcb..cba769b 100644 --- a/crates/formats/src/dds_image.rs +++ b/crates/formats/src/dds_image.rs @@ -14,7 +14,7 @@ pub(crate) fn decode(bytes: &[u8], linear: bool) -> Result { dds::ImageViewMut::new(bytemuck::cast_slice_mut(&mut data), size, dds::ColorFormat::RGBA_F32).ok_or_else(|| error("Invalid DDS dimensions".into()))?; decoder.read_surface(view).map_err(|e| error(e.to_string()))?; if !linear && decoder.format().precision() != dds::Precision::F32 { - for pixel in data.chunks_exact_mut(4) { + for pixel in data.as_chunks_mut::<4>().0 { for value in pixel.iter_mut().take(3) { *value = srgb_to_linear(*value); } diff --git a/crates/formats/src/image.rs b/crates/formats/src/image.rs index 3f84054..f3fabdd 100644 --- a/crates/formats/src/image.rs +++ b/crates/formats/src/image.rs @@ -46,7 +46,7 @@ pub fn decode(bytes: &[u8], linear: bool) -> Result { let mut data = img.into_rgba32f().into_raw(); if !(float || linear) { - for px in data.chunks_exact_mut(4) { + for px in data.as_chunks_mut::<4>().0 { for c in px.iter_mut().take(3) { *c = srgb_to_linear(*c); } diff --git a/crates/geom/src/mesh.rs b/crates/geom/src/mesh.rs index 025de8b..9ef98bf 100644 --- a/crates/geom/src/mesh.rs +++ b/crates/geom/src/mesh.rs @@ -123,7 +123,7 @@ impl Mesh { /// Area-weighted smooth normals over the index buffer. pub fn compute_normals(&mut self) { let mut n = vec![Vec3::ZERO; self.positions.len()]; - for t in self.indices.chunks_exact(3) { + for t in self.indices.as_chunks::<3>().0 { let (a, b, c) = (t[0] as usize, t[1] as usize, t[2] as usize); let (Some(pa), Some(pb), Some(pc)) = (self.positions.get(a), self.positions.get(b), self.positions.get(c)) else { continue }; let face = (*pb - *pa).cross(*pc - *pa); @@ -161,7 +161,7 @@ impl Mesh { fn simple_tangents(&mut self) { let mut acc = vec![Vec3::ZERO; self.positions.len()]; - for t in self.indices.chunks_exact(3) { + for t in self.indices.as_chunks::<3>().0 { let (a, b, c) = (t[0] as usize, t[1] as usize, t[2] as usize); let (Some(pa), Some(pb), Some(pc)) = (self.positions.get(a), self.positions.get(b), self.positions.get(c)) else { continue }; let (Some(ua), Some(ub), Some(uc)) = (self.uvs.get(a), self.uvs.get(b), self.uvs.get(c)) else { continue }; @@ -211,7 +211,7 @@ impl Mesh { } } let mut shared = vec![false; self.positions.len()]; - for (_, tri) in self.indices.chunks_exact(3).enumerate().filter(|(t, _)| !is_mine.get(*t).copied().unwrap_or(false)) { + for (_, tri) in self.indices.as_chunks::<3>().0.iter().enumerate().filter(|(t, _)| !is_mine.get(*t).copied().unwrap_or(false)) { for v in tri { if let Some(s) = shared.get_mut(*v as usize) { *s = true; @@ -307,7 +307,7 @@ impl Mesh { (m.positions.len() - 1) as u32 }) }; - for t in self.indices.chunks_exact(3) { + for t in self.indices.as_chunks::<3>().0 { if t.iter().any(|&i| i as usize >= self.positions.len()) { continue; } diff --git a/crates/nodes/src/atomic/text.rs b/crates/nodes/src/atomic/text.rs index e914055..84088c4 100644 --- a/crates/nodes/src/atomic/text.rs +++ b/crates/nodes/src/atomic/text.rs @@ -104,7 +104,7 @@ fn glyph(c: char) -> &'static str { fn strokes(s: &str) -> impl Iterator> + '_ { s.split(' ') .filter(|t| !t.is_empty()) - .map(|t| t.as_bytes().chunks_exact(2).map(|p| [p[0].saturating_sub(b'0') as f32, p[1].saturating_sub(b'0') as f32]).collect()) + .map(|t| t.as_bytes().as_chunks::<2>().0.iter().map(|p| [p[0].saturating_sub(b'0') as f32, p[1].saturating_sub(b'0') as f32]).collect()) } /// Longest text drawn (an allocation cap) diff --git a/crates/render/src/preview.rs b/crates/render/src/preview.rs index a7fca3b..7ba30ba 100644 --- a/crates/render/src/preview.rs +++ b/crates/render/src/preview.rs @@ -115,7 +115,7 @@ impl Scene { // Normals of the displaced surface, shared per spot so seams don't show let moved = |i: u32| mesh.positions.get(i as usize).zip(offsets.get(i as usize)).map(|(p, o)| *p + *o); let mut face_sums: HashMap<[i32; 3], Vec3> = HashMap::new(); - for triangle in mesh.indices.chunks_exact(3) { + for triangle in mesh.indices.as_chunks::<3>().0 { let (Some(a), Some(b), Some(c)) = (moved(triangle[0]), moved(triangle[1]), moved(triangle[2])) else { continue }; let face = (b - a).cross(c - a); for spot in triangle.iter().filter_map(|&i| spots.get(i as usize)) { diff --git a/crates/ui-egui/src/view2d.rs b/crates/ui-egui/src/view2d.rs index 33d4c11..e65308b 100644 --- a/crates/ui-egui/src/view2d.rs +++ b/crates/ui-egui/src/view2d.rs @@ -24,7 +24,7 @@ const BINS: usize = 64; /// Histograms of the displayed 8-bit values: one for gray or isolated channels, else R, G and B. fn histogram(px: &[u8], channels: usize) -> Vec<[u32; BINS]> { let mut h = vec![[0u32; BINS]; channels]; - for p in px.chunks_exact(4) { + for p in px.as_chunks::<4>().0 { for (c, bins) in h.iter_mut().enumerate() { bins[p[c] as usize * BINS / 256] += 1; } diff --git a/crates/ui-egui/tests/snapshot.rs b/crates/ui-egui/tests/snapshot.rs index 5a07eef..9ef06c6 100644 --- a/crates/ui-egui/tests/snapshot.rs +++ b/crates/ui-egui/tests/snapshot.rs @@ -1468,14 +1468,14 @@ fn material_assignment_previews_outputs_and_survives_function_editing() { assert_eq!(harness.state().session.material_maps()[0].0, "baseColor"); let red_frame = harness.state().view3d.shown.clone().unwrap(); assert_ne!(before.2, red_frame.2, "assignment must invalidate the rendered frame"); - let red_pixels = red_frame.2.chunks_exact(4).filter(|pixel| u16::from(pixel[0]) > u16::from(pixel[1]) + 30).count(); + let red_pixels = red_frame.2.as_chunks::<4>().0.iter().filter(|pixel| u16::from(pixel[0]) > u16::from(pixel[1]) + 30).count(); assert!(red_pixels > 100, "the rendered mesh must show the assigned red image"); save(&mut harness, &directory, "material-assigned-red"); harness.state_mut().run("graph.node.param", json!({"id": source, "param": "color", "value": [0.02, 0.04, 0.8, 1.0]})).unwrap(); settle(&mut harness, 45); let blue_frame = harness.state().view3d.shown.clone().unwrap(); - let blue_pixels = blue_frame.2.chunks_exact(4).filter(|pixel| u16::from(pixel[2]) > u16::from(pixel[0]) + 30).count(); + let blue_pixels = blue_frame.2.as_chunks::<4>().0.iter().filter(|pixel| u16::from(pixel[2]) > u16::from(pixel[0]) + 30).count(); assert!(blue_pixels > 100, "edits must refresh the assigned material"); assert_ne!(red_frame.2, blue_frame.2); save(&mut harness, &directory, "material-assigned-blue"); @@ -1578,6 +1578,6 @@ fn explorer_inputs_and_graph_drop_share_labels_and_material_assignment() { let binding = &harness.state().session.material_preview.channels[&MaterialChannel::BaseColor]; assert_eq!((binding.graph, binding.node), (0, NodeId(output))); let frame = &harness.state().view3d.shown.as_ref().unwrap().2; - assert!(frame.chunks_exact(4).filter(|pixel| u16::from(pixel[0]) > u16::from(pixel[1]) + 30).count() > 100); + assert!(frame.as_chunks::<4>().0.iter().filter(|pixel| u16::from(pixel[0]) > u16::from(pixel[1]) + 30).count() > 100); save(&mut harness, &directory, "graph-dropped-on-material"); }