Skip to content

Added view::image::save(). #45

Added view::image::save().

Added view::image::save(). #45

Triggered via push September 20, 2023 10:38
Status Failure
Total duration 2m 35s
Artifacts

rust.yml

on: push
Fit to window
Zoom out
Zoom in

Annotations

1 error and 43 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
consider adding a `;` to the last statement for consistent formatting: src/view/image.rs#L13
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 + ); |
strict comparison of `f32` or `f64`: src/view/image.rs#L5
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)]`
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#L238
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)]`
temporary with significant `Drop` can be early dropped: src/controller/minifb_controller.rs#L223
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 + |
temporary with significant `Drop` can be early dropped: src/controller/minifb_controller.rs#L214
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 + |
temporary with significant `Drop` can be early dropped: src/controller/minifb_controller.rs#L206
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 + |
temporary with significant `Drop` can be early dropped: src/controller/minifb_controller.rs#L200
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 + |
consider adding a `;` to the last statement for consistent formatting: src/controller/minifb_controller.rs#L188
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
consider adding a `;` to the last statement for consistent formatting: src/controller/minifb_controller.rs#L185
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
consider adding a `;` to the last statement for consistent formatting: src/controller/minifb_controller.rs#L182
warning: consider adding a `;` to the last statement for consistent formatting --> src/controller/minifb_controller.rs:182:9 | 182 | 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#L179
warning: consider adding a `;` to the last statement for consistent formatting --> src/controller/minifb_controller.rs:179:9 | 179 | 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#L176
warning: consider adding a `;` to the last statement for consistent formatting --> src/controller/minifb_controller.rs:176:9 | 176 | 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#L173
warning: consider adding a `;` to the last statement for consistent formatting --> src/controller/minifb_controller.rs:173:9 | 173 | 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#L170
warning: consider adding a `;` to the last statement for consistent formatting --> src/controller/minifb_controller.rs:170:9 | 170 | 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#L167
warning: consider adding a `;` to the last statement for consistent formatting --> src/controller/minifb_controller.rs:167:9 | 167 | 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#L164
warning: consider adding a `;` to the last statement for consistent formatting --> src/controller/minifb_controller.rs:164:9 | 164 | 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#L161
warning: consider adding a `;` to the last statement for consistent formatting --> src/controller/minifb_controller.rs:161:9 | 161 | 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#L146
warning: temporary with significant `Drop` can be early dropped --> src/controller/minifb_controller.rs:146:21 | 145 | || { | ____________- 146 | | let mut mandelbrot_model = MandelbrotModel::get_instance(); | | ^^^^^^^^^^^^^^^^ 147 | | let inverse_scaling_factor = mandelbrot_model.vars.inverse_scaling_factor(); 148 | | mandelbrot_model.c.scale(inverse_scaling_factor); 149 | | render(&mut mandelbrot_model); 150 | | }, | |_________- 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 | 148 ~ mandelbrot_model.c.scale(inverse_scaling_factor); 149 + drop(mandelbrot_model); |
temporary with significant `Drop` can be early dropped: src/controller/minifb_controller.rs#L137
warning: temporary with significant `Drop` can be early dropped --> src/controller/minifb_controller.rs:137:17 | 136 | key_bindings.add(Key::LeftBracket, "Scale the view by scaling_factor, effectively zooming in", || { | _______________________________________________________________________________________________________- 137 | | let mut mandelbrot_model = MandelbrotModel::get_instance(); | | ^^^^^^^^^^^^^^^^ 138 | | let scaling_factor = mandelbrot_model.vars.scaling_factor(); 139 | | mandelbrot_model.c.scale(scaling_factor); 140 | | render(&mut mandelbrot_model); 141 | | }); | |_____- 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 | 139 ~ mandelbrot_model.c.scale(scaling_factor); 140 + 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 (156/100): src/controller/minifb_controller.rs#L79
warning: this function has too many lines (156/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(); ... | 235 | | }); 236 | | } | |_^ | = 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#L25
warning: temporary with significant `Drop` can be early dropped --> src/controller/minifb_controller.rs:25:17 | 20 | if let Some(key) = window.get_keys_pressed(minifb::KeyRepeat::No).first() { | _______________________________________________________________________________- 21 | | print!("\n{{Key pressed: "); 22 | | k.print_key(key); 23 | | println!("}}"); 24 | | k.run(key); 25 | | let mut mandelbrot_model = MandelbrotModel::get_instance(); | | ^^^^^^^^^^^^^^^^ ... | 37 | | println!(); 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 | 25 ~ 26 + MandelbrotModel::get_instance().; | help: remove separated single usage | 29 - mandelbrot_model.coloring_function = pick_option(&[ 30 - ("HSV", TrueColor::new_from_hsv_colors), 31 - ("Bernstein polynomials", TrueColor::new_from_bernstein_polynomials), 32 - ]); 29 + |
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/