clippy: Allow eq_op in generated rust code

I get the following clippy errors in the energy monitor:

error: equal expressions as operands to `-`
     --> C:\src\slint\target\debug\build\energy-monitor-7b0492feb1633656\out\desktop_window.rs:47254:94
      |
47254 | ...   (slint :: private_unstable_api :: re_exports :: LogicalLength :: new (((((0f64 as f64) - (0f64 as f64)) as f64) * (((1f64 as f64) *...
      |                                                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      |
      = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#eq_op

error: equal expressions as operands to `==`
     --> C:\src\slint\target\debug\build\energy-monitor-7b0492feb1633656\out\desktop_window.rs:45382:18
      |
45382 |                  (((0f64 as f64) == (0f64 as f64))) as bool }
      |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      |
      = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#eq_op

I am not surprised that the generated code sometimes produces code like
this (even though the other demos do not!), so I went ahead and silenced
these errors.
This commit is contained in:
Tobias Hunger 2023-03-08 18:41:31 +01:00 committed by Tobias Hunger
parent 233bc61c8e
commit 7c19cde055

View file

@ -301,6 +301,7 @@ pub fn generate(doc: &Document) -> TokenStream {
#[allow(unused_braces)]
#[allow(clippy::erasing_op)]
#[allow(clippy::approx_constant)] // We may get those from .slint inputs!
#[allow(clippy::eq_op)] // The generated code will compare/subtract/etc. equal values
mod #compo_module {
use slint::private_unstable_api::re_exports::*;
#(#structs)*