Skip to content

Added minifb_mandelbrot_view.rs #44

Added minifb_mandelbrot_view.rs

Added minifb_mandelbrot_view.rs #44

Triggered via push September 20, 2023 10:13
Status Failure
Total duration 3m 25s
Artifacts

rust.yml

on: push
Fit to window
Zoom out
Zoom in

Annotations

1 error and 42 warnings
benchmark
No benchmark result was found in /home/runner/work/mandelbrot/mandelbrot/output.txt. Benchmark output was ''
consider adding a `;` to the last statement for consistent formatting: src/view/minifb_mandelbrot_view.rs#L56
warning: consider adding a `;` to the last statement for consistent formatting --> src/view/minifb_mandelbrot_view.rs:56:13 | 56 | 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
docs for function which may panic missing `# Panics` section: src/view/minifb_mandelbrot_view.rs#L42
warning: docs for function which may panic missing `# Panics` section --> src/view/minifb_mandelbrot_view.rs:42:5 | 42 | pub fn update(&mut self, mandelbrot_model: &MandelbrotModel) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: first possible panic found here --> src/view/minifb_mandelbrot_view.rs:43:9 | 43 | / self.window 44 | | .update_with_buffer( 45 | | &mandelbrot_model.p.pixels, 46 | | mandelbrot_model.config.window_width, 47 | | mandelbrot_model.config.window_height, 48 | | ) 49 | | .unwrap(); | |_____________________^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
docs for function which may panic missing `# Panics` section: src/view/minifb_mandelbrot_view.rs#L10
warning: docs for function which may panic missing `# Panics` section --> src/view/minifb_mandelbrot_view.rs:10:5 | 10 | pub fn new(mandelbrot_model: &MandelbrotModel) -> MandelbrotView { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: first possible panic found here --> src/view/minifb_mandelbrot_view.rs:19:13 | 19 | panic!("{}", e); | ^^^^^^^^^^^^^^^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
the function has a cognitive complexity of (7/5): src/model/rendering.rs#L105
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)]`
using `clone` on type `fn(u32, u32) -> TrueColor` which implements the `Copy` trait: src/model/rendering.rs#L103
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
temporary with significant `Drop` can be early dropped: src/model/mandelbrot_model.rs#L53
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 + |
docs for function which may panic missing `# Panics` section: src/model/mandelbrot_model.rs#L52
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
item in documentation is missing backticks: src/model/mandelbrot_model.rs#L51
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. | ~~~~~~~~~~~~~~~~~
using `clone` on type `Config` which implements the `Copy` trait: src/model/mandelbrot_model.rs#L37
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)]`
you should consider adding a `Default` implementation for `MandelbrotModel`: src/model/mandelbrot_model.rs#L30
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 + } |
docs for function which may panic missing `# Panics` section: src/model/coloring.rs#L123
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
docs for function returning `Result` missing `# Errors` section: src/model/coloring.rs#L43
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
item in documentation is missing backticks: src/model/coloring.rs#L10
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: | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
item in documentation is missing backticks: src/model/coloring.rs#L8
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, | ~~~~~~~~~~~~~~~~~~~~~
docs for function which may panic missing `# Panics` section: src/controller/user_input.rs#L31
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)]`
consider adding a `;` to the last statement for consistent formatting: src/controller/minifb_mouse_click_recorder.rs#L30
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
docs for function returning `Result` missing `# Errors` section: src/controller/minifb_controller.rs#L263
warning: docs for function returning `Result` missing `# Errors` section --> src/controller/minifb_controller.rs:263:1 | 263 | 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)]`
temporary with significant `Drop` can be early dropped: src/controller/minifb_controller.rs#L248
warning: temporary with significant `Drop` can be early dropped --> src/controller/minifb_controller.rs:248:21 | 247 | || { | ____________- 248 | | let mut mandelbrot_model = MandelbrotModel::get_instance(); | | ^^^^^^^^^^^^^^^^ 249 | | mandelbrot_model.config.supersampling_amount = ask::<u8>("supersampling_amount").clamp(1, 64); 250 | | render(&mut mandelbrot_model); 251 | | }, | |_________- 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 | 248 ~ 249 + MandelbrotModel::get_instance().; | help: remove separated single usage | 249 - mandelbrot_model.config.supersampling_amount = ask::<u8>("supersampling_amount").clamp(1, 64); 249 + |
temporary with significant `Drop` can be early dropped: src/controller/minifb_controller.rs#L239
warning: temporary with significant `Drop` can be early dropped --> src/controller/minifb_controller.rs:239:21 | 238 | || { | ____________- 239 | | let mut mandelbrot_model = MandelbrotModel::get_instance(); | | ^^^^^^^^^^^^^^^^ 240 | | mandelbrot_model.p.color_channel_mapping = ask("color_channel_mapping"); 241 | | render(&mut mandelbrot_model); 242 | | }, | |_________- 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 | 239 ~ 240 + MandelbrotModel::get_instance().; | help: remove separated single usage | 240 - mandelbrot_model.p.color_channel_mapping = ask("color_channel_mapping"); 240 + |
temporary with significant `Drop` can be early dropped: src/controller/minifb_controller.rs#L231
warning: temporary with significant `Drop` can be early dropped --> src/controller/minifb_controller.rs:231:17 | 230 | key_bindings.add(Key::M, "Change the Mandelbrot set view max_iterations", || { | __________________________________________________________________________________- 231 | | let mut mandelbrot_model = MandelbrotModel::get_instance(); | | ^^^^^^^^^^^^^^^^ 232 | | mandelbrot_model.m.max_iterations = ask("max_iterations"); 233 | | render(&mut mandelbrot_model); 234 | | }); | |_____- 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 | 231 ~ 232 + MandelbrotModel::get_instance().; | help: remove separated single usage | 232 - mandelbrot_model.m.max_iterations = ask("max_iterations"); 232 + |
temporary with significant `Drop` can be early dropped: src/controller/minifb_controller.rs#L225
warning: temporary with significant `Drop` can be early dropped --> src/controller/minifb_controller.rs:225:17 | 224 | key_bindings.add(Key::I, "Manually input a Mandelbrot set view", || { | _________________________________________________________________________- 225 | | let mut mandelbrot_model = MandelbrotModel::get_instance(); | | ^^^^^^^^^^^^^^^^ 226 | | mandelbrot_model.c.set_view(&View::new(ask("x"), ask("y"), ask("scale"))); 227 | | render(&mut mandelbrot_model); 228 | | }); | |_____- 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 | 225 ~ 226 + MandelbrotModel::get_instance().set_view(&View::new(ask("x"), ask("y"), ask("scale"))); | help: remove separated single usage | 226 - mandelbrot_model.c.set_view(&View::new(ask("x"), ask("y"), ask("scale"))); 226 + |
strict comparison of `f32` or `f64`: src/controller/minifb_controller.rs#L198
warning: strict comparison of `f32` or `f64` --> src/controller/minifb_controller.rs:198:16 | 198 | 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)]`
consider adding a `;` to the last statement for consistent formatting: src/controller/minifb_controller.rs#L189
warning: consider adding a `;` to the last statement for consistent formatting --> src/controller/minifb_controller.rs:189:9 | 189 | 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
consider adding a `;` to the last statement for consistent formatting: src/controller/minifb_controller.rs#L186
warning: consider adding a `;` to the last statement for consistent formatting --> src/controller/minifb_controller.rs:186:9 | 186 | 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
consider adding a `;` to the last statement for consistent formatting: src/controller/minifb_controller.rs#L183
warning: consider adding a `;` to the last statement for consistent formatting --> src/controller/minifb_controller.rs:183:9 | 183 | 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
consider adding a `;` to the last statement for consistent formatting: src/controller/minifb_controller.rs#L180
warning: consider adding a `;` to the last statement for consistent formatting --> src/controller/minifb_controller.rs:180:9 | 180 | 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
consider adding a `;` to the last statement for consistent formatting: src/controller/minifb_controller.rs#L177
warning: consider adding a `;` to the last statement for consistent formatting --> src/controller/minifb_controller.rs:177:9 | 177 | 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
consider adding a `;` to the last statement for consistent formatting: src/controller/minifb_controller.rs#L174
warning: consider adding a `;` to the last statement for consistent formatting --> src/controller/minifb_controller.rs:174:9 | 174 | 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
consider adding a `;` to the last statement for consistent formatting: src/controller/minifb_controller.rs#L171
warning: consider adding a `;` to the last statement for consistent formatting --> src/controller/minifb_controller.rs:171:9 | 171 | 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
consider adding a `;` to the last statement for consistent formatting: src/controller/minifb_controller.rs#L168
warning: consider adding a `;` to the last statement for consistent formatting --> src/controller/minifb_controller.rs:168:9 | 168 | 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
consider adding a `;` to the last statement for consistent formatting: src/controller/minifb_controller.rs#L165
warning: consider adding a `;` to the last statement for consistent formatting --> src/controller/minifb_controller.rs:165:9 | 165 | 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
consider adding a `;` to the last statement for consistent formatting: src/controller/minifb_controller.rs#L162
warning: consider adding a `;` to the last statement for consistent formatting --> src/controller/minifb_controller.rs:162:9 | 162 | 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 = note: `#[warn(clippy::semicolon_if_nothing_returned)]` implied by `#[warn(clippy::pedantic)]`
temporary with significant `Drop` can be early dropped: src/controller/minifb_controller.rs#L147
warning: temporary with significant `Drop` can be early dropped --> src/controller/minifb_controller.rs:147:21 | 146 | || { | ____________- 147 | | let mut mandelbrot_model = MandelbrotModel::get_instance(); | | ^^^^^^^^^^^^^^^^ 148 | | let inverse_scaling_factor = mandelbrot_model.vars.inverse_scaling_factor(); 149 | | mandelbrot_model.c.scale(inverse_scaling_factor); 150 | | render(&mut mandelbrot_model); 151 | | }, | |_________- 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 | 149 ~ mandelbrot_model.c.scale(inverse_scaling_factor); 150 + drop(mandelbrot_model); |
temporary with significant `Drop` can be early dropped: src/controller/minifb_controller.rs#L138
warning: temporary with significant `Drop` can be early dropped --> src/controller/minifb_controller.rs:138:17 | 137 | key_bindings.add(Key::LeftBracket, "Scale the view by scaling_factor, effectively zooming in", || { | _______________________________________________________________________________________________________- 138 | | let mut mandelbrot_model = MandelbrotModel::get_instance(); | | ^^^^^^^^^^^^^^^^ 139 | | let scaling_factor = mandelbrot_model.vars.scaling_factor(); 140 | | mandelbrot_model.c.scale(scaling_factor); 141 | | render(&mut mandelbrot_model); 142 | | }); | |_____- 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 | 140 ~ mandelbrot_model.c.scale(scaling_factor); 141 + drop(mandelbrot_model); |
temporary with significant `Drop` can be early dropped: src/controller/minifb_controller.rs#L106
warning: temporary with significant `Drop` can be early dropped --> src/controller/minifb_controller.rs:106:17 | 105 | key_bindings.add(Key::R, "Reset the Mandelbrot set view to the starting view", || { | _______________________________________________________________________________________- 106 | | let mut mandelbrot_model = MandelbrotModel::get_instance(); | | ^^^^^^^^^^^^^^^^ 107 | | mandelbrot_model.c.reset(); 108 | | render(&mut mandelbrot_model); 109 | | }); | |_____- 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 | 106 ~ 107 + MandelbrotModel::get_instance().reset(); | help: remove separated single usage | 107 - mandelbrot_model.c.reset(); 107 + |
this function has too many lines (180/100): src/controller/minifb_controller.rs#L79
warning: this function has too many lines (180/100) --> src/controller/minifb_controller.rs:79:1 | 79 | / pub fn initialize_keybindings(key_bindings: &mut KeyBindings) { 80 | | let empty_closure = || (); 81 | | key_bindings.add(Key::Up, "Move up translation_amount pixels", || { 82 | | let mut mandelbrot_model = MandelbrotModel::get_instance(); ... | 260 | | }); 261 | | } | |_^ | = 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)]`
adding items after statements is confusing, since items exist from the start of the scope: src/controller/minifb_controller.rs#L64
warning: adding items after statements is confusing, since items exist from the start of the scope --> src/controller/minifb_controller.rs:64:5 | 64 | 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
adding items after statements is confusing, since items exist from the start of the scope: src/controller/minifb_controller.rs#L63
warning: adding items after statements is confusing, since items exist from the start of the scope --> src/controller/minifb_controller.rs:63:5 | 63 | 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: the lint level is defined here --> src/lib.rs:3:5 | 3 | clippy::pedantic, | ^^^^^^^^^^^^^^^^ = note: `#[warn(clippy::items_after_statements)]` implied by `#[warn(clippy::pedantic)]`
temporary with significant `Drop` can be early dropped: src/controller/minifb_controller.rs#L26
warning: temporary with significant `Drop` can be early dropped --> src/controller/minifb_controller.rs:26:17 | 22 | if let Some(key) = window.get_keys_pressed(minifb::KeyRepeat::No).first() { | _______________________________________________________________________________- 23 | | print!("\nKey pressed: "); 24 | | k.print_key(key); 25 | | k.run(key); 26 | | let mut mandelbrot_model = MandelbrotModel::get_instance(); | | ^^^^^^^^^^^^^^^^ ... | 37 | | } 38 | | } | |_____- 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 note: the lint level is defined here --> src/lib.rs:4:5 | 4 | clippy::nursery, | ^^^^^^^^^^^^^^^ = note: `#[warn(clippy::significant_drop_tightening)]` implied by `#[warn(clippy::nursery)]` help: merge the temporary construction with its single usage | 26 ~ 27 + MandelbrotModel::get_instance().; | help: remove separated single usage | 30 - mandelbrot_model.coloring_function = pick_option(&[ 31 - ("HSV", TrueColor::new_from_hsv_colors), 32 - ("Bernstein polynomials", TrueColor::new_from_bernstein_polynomials), 33 - ]); 30 + |
you should consider adding a `Default` implementation for `Config`: src/controller/config.rs#L32
warning: you should consider adding a `Default` implementation for `Config` --> src/controller/config.rs:32:5 | 32 | / pub fn new() -> Config { 33 | | Config { 34 | | window_width: WIDTH, 35 | | window_height: HEIGHT, ... | 42 | | } 43 | | } | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default note: the lint level is defined here --> src/lib.rs:2:5 | 2 | clippy::all, | ^^^^^^^^^^^ = note: `#[warn(clippy::new_without_default)]` implied by `#[warn(clippy::all)]` help: try adding this | 31 + impl Default for Config { 32 + fn default() -> Self { 33 + Self::new() 34 + } 35 + } |
clippy_check
The following actions uses node12 which is deprecated and will be forced to run on node16: actions-rs/clippy-check@v1. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/
benchmark
The following actions uses node12 which is deprecated and will be forced to run on node16: actions/checkout@v2. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/