Skip to content

Implemented KeyBinding action closures using the MandelbrotModel sing… #41

Implemented KeyBinding action closures using the MandelbrotModel sing…

Implemented KeyBinding action closures using the MandelbrotModel sing… #41

GitHub Actions / clippy succeeded Sep 19, 2023 in 0s

clippy

35 warnings

Details

Results

Message level Amount
Internal compiler error 0
Error 0
Warning 35
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 456 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:456:21
    |
455 |           || {
    |  ____________-
456 | |             let mut mandelbrot_model = MandelbrotModel::get_instance();
    | |                     ^^^^^^^^^^^^^^^^
457 | |             mandelbrot_model.config.supersampling_amount = ask::<u8>("supersampling_amount").clamp(1, 64);
458 | |             render(&mut mandelbrot_model, COLORING_FUNCTION);
459 | |         },
    | |_________- 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
    |
456 ~             
457 +             MandelbrotModel::get_instance().;
    |
help: remove separated single usage
    |
457 -             mandelbrot_model.config.supersampling_amount = ask::<u8>("supersampling_amount").clamp(1, 64);
457 +             
    |

Check warning on line 447 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:447:21
    |
446 |           || {
    |  ____________-
447 | |             let mut mandelbrot_model = MandelbrotModel::get_instance();
    | |                     ^^^^^^^^^^^^^^^^
448 | |             mandelbrot_model.p.color_channel_mapping = ask("color_channel_mapping");
449 | |             render(&mut mandelbrot_model, COLORING_FUNCTION);
450 | |         },
    | |_________- 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
    |
447 ~             
448 +             MandelbrotModel::get_instance().;
    |
help: remove separated single usage
    |
448 -             mandelbrot_model.p.color_channel_mapping = ask("color_channel_mapping");
448 +             
    |

Check warning on line 439 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:439:17
    |
438 |       key_bindings.add(Key::M, "Change the Mandelbrot set view max_iterations", || {
    |  __________________________________________________________________________________-
439 | |         let mut mandelbrot_model = MandelbrotModel::get_instance();
    | |                 ^^^^^^^^^^^^^^^^
440 | |         mandelbrot_model.m.max_iterations = ask("max_iterations");
441 | |         render(&mut mandelbrot_model, COLORING_FUNCTION);
442 | |     });
    | |_____- 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
    |
439 ~         
440 +         MandelbrotModel::get_instance().;
    |
help: remove separated single usage
    |
440 -         mandelbrot_model.m.max_iterations = ask("max_iterations");
440 +         
    |

Check warning on line 433 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:433:17
    |
432 |       key_bindings.add(Key::I, "Manually input a Mandelbrot set view", || {
    |  _________________________________________________________________________-
433 | |         let mut mandelbrot_model = MandelbrotModel::get_instance();
    | |                 ^^^^^^^^^^^^^^^^
434 | |         mandelbrot_model.c.set_view(&View::new(ask("x"), ask("y"), ask("scale")));
435 | |         render(&mut mandelbrot_model, COLORING_FUNCTION);
436 | |     });
    | |_____- 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
    |
433 ~         
434 +         MandelbrotModel::get_instance().set_view(&View::new(ask("x"), ask("y"), ask("scale")));
    |
help: remove separated single usage
    |
434 -         mandelbrot_model.c.set_view(&View::new(ask("x"), ask("y"), ask("scale")));
434 +         
    |

Check warning on line 406 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:406:16
    |
406 |             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 397 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:397:9
    |
397 |         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 394 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:394:9
    |
394 |         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 391 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:391:9
    |
391 |         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 388 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:388:9
    |
388 |         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 385 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:385:9
    |
385 |         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 382 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:382:9
    |
382 |         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 379 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:379:9
    |
379 |         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 376 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:376:9
    |
376 |         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 373 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:373:9
    |
373 |         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 370 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:370:9
    |
370 |         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 355 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:355:21
    |
354 |           || {
    |  ____________-
355 | |             let mut mandelbrot_model = MandelbrotModel::get_instance();
    | |                     ^^^^^^^^^^^^^^^^
356 | |             let inverse_scaling_factor = mandelbrot_model.vars.inverse_scaling_factor();
357 | |             mandelbrot_model.c.scale(inverse_scaling_factor);
358 | |             render(&mut mandelbrot_model, COLORING_FUNCTION);
359 | |         },
    | |_________- 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
    |
357 ~             mandelbrot_model.c.scale(inverse_scaling_factor);
358 +             drop(mandelbrot_model);
    |

Check warning on line 346 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:346:17
    |
345 |       key_bindings.add(Key::LeftBracket, "Scale the view by scaling_factor, effectively zooming in", || {
    |  _______________________________________________________________________________________________________-
346 | |         let mut mandelbrot_model = MandelbrotModel::get_instance();
    | |                 ^^^^^^^^^^^^^^^^
347 | |         let scaling_factor = mandelbrot_model.vars.scaling_factor();
348 | |         mandelbrot_model.c.scale(scaling_factor);
349 | |         render(&mut mandelbrot_model, COLORING_FUNCTION);
350 | |     });
    | |_____- 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
    |
348 ~         mandelbrot_model.c.scale(scaling_factor);
349 +         drop(mandelbrot_model);
    |

Check warning on line 314 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:314:17
    |
313 |       key_bindings.add(Key::R, "Reset the Mandelbrot set view to the starting view", || {
    |  _______________________________________________________________________________________-
314 | |         let mut mandelbrot_model = MandelbrotModel::get_instance();
    | |                 ^^^^^^^^^^^^^^^^
315 | |         mandelbrot_model.c.reset();
316 | |         render(&mut mandelbrot_model, COLORING_FUNCTION);
317 | |     });
    | |_____- 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
    |
314 ~         
315 +         MandelbrotModel::get_instance().reset();
    |
help: remove separated single usage
    |
315 -         mandelbrot_model.c.reset();
315 +         
    |

Check warning on line 511 in src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this function has too many lines (226/100)

warning: this function has too many lines (226/100)
   --> src/lib.rs:266:1
    |
266 | / pub fn run() -> Result<(), Box<dyn Error>> {
267 | |     let mut mandelbrot_model = MandelbrotModel::get_instance();
268 | |     //Coloring function
269 | |     let mut coloring_function = COLORING_FUNCTION;
...   |
510 | |     Ok(())
511 | | }
    | |_^
    |
    = 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 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

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

See this annotation in the file changed.

@github-actions github-actions / clippy

docs for function returning `Result` missing `# Errors` section

warning: docs for function returning `Result` missing `# Errors` section
  --> src/view/coloring.rs:43:5
   |
43 |     pub fn new(r_g_b: &str) -> Result<ColorChannelMapping, String> {
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc
   = note: `#[warn(clippy::missing_errors_doc)]` implied by `#[warn(clippy::pedantic)]`

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

See this annotation in the file changed.

@github-actions github-actions / clippy

item in documentation is missing backticks

warning: item in documentation is missing backticks
  --> src/view/coloring.rs:10:10
   |
10 | /// E.g: Ok(ColorChannelMapping::BGR) means that red will get the value of blue, green the value of green, and blue the value of red:
   |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
help: try
   |
10 | /// E.g: `Ok(ColorChannelMapping::BGR`) means that red will get the value of blue, green the value of green, and blue the value of red:
   |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~