RPG-Alex / project-julia

A Web Assembly Adaptation of a procedurally generated image based on Julia Sets
2 stars 1 forks source link

Project Gradient Method Issue after Rebase #12

Closed RPG-Alex closed 8 months ago

RPG-Alex commented 8 months ago

Given we had a few PRs together, I rebased the project and there now appears to be an used method in the color_gradient.rs:

warning: associated function `new` is never used
  --> src/color_gradient.rs:38:10
   |
35 | impl<const N: usize> ColorGradient<N>
   | ------------------------------------- associated function in this implementation
...
38 |   pub fn new(colors: [Rgba; N], tresholds: [f32; N]) -> Self { Self { colors, tresholds } }
   |          ^^^
   |
   = note: `#[warn(dead_code)]` on by default

warning: `project-julia` (bin "project-julia") generated 1 warning

Its showing through the warning when running cargo check

It looks like this just hasn't been implemented yet, in which case we need to implement it, but if it was implemented and somehow lost in the rebase that needs to be fixed too.

Silzinc commented 8 months ago

As far as I understand it, the compiler just throws a warning because the function is dead code (i.e. unused). I wrote this function to have a standardized constructor in case we want to create other gradients.

If this is really an issue, maybe this function could just be made const and used to define DEFAULT_COLOR_GRADIENT.

RPG-Alex commented 8 months ago

That makes sense. I was going to suggest keeping it as a constructor, but adding the _, but your solution has been implemented and will work too. Closing issue.