Skip to content

Commit

Permalink
Merge pull request #2305 from kornelski/rayon-pub
Browse files Browse the repository at this point in the history
Mark rayon as a public dependency
  • Loading branch information
HeroicKatora authored Aug 14, 2024
2 parents e176cd4 + 7a9937e commit 285496d
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ jobs:
run: |
echo "#![deny(exported_private_dependencies)]" | cat - src/lib.rs > src/lib.rs.0
mv src/lib.rs.0 src/lib.rs
echo 'cargo-features = ["public-dependency"]' | cat - Cargo.toml > Cargo.toml.0
echo 'cargo-features = ["public-dependency"]' | cat - Cargo.toml | sed 's/rayon = { ver/rayon = { public = true, ver/' > Cargo.toml.0
mv Cargo.toml.0 Cargo.toml
cargo check
Expand Down
2 changes: 1 addition & 1 deletion src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1566,7 +1566,7 @@ mod test {
let val = a.pixels_mut().next().unwrap();
*val = Rgb([42, 0, 0]);
}
assert_eq!(a.data[0], 42)
assert_eq!(a.data[0], 42);
}

#[test]
Expand Down
4 changes: 2 additions & 2 deletions src/codecs/jpeg/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,9 +398,9 @@ impl<W: Write> JpegEncoder<W> {

let mut tables = vec![STD_LUMA_QTABLE, STD_CHROMA_QTABLE];
tables.iter_mut().for_each(|t| {
t.iter_mut().for_each(|v| {
for v in t.iter_mut() {
*v = clamp((u32::from(*v) * scale + 50) / 100, 1, u32::from(u8::MAX)) as u8;
});
}
});

JpegEncoder {
Expand Down
2 changes: 1 addition & 1 deletion src/codecs/openexr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ impl<R: BufRead + Seek> ImageDecoder for OpenExrDecoder<R> {
assert!(
!has_invalid_size_or_overflowed,
"byte buffer not large enough for the specified dimensions and f32 pixels"
)
);
}

let result = read()
Expand Down
4 changes: 2 additions & 2 deletions src/codecs/pnm/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -663,9 +663,9 @@ impl<R: Read> PnmDecoder<R> {
let factor = target_sample_max as f32 / current_sample_max as f32;

if S::sample_size() == 1 {
buf.iter_mut().for_each(|v| {
for v in buf.iter_mut() {
*v = (f32::from(*v) * factor).round() as u8;
});
}
} else if S::sample_size() == 2 {
for chunk in buf.chunks_exact_mut(2) {
let v = NativeEndian::read_u16(chunk);
Expand Down
5 changes: 2 additions & 3 deletions src/flat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,8 @@ impl SampleLayout {
Some(size) => size,
};

match max_dim.checked_len() {
None => return true,
Some(_) => (), // Only want to know this didn't overflow.
if max_dim.checked_len().is_none() {
return true;
};

// Each higher dimension must walk over all of one lower dimension.
Expand Down
2 changes: 1 addition & 1 deletion src/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1799,7 +1799,7 @@ mod tests {

#[test]
fn all() {
let all_formats: HashSet<ImageFormat> = HashSet::from_iter(ImageFormat::all());
let all_formats: HashSet<ImageFormat> = ImageFormat::all().collect();
assert!(all_formats.contains(&ImageFormat::Avif));
assert!(all_formats.contains(&ImageFormat::Gif));
assert!(all_formats.contains(&ImageFormat::Bmp));
Expand Down
2 changes: 1 addition & 1 deletion tests/reference_images.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ fn check_hdr_references() {
.rev()
{
if let Normal(name) = *c {
ref_path.push(name)
ref_path.push(name);
} else {
panic!()
}
Expand Down

0 comments on commit 285496d

Please sign in to comment.