Skip to content

Refactored lib.rs

Refactored lib.rs #43

Triggered via push September 20, 2023 09:13
Status Failure
Total duration 2m 51s
Artifacts

rust.yml

on: push
Fit to window
Zoom out
Zoom in

Annotations

1 error and 41 warnings
benchmark
No benchmark result was found in /home/runner/work/mandelbrot/mandelbrot/output.txt. Benchmark output was ''
docs for function which may panic missing `# Panics` section: src/view/coloring.rs#L123
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
docs for function returning `Result` missing `# Errors` section: src/view/coloring.rs#L43
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
item in documentation is missing backticks: src/view/coloring.rs#L10
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: | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
item in documentation is missing backticks: src/view/coloring.rs#L8
warning: item in documentation is missing backticks --> src/view/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 help: try | 8 | ///A mapping from `ColorChannelMapping` -> RGB, the first character denotes the new red channel, the second character the new green channel, | ~~~~~~~~~~~~~~~~~~~~~
the function has a cognitive complexity of (7/5): src/model/rendering.rs#L104
warning: the function has a cognitive complexity of (7/5) --> src/model/rendering.rs:104:41 | 104 | 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#L102
warning: using `clone` on type `fn(u32, u32) -> TrueColor` which implements the `Copy` trait --> src/model/rendering.rs:102:33 | 102 | 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#L46
warning: temporary with significant `Drop` can be early dropped --> src/model/mandelbrot_model.rs:46:13 | 45 | pub fn get_instance() -> MutexGuard<'static, MandelbrotModel> { | ___________________________________________________________________- 46 | | let lock = MANDELBROT_MODEL_INSTANCE.try_lock(); | | ^^^^ 47 | | if let Ok(instance) = lock { 48 | | return instance; 49 | | } 50 | | panic!("[DEADLOCK]: You have called the singleton twice! This should never happen. It means that within the same scope, Mandelbro... 51 | | } | |_____- 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 | 46 ~ 47 + MANDELBROT_MODEL_INSTANCE.try_lock().; | help: remove separated single usage | 47 - if let Ok(instance) = lock { 48 - return instance; 49 - } 47 + |
docs for function which may panic missing `# Panics` section: src/model/mandelbrot_model.rs#L45
warning: docs for function which may panic missing `# Panics` section --> src/model/mandelbrot_model.rs:45:5 | 45 | pub fn get_instance() -> MutexGuard<'static, MandelbrotModel> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: first possible panic found here --> src/model/mandelbrot_model.rs:50:9 | 50 | ... 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#L44
warning: item in documentation is missing backticks --> src/model/mandelbrot_model.rs:44:31 | 44 | /// Returns the singleton MandelbrotModel instance. | ^^^^^^^^^^^^^^^ | = 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 | 44 | /// Returns the singleton `MandelbrotModel` instance. | ~~~~~~~~~~~~~~~~~
using `clone` on type `Config` which implements the `Copy` trait: src/model/mandelbrot_model.rs#L34
warning: using `clone` on type `Config` which implements the `Copy` trait --> src/model/mandelbrot_model.rs:34:21 | 34 | 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#L28
warning: you should consider adding a `Default` implementation for `MandelbrotModel` --> src/model/mandelbrot_model.rs:28:5 | 28 | / pub fn new() -> MandelbrotModel { 29 | | let config = Config::build(env::args()).unwrap_or_else(|err| { 30 | | eprintln!("Problem parsing arguments: {}", err); 31 | | process::exit(1); ... | 41 | | } 42 | | } | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default help: try adding this | 27 + impl Default for MandelbrotModel { 28 + fn default() -> Self { 29 + Self::new() 30 + } 31 + } |
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
consider adding a `;` to the last statement for consistent formatting: src/controller/mouse_click_recorder.rs#L30
warning: consider adding a `;` to the last statement for consistent formatting --> src/controller/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
consider adding a `;` to the last statement for consistent formatting: src/controller/minifb_controller.rs#L332
warning: consider adding a `;` to the last statement for consistent formatting --> src/controller/minifb_controller.rs:332:9 | 332 | 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 returning `Result` missing `# Errors` section: src/controller/minifb_controller.rs#L266
warning: docs for function returning `Result` missing `# Errors` section --> src/controller/minifb_controller.rs:266:1 | 266 | pub fn run() -> 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)]`
docs for function which may panic missing `# Panics` section: src/controller/minifb_controller.rs#L266
warning: docs for function which may panic missing `# Panics` section --> src/controller/minifb_controller.rs:266:1 | 266 | pub fn run() -> Result<(), Box<dyn Error>> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: first possible panic found here --> src/controller/minifb_controller.rs:280:9 | 280 | panic!("{}", e); | ^^^^^^^^^^^^^^^ = 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)]`
temporary with significant `Drop` can be early dropped: src/controller/minifb_controller.rs#L251
warning: temporary with significant `Drop` can be early dropped --> src/controller/minifb_controller.rs:251:21 | 250 | || { | ____________- 251 | | let mut mandelbrot_model = MandelbrotModel::get_instance(); | | ^^^^^^^^^^^^^^^^ 252 | | mandelbrot_model.config.supersampling_amount = ask::<u8>("supersampling_amount").clamp(1, 64); 253 | | render(&mut mandelbrot_model); 254 | | }, | |_________- 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 | 251 ~ 252 + MandelbrotModel::get_instance().; | help: remove separated single usage | 252 - mandelbrot_model.config.supersampling_amount = ask::<u8>("supersampling_amount").clamp(1, 64); 252 + |
temporary with significant `Drop` can be early dropped: src/controller/minifb_controller.rs#L242
warning: temporary with significant `Drop` can be early dropped --> src/controller/minifb_controller.rs:242:21 | 241 | || { | ____________- 242 | | let mut mandelbrot_model = MandelbrotModel::get_instance(); | | ^^^^^^^^^^^^^^^^ 243 | | mandelbrot_model.p.color_channel_mapping = ask("color_channel_mapping"); 244 | | render(&mut mandelbrot_model); 245 | | }, | |_________- 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 | 242 ~ 243 + MandelbrotModel::get_instance().; | help: remove separated single usage | 243 - mandelbrot_model.p.color_channel_mapping = ask("color_channel_mapping"); 243 + |
temporary with significant `Drop` can be early dropped: src/controller/minifb_controller.rs#L234
warning: temporary with significant `Drop` can be early dropped --> src/controller/minifb_controller.rs:234:17 | 233 | key_bindings.add(Key::M, "Change the Mandelbrot set view max_iterations", || { | __________________________________________________________________________________- 234 | | let mut mandelbrot_model = MandelbrotModel::get_instance(); | | ^^^^^^^^^^^^^^^^ 235 | | mandelbrot_model.m.max_iterations = ask("max_iterations"); 236 | | render(&mut mandelbrot_model); 237 | | }); | |_____- 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 | 234 ~ 235 + MandelbrotModel::get_instance().; | help: remove separated single usage | 235 - mandelbrot_model.m.max_iterations = ask("max_iterations"); 235 + |
temporary with significant `Drop` can be early dropped: src/controller/minifb_controller.rs#L228
warning: temporary with significant `Drop` can be early dropped --> src/controller/minifb_controller.rs:228:17 | 227 | key_bindings.add(Key::I, "Manually input a Mandelbrot set view", || { | _________________________________________________________________________- 228 | | let mut mandelbrot_model = MandelbrotModel::get_instance(); | | ^^^^^^^^^^^^^^^^ 229 | | mandelbrot_model.c.set_view(&View::new(ask("x"), ask("y"), ask("scale"))); 230 | | render(&mut mandelbrot_model); 231 | | }); | |_____- 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 | 228 ~ 229 + MandelbrotModel::get_instance().set_view(&View::new(ask("x"), ask("y"), ask("scale"))); | help: remove separated single usage | 229 - mandelbrot_model.c.set_view(&View::new(ask("x"), ask("y"), ask("scale"))); 229 + |
strict comparison of `f32` or `f64`: src/controller/minifb_controller.rs#L201
warning: strict comparison of `f32` or `f64` --> src/controller/minifb_controller.rs:201:16 | 201 | 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#L192
warning: consider adding a `;` to the last statement for consistent formatting --> src/controller/minifb_controller.rs:192:9 | 192 | 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#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_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#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_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#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_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#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_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#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_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#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_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#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_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#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_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#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_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#L150
warning: temporary with significant `Drop` can be early dropped --> src/controller/minifb_controller.rs:150:21 | 149 | || { | ____________- 150 | | let mut mandelbrot_model = MandelbrotModel::get_instance(); | | ^^^^^^^^^^^^^^^^ 151 | | let inverse_scaling_factor = mandelbrot_model.vars.inverse_scaling_factor(); 152 | | mandelbrot_model.c.scale(inverse_scaling_factor); 153 | | render(&mut mandelbrot_model); 154 | | }, | |_________- 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 | 152 ~ mandelbrot_model.c.scale(inverse_scaling_factor); 153 + drop(mandelbrot_model); |
temporary with significant `Drop` can be early dropped: src/controller/minifb_controller.rs#L141
warning: temporary with significant `Drop` can be early dropped --> src/controller/minifb_controller.rs:141:17 | 140 | key_bindings.add(Key::LeftBracket, "Scale the view by scaling_factor, effectively zooming in", || { | _______________________________________________________________________________________________________- 141 | | let mut mandelbrot_model = MandelbrotModel::get_instance(); | | ^^^^^^^^^^^^^^^^ 142 | | let scaling_factor = mandelbrot_model.vars.scaling_factor(); 143 | | mandelbrot_model.c.scale(scaling_factor); 144 | | render(&mut mandelbrot_model); 145 | | }); | |_____- 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 | 143 ~ mandelbrot_model.c.scale(scaling_factor); 144 + drop(mandelbrot_model); |
temporary with significant `Drop` can be early dropped: src/controller/minifb_controller.rs#L109
warning: temporary with significant `Drop` can be early dropped --> src/controller/minifb_controller.rs:109:17 | 108 | key_bindings.add(Key::R, "Reset the Mandelbrot set view to the starting view", || { | _______________________________________________________________________________________- 109 | | let mut mandelbrot_model = MandelbrotModel::get_instance(); | | ^^^^^^^^^^^^^^^^ 110 | | mandelbrot_model.c.reset(); 111 | | render(&mut mandelbrot_model); 112 | | }); | |_____- 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 | 109 ~ 110 + MandelbrotModel::get_instance().reset(); | help: remove separated single usage | 110 - mandelbrot_model.c.reset(); 110 + |
this function has too many lines (180/100): src/controller/minifb_controller.rs#L82
warning: this function has too many lines (180/100) --> src/controller/minifb_controller.rs:82:1 | 82 | / pub fn initialize_keybindings(key_bindings: &mut KeyBindings) { 83 | | let empty_closure = || (); 84 | | key_bindings.add(Key::Up, "Move up translation_amount pixels", || { 85 | | let mut mandelbrot_model = MandelbrotModel::get_instance(); ... | 263 | | }); 264 | | } | |_^ | = 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#L67
warning: adding items after statements is confusing, since items exist from the start of the scope --> src/controller/minifb_controller.rs:67:5 | 67 | 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#L66
warning: adding items after statements is confusing, since items exist from the start of the scope --> src/controller/minifb_controller.rs:66:5 | 66 | 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#L29
warning: temporary with significant `Drop` can be early dropped --> src/controller/minifb_controller.rs:29:17 | 25 | if let Some(key) = window.get_keys_pressed(minifb::KeyRepeat::No).first() { | _______________________________________________________________________________- 26 | | print!("\nKey pressed: "); 27 | | k.print_key(key); 28 | | k.run(key); 29 | | let mut mandelbrot_model = MandelbrotModel::get_instance(); | | ^^^^^^^^^^^^^^^^ ... | 40 | | } 41 | | } | |_____- 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 | 29 ~ 30 + MandelbrotModel::get_instance().; | help: remove separated single usage | 33 - mandelbrot_model.coloring_function = pick_option(&[ 34 - ("HSV", TrueColor::new_from_hsv_colors), 35 - ("Bernstein polynomials", TrueColor::new_from_bernstein_polynomials), 36 - ]); 33 + |
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/