fralonra/wgshadertoy

Compiler spits out multiple warnings while compiling

Opened this issue · 1 comments

warning: variant `Warning` is never constructed
 --> src/event.rs:8:5
  |
5 | pub enum AppStatus {
  |          --------- variant in this enum
...
8 |     Warning(String),
  |     ^^^^^^^
  |
  = note: `AppStatus` has derived impls for the traits `Debug` and `Clone`, but these are intentionally ignored during dead code analysis
  = note: `#[warn(dead_code)]` on by default

warning: associated items `from_style` and `store_in_memory` are never used
  --> src/ui/highlight/code_theme.rs:17:12
   |
16 | impl CodeTheme {
   | -------------- associated items in this implementation
17 |     pub fn from_style(style: &Style) -> Self {
   |            ^^^^^^^^^^
...
93 |     pub fn store_in_memory(self, ctx: &Context) {
   |            ^^^^^^^^^^^^^^^

warning: methods `editable`, `removable`, `rounding`, and `size` are never used
   --> src/ui/image_upload.rs:174:12
    |
159 | impl<'a> ImageUpload<'a> {
    | ------------------------ methods in this implementation
...
174 |     pub fn editable(mut self, editable: bool) -> Self {
    |            ^^^^^^^^
...
194 |     pub fn removable(mut self, removable: bool) -> Self {
    |            ^^^^^^^^^
...
204 |     pub fn rounding(mut self, rounding: f32) -> Self {
    |            ^^^^^^^^
...
209 |     pub fn size(mut self, size: f32) -> Self {
    |            ^^^^

warning: unused `Result` that must be used
  --> src/event.rs:49:9
   |
49 |         self.inner.send_event(event);
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this `Result` may be an `Err` variant, which should be handled
   = note: `#[warn(unused_must_use)]` on by default
help: use `let _ = ...` to ignore the resulting value
   |
49 |         let _ = self.inner.send_event(event);
   |         +++++++

warning: unused `TextureHandle` that must be used
  --> src/ui.rs:87:9
   |
87 |         self.textures.remove(index);
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: use `let _ = ...` to ignore the resulting value
   |
87 |         let _ = self.textures.remove(index);
   |         +++++++

warning: unused `Result` that must be used
   --> src/ui.rs:232:29
    |
232 | ...                   select_system_locales();
    |                       ^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: this `Result` may be an `Err` variant, which should be handled
help: use `let _ = ...` to ignore the resulting value
    |
232 |                             let _ = select_system_locales();
    |                             +++++++

warning: unused `Result` that must be used
   --> src/ui.rs:244:33
    |
244 | ...                   select_locales(&[language.id]);
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: this `Result` may be an `Err` variant, which should be handled
help: use `let _ = ...` to ignore the resulting value
    |
244 |                                 let _ = select_locales(&[language.id]);
    |                                 +++++++

warning: `wgshadertoy` (bin "wgshadertoy") generated 7 warnings
    Finished dev [unoptimized + debuginfo] target(s) in 52.28s

Compiling using the latest version throws these warnings, while not a detriment to the working order of the project, it will definitely harm confidence in the quality of the app and may turn people off entirely.

They should easy fixes though, as the compiler tells you how to fix most of them

Thanks for pointing it out.

Could you open a PR and fix these warnings? I went over them all, some are reserved for possible future usages, eg ImageUpload::editable or AppStatus::Warning. You can either delete them or use #[rustfmt::skip].