[pdm-devel] [PATCH proxmox-yew-comp 07/15] remove unnecesary closure used with then()
Maximiliano Sandoval
m.sandoval at proxmox.com
Mon Jan 13 15:27:17 CET 2025
Fixes:
warning: unnecessary closure used with `bool::then`
--> src/rrd_graph_new.rs:950:33
|
950 | .attribute("data-show", (self.draw_cross && data_time.is_some()).then(|| ""))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations
= note: `#[warn(clippy::unnecessary_lazy_evaluations)]` on by default
help: use `then_some` instead
|
950 | .attribute("data-show", (self.draw_cross && data_time.is_some()).then_some(""))
| ~~~~~~~~~~~~~
Signed-off-by: Maximiliano Sandoval <m.sandoval at proxmox.com>
---
src/rrd_graph_new.rs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/rrd_graph_new.rs b/src/rrd_graph_new.rs
index 00fa39a..426dc61 100644
--- a/src/rrd_graph_new.rs
+++ b/src/rrd_graph_new.rs
@@ -947,7 +947,7 @@ impl Component for PwtRRDGraph {
.node_ref(self.tooltip_ref.clone())
.attribute("role", "tooltip")
.attribute("aria-live", "polite")
- .attribute("data-show", (self.draw_cross && data_time.is_some()).then(|| ""))
+ .attribute("data-show", (self.draw_cross && data_time.is_some()).then_some(""))
.class("pwt-tooltip")
.class("pwt-tooltip-rich")
.with_optional_child(match (self.serie0_visible, &props.serie0) {
@@ -981,7 +981,7 @@ impl Component for PwtRRDGraph {
"pwt-rrd-legend-marker0",
"fa",
"fa-circle",
- (!self.serie0_visible).then(|| "disabled")
+ (!self.serie0_visible).then_some("disabled")
);
panel.add_tool(
Button::new(serie0.label.clone())
@@ -993,7 +993,7 @@ impl Component for PwtRRDGraph {
"pwt-rrd-legend-marker1",
"fa",
"fa-circle",
- (!self.serie1_visible).then(|| "disabled")
+ (!self.serie1_visible).then_some("disabled")
);
panel.add_tool(
Button::new(serie1.label.clone())
--
2.39.5
More information about the pdm-devel
mailing list