fix: keep CI green on stable Rust

This commit is contained in:
chasse20 committed 2026-11-14 02:09:23 -05:00
1 parent 7f8c920b5f
commit 59520781d8
8 files changed
+13 -13

No files matched your search

+1 -1
View File
@@ -179,7 +179,7 @@ pub struct Permit(Arc<AtomicUsize>);
impl ConnectionLimiter {
pub fn try_acquire(&self, max: usize) -> Option<Permit> {
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()))
}
}
+1 -1
View File
@@ -14,7 +14,7 @@ pub(crate) fn decode(bytes: &[u8], linear: bool) -> Result<Image> {
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);
}
+1 -1
View File
@@ -46,7 +46,7 @@ pub fn decode(bytes: &[u8], linear: bool) -> Result<Image> {
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);
}
+4 -4
View File
@@ -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;
}
+1 -1
View File
@@ -104,7 +104,7 @@ fn glyph(c: char) -> &'static str {
fn strokes(s: &str) -> impl Iterator<Item = Vec<[f32; 2]>> + '_ {
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)
+1 -1
View File
@@ -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)) {
+1 -1
View File
@@ -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;
}
+3 -3
View File
@@ -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");
}