Skip to content

Added a program icon. Changed the window title to Mandelbrot by Jort …

Jort van Waes 5d8b35d
Sign in for the full log view
GitHub Actions / clippy succeeded Sep 20, 2023 in 0s

clippy

43 warnings

Details

Results

Message level Amount
Internal compiler error 0
Error 0
Warning 43
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 72 in src/view/minifb_mandelbrot_view.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/view/minifb_mandelbrot_view.rs:72:13
   |
72 |             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 58 in src/view/minifb_mandelbrot_view.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/minifb_mandelbrot_view.rs:58:5
   |
58 |     pub fn update(&mut self, mandelbrot_model: &MandelbrotModel) {
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: first possible panic found here
  --> src/view/minifb_mandelbrot_view.rs:59:9
   |
59 | /         self.window
60 | |             .update_with_buffer(
61 | |                 &mandelbrot_model.p.pixels,
62 | |                 mandelbrot_model.config.window_width,
63 | |                 mandelbrot_model.config.window_height,
64 | |             )
65 | |             .unwrap();
   | |_____________________^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc

Check warning on line 12 in src/view/minifb_mandelbrot_view.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/minifb_mandelbrot_view.rs:12:5
   |
12 |     pub fn new(mandelbrot_model: &MandelbrotModel) -> MandelbrotView {
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: first possible panic found here
  --> src/view/minifb_mandelbrot_view.rs:30:13
   |
30 |             panic!("{}", e);
   |             ^^^^^^^^^^^^^^^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc

Check warning on line 16 in src/view/image.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/view/image.rs:13:9
   |
13 | /         println!(
14 | |             "[UNSUPPORTED]: There is currently no support for saving images in the window scale is not 1.0. The window scale is {}.",
15 | |             mandelbrot_model.config.window_scale
16 | |         )
   | |_________^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
help: add a `;` here
   |
13 ~         println!(
14 +             "[UNSUPPORTED]: There is currently no support for saving images in the window scale is not 1.0. The window scale is {}.",
15 +             mandelbrot_model.config.window_scale
16 +         );
   |

Check warning on line 5 in src/view/image.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/view/image.rs:5:8
  |
5 |     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 105 in src/model/rendering.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

the function has a cognitive complexity of (7/5)

warning: the function has a cognitive complexity of (7/5)
   --> src/model/rendering.rs:105:41
    |
105 |         let handle = thread::spawn(move || {
    |                                         ^^
    |
    = help: you could split it up into multiple smaller functions
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cognitive_complexity
    = note: `#[warn(clippy::cognitive_complexity)]` implied by `#[warn(clippy::nursery)]`

Check warning on line 103 in src/model/rendering.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

using `clone` on type `fn(u32, u32) -> TrueColor` which implements the `Copy` trait

warning: using `clone` on type `fn(u32, u32) -> TrueColor` which implements the `Copy` trait
   --> src/model/rendering.rs:103:33
    |
103 |         let coloring_function = (mandelbrot_model.coloring_function).clone();
    |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `(mandelbrot_model.coloring_function)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy

Check warning on line 53 in src/model/mandelbrot_model.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/model/mandelbrot_model.rs:53:13
   |
52 |       pub fn get_instance() -> MutexGuard<'static, MandelbrotModel> {
   |  ___________________________________________________________________-
53 | |         let lock = MANDELBROT_MODEL_INSTANCE.try_lock();
   | |             ^^^^
54 | |         if let Ok(instance) = lock {
55 | |             return instance;
56 | |         }
57 | |         panic!("[DEADLOCK]: You have called the singleton twice! This should never happen. It means that within the same scope, Mandelbro...
58 | |     }
   | |_____- temporary `lock` 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
   |
53 ~         
54 +         MANDELBROT_MODEL_INSTANCE.try_lock().;
   |
help: remove separated single usage
   |
54 -         if let Ok(instance) = lock {
55 -             return instance;
56 -         }
54 +         
   |

Check warning on line 52 in src/model/mandelbrot_model.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/model/mandelbrot_model.rs:52:5
   |
52 |     pub fn get_instance() -> MutexGuard<'static, MandelbrotModel> {
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: first possible panic found here
  --> src/model/mandelbrot_model.rs:57:9
   |
57 | ...   panic!("[DEADLOCK]: You have called the singleton twice! This should never happen. It means that within the same scope, MandelbrotModel::get_instance() was called more than once....
   |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc

Check warning on line 51 in src/model/mandelbrot_model.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/model/mandelbrot_model.rs:51:31
   |
51 |     /// Returns the singleton MandelbrotModel instance.
   |                               ^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
help: try
   |
51 |     /// Returns the singleton `MandelbrotModel` instance.
   |                               ~~~~~~~~~~~~~~~~~

Check warning on line 37 in src/model/mandelbrot_model.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

using `clone` on type `Config` which implements the `Copy` trait

warning: using `clone` on type `Config` which implements the `Copy` trait
  --> src/model/mandelbrot_model.rs:37:21
   |
37 |             config: config.clone(),
   |                     ^^^^^^^^^^^^^^ help: try removing the `clone` call: `config`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy
note: the lint level is defined here
  --> src/lib.rs:9:5
   |
9  |     clippy::complexity
   |     ^^^^^^^^^^^^^^^^^^
   = note: `#[warn(clippy::clone_on_copy)]` implied by `#[warn(clippy::complexity)]`

Check warning on line 49 in src/model/mandelbrot_model.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

you should consider adding a `Default` implementation for `MandelbrotModel`

warning: you should consider adding a `Default` implementation for `MandelbrotModel`
  --> src/model/mandelbrot_model.rs:30:5
   |
30 | /     pub fn new() -> MandelbrotModel {
31 | |         let config = Config::build(env::args()).unwrap_or_else(|err| {
32 | |             eprintln!("Problem parsing arguments: {}", err);
33 | |             process::exit(1);
...  |
48 | |         result
49 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try adding this
   |
29 + impl Default for MandelbrotModel {
30 +     fn default() -> Self {
31 +         Self::new()
32 +     }
33 + }
   |

Check warning on line 123 in src/model/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/model/coloring.rs:123:5
    |
123 |     pub fn get_color(&self, color: char) -> u8 {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: first possible panic found here
   --> src/model/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/model/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/model/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

Check warning on line 10 in src/model/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/model/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:
   |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Check warning on line 8 in src/model/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/model/coloring.rs:8:19
  |
8 | ///A mapping from ColorChannelMapping -> RGB, the first character denotes the new red channel, the second character the new green channel,
  |                   ^^^^^^^^^^^^^^^^^^^
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
  = note: `#[warn(clippy::doc_markdown)]` implied by `#[warn(clippy::pedantic)]`
help: try
  |
8 | ///A mapping from `ColorChannelMapping` -> RGB, the first character denotes the new red channel, the second character the new green channel,
  |                   ~~~~~~~~~~~~~~~~~~~~~

Check warning on line 31 in src/controller/user_input.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/controller/user_input.rs:31:1
   |
31 | pub fn get_user_input_untrimmed() -> String {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: first possible panic found here
  --> src/controller/user_input.rs:34:5
   |
34 | /     io::stdin()
35 | |         .read_line(&mut user_input)
36 | |         .expect("Error: Failed to read the user's input from stdin.");
   | |_____________________________________________________________________^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
   = note: `#[warn(clippy::missing_panics_doc)]` implied by `#[warn(clippy::pedantic)]`

Check warning on line 30 in src/controller/minifb_mouse_click_recorder.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/controller/minifb_mouse_click_recorder.rs:30:13
   |
30 |             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

Check warning on line 238 in src/controller/minifb_controller.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/controller/minifb_controller.rs:238:1
    |
238 | pub fn run(mandelbrot_view: &mut MandelbrotView) -> Result<(), Box<dyn Error>> {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = 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 223 in src/controller/minifb_controller.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/controller/minifb_controller.rs:223:21
    |
222 |           || {
    |  ____________-
223 | |             let mut mandelbrot_model = MandelbrotModel::get_instance();
    | |                     ^^^^^^^^^^^^^^^^
224 | |             mandelbrot_model.config.supersampling_amount = ask::<u8>("supersampling_amount").clamp(1, 64);
225 | |             render(&mut mandelbrot_model);
226 | |         },
    | |_________- 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
    |
223 ~             
224 +             MandelbrotModel::get_instance().;
    |
help: remove separated single usage
    |
224 -             mandelbrot_model.config.supersampling_amount = ask::<u8>("supersampling_amount").clamp(1, 64);
224 +             
    |

Check warning on line 214 in src/controller/minifb_controller.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/controller/minifb_controller.rs:214:21
    |
213 |           || {
    |  ____________-
214 | |             let mut mandelbrot_model = MandelbrotModel::get_instance();
    | |                     ^^^^^^^^^^^^^^^^
215 | |             mandelbrot_model.p.color_channel_mapping = ask("color_channel_mapping");
216 | |             render(&mut mandelbrot_model);
217 | |         },
    | |_________- 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
    |
214 ~             
215 +             MandelbrotModel::get_instance().;
    |
help: remove separated single usage
    |
215 -             mandelbrot_model.p.color_channel_mapping = ask("color_channel_mapping");
215 +             
    |

Check warning on line 206 in src/controller/minifb_controller.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/controller/minifb_controller.rs:206:17
    |
205 |       key_bindings.add(Key::M, "Change the Mandelbrot set view max_iterations", || {
    |  __________________________________________________________________________________-
206 | |         let mut mandelbrot_model = MandelbrotModel::get_instance();
    | |                 ^^^^^^^^^^^^^^^^
207 | |         mandelbrot_model.m.max_iterations = ask("max_iterations");
208 | |         render(&mut mandelbrot_model);
209 | |     });
    | |_____- 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
    |
206 ~         
207 +         MandelbrotModel::get_instance().;
    |
help: remove separated single usage
    |
207 -         mandelbrot_model.m.max_iterations = ask("max_iterations");
207 +         
    |

Check warning on line 200 in src/controller/minifb_controller.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/controller/minifb_controller.rs:200:17
    |
199 |       key_bindings.add(Key::I, "Manually input a Mandelbrot set view", || {
    |  _________________________________________________________________________-
200 | |         let mut mandelbrot_model = MandelbrotModel::get_instance();
    | |                 ^^^^^^^^^^^^^^^^
201 | |         mandelbrot_model.c.set_view(&View::new(ask("x"), ask("y"), ask("scale")));
202 | |         render(&mut mandelbrot_model);
203 | |     });
    | |_____- 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
    |
200 ~         
201 +         MandelbrotModel::get_instance().set_view(&View::new(ask("x"), ask("y"), ask("scale")));
    |
help: remove separated single usage
    |
201 -         mandelbrot_model.c.set_view(&View::new(ask("x"), ask("y"), ask("scale")));
201 +         
    |

Check warning on line 188 in src/controller/minifb_controller.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/controller/minifb_controller.rs:188:9
    |
188 |         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 185 in src/controller/minifb_controller.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/controller/minifb_controller.rs:185:9
    |
185 |         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