Skip to content

Added coloring_function to MandelbrotModel

Sign in for the full log view
GitHub Actions / clippy succeeded Sep 19, 2023 in 0s

clippy

37 warnings

Details

Results

Message level Amount
Internal compiler error 0
Error 0
Warning 37
Note 0
Help 0

Versions

  • rustc 1.72.0 (5680fa18f 2023-08-23)
  • cargo 1.72.0 (103a7ff2e 2023-08-15)
  • clippy 0.1.72 (5680fa1 2023-08-23)

Annotations

Check warning on line 513 in src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

consider adding a `;` to the last statement for consistent formatting

warning: consider adding a `;` to the last statement for consistent formatting
   --> src/lib.rs:513:9
    |
513 |         println!("Window closed, application exited gracefully.")
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `println!("Window closed, application exited gracefully.");`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned

Check warning on line 457 in src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

temporary with significant `Drop` can be early dropped

warning: temporary with significant `Drop` can be early dropped
   --> src/lib.rs:457:21
    |
456 |           || {
    |  ____________-
457 | |             let mut mandelbrot_model = MandelbrotModel::get_instance();
    | |                     ^^^^^^^^^^^^^^^^
458 | |             mandelbrot_model.config.supersampling_amount = ask::<u8>("supersampling_amount").clamp(1, 64);
459 | |             render(&mut mandelbrot_model);
460 | |         },
    | |_________- temporary `mandelbrot_model` is currently being dropped at the end of its contained scope
    |
    = note: this might lead to unnecessary resource contention
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#significant_drop_tightening
help: merge the temporary construction with its single usage
    |
457 ~             
458 +             MandelbrotModel::get_instance().;
    |
help: remove separated single usage
    |
458 -             mandelbrot_model.config.supersampling_amount = ask::<u8>("supersampling_amount").clamp(1, 64);
458 +             
    |

Check warning on line 448 in src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

temporary with significant `Drop` can be early dropped

warning: temporary with significant `Drop` can be early dropped
   --> src/lib.rs:448:21
    |
447 |           || {
    |  ____________-
448 | |             let mut mandelbrot_model = MandelbrotModel::get_instance();
    | |                     ^^^^^^^^^^^^^^^^
449 | |             mandelbrot_model.p.color_channel_mapping = ask("color_channel_mapping");
450 | |             render(&mut mandelbrot_model);
451 | |         },
    | |_________- temporary `mandelbrot_model` is currently being dropped at the end of its contained scope
    |
    = note: this might lead to unnecessary resource contention
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#significant_drop_tightening
help: merge the temporary construction with its single usage
    |
448 ~             
449 +             MandelbrotModel::get_instance().;
    |
help: remove separated single usage
    |
449 -             mandelbrot_model.p.color_channel_mapping = ask("color_channel_mapping");
449 +             
    |

Check warning on line 440 in src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

temporary with significant `Drop` can be early dropped

warning: temporary with significant `Drop` can be early dropped
   --> src/lib.rs:440:17
    |
439 |       key_bindings.add(Key::M, "Change the Mandelbrot set view max_iterations", || {
    |  __________________________________________________________________________________-
440 | |         let mut mandelbrot_model = MandelbrotModel::get_instance();
    | |                 ^^^^^^^^^^^^^^^^
441 | |         mandelbrot_model.m.max_iterations = ask("max_iterations");
442 | |         render(&mut mandelbrot_model);
443 | |     });
    | |_____- temporary `mandelbrot_model` is currently being dropped at the end of its contained scope
    |
    = note: this might lead to unnecessary resource contention
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#significant_drop_tightening
help: merge the temporary construction with its single usage
    |
440 ~         
441 +         MandelbrotModel::get_instance().;
    |
help: remove separated single usage
    |
441 -         mandelbrot_model.m.max_iterations = ask("max_iterations");
441 +         
    |

Check warning on line 434 in src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

temporary with significant `Drop` can be early dropped

warning: temporary with significant `Drop` can be early dropped
   --> src/lib.rs:434:17
    |
433 |       key_bindings.add(Key::I, "Manually input a Mandelbrot set view", || {
    |  _________________________________________________________________________-
434 | |         let mut mandelbrot_model = MandelbrotModel::get_instance();
    | |                 ^^^^^^^^^^^^^^^^
435 | |         mandelbrot_model.c.set_view(&View::new(ask("x"), ask("y"), ask("scale")));
436 | |         render(&mut mandelbrot_model);
437 | |     });
    | |_____- temporary `mandelbrot_model` is currently being dropped at the end of its contained scope
    |
    = note: this might lead to unnecessary resource contention
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#significant_drop_tightening
help: merge the temporary construction with its single usage
    |
434 ~         
435 +         MandelbrotModel::get_instance().set_view(&View::new(ask("x"), ask("y"), ask("scale")));
    |
help: remove separated single usage
    |
435 -         mandelbrot_model.c.set_view(&View::new(ask("x"), ask("y"), ask("scale")));
435 +         
    |

Check warning on line 407 in src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

strict comparison of `f32` or `f64`

warning: strict comparison of `f32` or `f64`
   --> src/lib.rs:407:16
    |
407 |             if mandelbrot_model.config.window_scale == 1.0 {
    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(mandelbrot_model.config.window_scale - 1.0).abs() < error_margin`
    |
    = note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#float_cmp
    = note: `#[warn(clippy::float_cmp)]` implied by `#[warn(clippy::pedantic)]`

Check warning on line 398 in src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

consider adding a `;` to the last statement for consistent formatting

warning: consider adding a `;` to the last statement for consistent formatting
   --> src/lib.rs:398:9
    |
398 |         set_view(&mut MandelbrotModel::get_instance(), &VIEW_0)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `set_view(&mut MandelbrotModel::get_instance(), &VIEW_0);`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned

Check warning on line 395 in src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

consider adding a `;` to the last statement for consistent formatting

warning: consider adding a `;` to the last statement for consistent formatting
   --> src/lib.rs:395:9
    |
395 |         set_view(&mut MandelbrotModel::get_instance(), &VIEW_9)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `set_view(&mut MandelbrotModel::get_instance(), &VIEW_9);`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned

Check warning on line 392 in src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

consider adding a `;` to the last statement for consistent formatting

warning: consider adding a `;` to the last statement for consistent formatting
   --> src/lib.rs:392:9
    |
392 |         set_view(&mut MandelbrotModel::get_instance(), &VIEW_8)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `set_view(&mut MandelbrotModel::get_instance(), &VIEW_8);`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned

Check warning on line 389 in src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

consider adding a `;` to the last statement for consistent formatting

warning: consider adding a `;` to the last statement for consistent formatting
   --> src/lib.rs:389:9
    |
389 |         set_view(&mut MandelbrotModel::get_instance(), &VIEW_7)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `set_view(&mut MandelbrotModel::get_instance(), &VIEW_7);`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned

Check warning on line 386 in src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

consider adding a `;` to the last statement for consistent formatting

warning: consider adding a `;` to the last statement for consistent formatting
   --> src/lib.rs:386:9
    |
386 |         set_view(&mut MandelbrotModel::get_instance(), &VIEW_6)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `set_view(&mut MandelbrotModel::get_instance(), &VIEW_6);`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned

Check warning on line 383 in src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

consider adding a `;` to the last statement for consistent formatting

warning: consider adding a `;` to the last statement for consistent formatting
   --> src/lib.rs:383:9
    |
383 |         set_view(&mut MandelbrotModel::get_instance(), &VIEW_5)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `set_view(&mut MandelbrotModel::get_instance(), &VIEW_5);`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned

Check warning on line 380 in src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

consider adding a `;` to the last statement for consistent formatting

warning: consider adding a `;` to the last statement for consistent formatting
   --> src/lib.rs:380:9
    |
380 |         set_view(&mut MandelbrotModel::get_instance(), &VIEW_4)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `set_view(&mut MandelbrotModel::get_instance(), &VIEW_4);`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned

Check warning on line 377 in src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

consider adding a `;` to the last statement for consistent formatting

warning: consider adding a `;` to the last statement for consistent formatting
   --> src/lib.rs:377:9
    |
377 |         set_view(&mut MandelbrotModel::get_instance(), &VIEW_3)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `set_view(&mut MandelbrotModel::get_instance(), &VIEW_3);`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned

Check warning on line 374 in src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

consider adding a `;` to the last statement for consistent formatting

warning: consider adding a `;` to the last statement for consistent formatting
   --> src/lib.rs:374:9
    |
374 |         set_view(&mut MandelbrotModel::get_instance(), &VIEW_2)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `set_view(&mut MandelbrotModel::get_instance(), &VIEW_2);`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned

Check warning on line 371 in src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

consider adding a `;` to the last statement for consistent formatting

warning: consider adding a `;` to the last statement for consistent formatting
   --> src/lib.rs:371:9
    |
371 |         set_view(&mut MandelbrotModel::get_instance(), &VIEW_1)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `set_view(&mut MandelbrotModel::get_instance(), &VIEW_1);`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned

Check warning on line 356 in src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

temporary with significant `Drop` can be early dropped

warning: temporary with significant `Drop` can be early dropped
   --> src/lib.rs:356:21
    |
355 |           || {
    |  ____________-
356 | |             let mut mandelbrot_model = MandelbrotModel::get_instance();
    | |                     ^^^^^^^^^^^^^^^^
357 | |             let inverse_scaling_factor = mandelbrot_model.vars.inverse_scaling_factor();
358 | |             mandelbrot_model.c.scale(inverse_scaling_factor);
359 | |             render(&mut mandelbrot_model);
360 | |         },
    | |_________- temporary `mandelbrot_model` is currently being dropped at the end of its contained scope
    |
    = note: this might lead to unnecessary resource contention
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#significant_drop_tightening
help: drop the temporary after the end of its last usage
    |
358 ~             mandelbrot_model.c.scale(inverse_scaling_factor);
359 +             drop(mandelbrot_model);
    |

Check warning on line 347 in src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

temporary with significant `Drop` can be early dropped

warning: temporary with significant `Drop` can be early dropped
   --> src/lib.rs:347:17
    |
346 |       key_bindings.add(Key::LeftBracket, "Scale the view by scaling_factor, effectively zooming in", || {
    |  _______________________________________________________________________________________________________-
347 | |         let mut mandelbrot_model = MandelbrotModel::get_instance();
    | |                 ^^^^^^^^^^^^^^^^
348 | |         let scaling_factor = mandelbrot_model.vars.scaling_factor();
349 | |         mandelbrot_model.c.scale(scaling_factor);
350 | |         render(&mut mandelbrot_model);
351 | |     });
    | |_____- temporary `mandelbrot_model` is currently being dropped at the end of its contained scope
    |
    = note: this might lead to unnecessary resource contention
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#significant_drop_tightening
help: drop the temporary after the end of its last usage
    |
349 ~         mandelbrot_model.c.scale(scaling_factor);
350 +         drop(mandelbrot_model);
    |

Check warning on line 315 in src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

temporary with significant `Drop` can be early dropped

warning: temporary with significant `Drop` can be early dropped
   --> src/lib.rs:315:17
    |
314 |       key_bindings.add(Key::R, "Reset the Mandelbrot set view to the starting view", || {
    |  _______________________________________________________________________________________-
315 | |         let mut mandelbrot_model = MandelbrotModel::get_instance();
    | |                 ^^^^^^^^^^^^^^^^
316 | |         mandelbrot_model.c.reset();
317 | |         render(&mut mandelbrot_model);
318 | |     });
    | |_____- temporary `mandelbrot_model` is currently being dropped at the end of its contained scope
    |
    = note: this might lead to unnecessary resource contention
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#significant_drop_tightening
help: merge the temporary construction with its single usage
    |
315 ~         
316 +         MandelbrotModel::get_instance().reset();
    |
help: remove separated single usage
    |
316 -         mandelbrot_model.c.reset();
316 +         
    |

Check warning on line 516 in src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this function has too many lines (232/100)

warning: this function has too many lines (232/100)
   --> src/lib.rs:267:1
    |
267 | / pub fn run() -> Result<(), Box<dyn Error>> {
268 | |     let mut mandelbrot_model = MandelbrotModel::get_instance();
269 | |     //Coloring function
270 | |     mandelbrot_model.coloring_function = COLORING_FUNCTION;
...   |
515 | |     Ok(())
516 | | }
    | |_^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_lines
    = note: `#[warn(clippy::too_many_lines)]` implied by `#[warn(clippy::pedantic)]`

Check warning on line 205 in src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

adding items after statements is confusing, since items exist from the start of the scope

warning: adding items after statements is confusing, since items exist from the start of the scope
   --> src/lib.rs:205:5
    |
205 |     static RIGHT_MOUSE_RECORDER: MouseClickRecorder = MouseClickRecorder::new(MouseButton::Right);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#items_after_statements

Check warning on line 204 in src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

adding items after statements is confusing, since items exist from the start of the scope

warning: adding items after statements is confusing, since items exist from the start of the scope
   --> src/lib.rs:204:5
    |
204 |     static LEFT_MOUSE_RECORDER: MouseClickRecorder = MouseClickRecorder::new(MouseButton::Left); //Static variable with interior mutabili...
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#items_after_statements
    = note: `#[warn(clippy::items_after_statements)]` implied by `#[warn(clippy::pedantic)]`

Check warning on line 196 in src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

consider adding a `;` to the last statement for consistent formatting

warning: consider adding a `;` to the last statement for consistent formatting
   --> src/lib.rs:196:13
    |
196 |             self.previous.store(current, Ordering::Relaxed)
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `self.previous.store(current, Ordering::Relaxed);`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
    = note: `#[warn(clippy::semicolon_if_nothing_returned)]` implied by `#[warn(clippy::pedantic)]`

Check warning on line 136 in src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

temporary with significant `Drop` can be early dropped

warning: temporary with significant `Drop` can be early dropped
   --> src/lib.rs:136:17
    |
132 |       if let Some(key) = window.get_keys_pressed(minifb::KeyRepeat::No).first() {
    |  _______________________________________________________________________________-
133 | |         print!("\nKey pressed: ");
134 | |         k.print_key(key);
135 | |         k.run(key);
136 | |         let mut mandelbrot_model = MandelbrotModel::get_instance();
    | |                 ^^^^^^^^^^^^^^^^
...   |
147 | |         }
148 | |     }
    | |_____- temporary `mandelbrot_model` is currently being dropped at the end of its contained scope
    |
    = note: this might lead to unnecessary resource contention
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#significant_drop_tightening
help: merge the temporary construction with its single usage
    |
136 ~         
137 +                 MandelbrotModel::get_instance().;
    |
help: remove separated single usage
    |
140 -                 mandelbrot_model.coloring_function = pick_option(&[
141 -                     ("HSV", TrueColor::new_from_hsv_colors),
142 -                     ("Bernstein polynomials", TrueColor::new_from_bernstein_polynomials),
143 -                 ]);
140 +                 
    |

Check warning on line 123 in src/view/coloring.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

docs for function which may panic missing `# Panics` section

warning: docs for function which may panic missing `# Panics` section
   --> src/view/coloring.rs:123:5
    |
123 |     pub fn get_color(&self, color: char) -> u8 {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: first possible panic found here
   --> src/view/coloring.rs:124:9
    |
124 | /         assert!(
125 | |             color == 'R' || color == 'G' || color == 'B',
126 | |             "Error: color should be equal to R, G, or B, color = {}",
127 | |             color
128 | |         );
    | |_________^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc