Skip to content

Commit

Permalink
Fix clippy errors
Browse files Browse the repository at this point in the history
  • Loading branch information
silvia-odwyer committed Oct 31, 2024
1 parent 3cdcd0e commit a2d522a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions crate/src/noise.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use wasm_bindgen::prelude::*;
#[cfg(all(target_family = "wasm", not(target_os = "wasi")))]
use js_sys::Math::random;

#[cfg(not(all(target_arch = "wasm", not(target_os = "wasi"))))]
#[cfg(not(all(target_arch = "wasm64", not(target_os = "wasi"))))]
use rand::Rng;

/// Add randomized noise to an image.
Expand Down Expand Up @@ -43,10 +43,10 @@ pub fn add_noise_rand(photon_image: &mut PhotonImage) {
let mut rng = rand::thread_rng();

for (x, y) in ImageIterator::with_dimension(&img.dimensions()) {
#[cfg(not(all(target_arch = "wasm", not(target_os = "wasi"))))]
#[cfg(not(all(target_arch = "wasm64", not(target_os = "wasi"))))]
let offset = rng.gen_range(0, 150);

#[cfg(all(target_arch = "wasm", not(target_os = "wasi")))]
#[cfg(all(target_arch = "wasm64", not(target_os = "wasi")))]
let offset = (random() * 150.0) as u8;

let px =
Expand Down Expand Up @@ -84,13 +84,13 @@ pub fn add_noise_rand(photon_image: &mut PhotonImage) {
#[cfg_attr(feature = "enable_wasm", wasm_bindgen)]
pub fn pink_noise(photon_image: &mut PhotonImage) {
let mut img = helpers::dyn_image_from_raw(photon_image);
#[cfg(not(all(target_arch = "wasm", not(target_os = "wasi"))))]
#[cfg(not(all(target_arch = "wasm64", not(target_os = "wasi"))))]
let mut rng = rand::thread_rng();

#[cfg(not(all(target_arch = "wasm", not(target_os = "wasi"))))]
#[cfg(not(all(target_arch = "wasm64", not(target_os = "wasi"))))]
let mut rng_gen = move || rng.gen();

#[cfg(all(target_arch = "wasm", not(target_os = "wasi")))]
#[cfg(all(target_arch = "wasm64", not(target_os = "wasi")))]
let rng_gen = || random();

for (x, y) in ImageIterator::with_dimension(&img.dimensions()) {
Expand Down

0 comments on commit a2d522a

Please sign in to comment.