[yew-devel] [PATCH yew-comp 1/3] tree wide: switch from `Into` to `From` implementations where possible
Shannon Sterz
s.sterz at proxmox.com
Tue Jan 14 10:09:38 CET 2025
this is more flexible as a `From` implementation gives us an `Into`
implementation for free. fixes the clippy ling `from_over_into` [1].
[1]:
https://rust-lang.github.io/rust-clippy/master/index.html#from_over_into
Signed-off-by: Shannon Sterz <s.sterz at proxmox.com>
---
src/configuration/network_edit.rs | 6 +++---
src/configuration/network_view.rs | 6 +++---
src/rrd_graph_new.rs | 6 +++---
src/rrd_timeframe_selector.rs | 6 +++---
4 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/configuration/network_edit.rs b/src/configuration/network_edit.rs
index 84a9380..b97b86a 100644
--- a/src/configuration/network_edit.rs
+++ b/src/configuration/network_edit.rs
@@ -369,9 +369,9 @@ impl Component for ProxmoxNetworkEdit {
}
}
-impl Into<VNode> for NetworkEdit {
- fn into(self) -> VNode {
- let comp = VComp::new::<ProxmoxNetworkEdit>(Rc::new(self), None);
+impl From<NetworkEdit> for VNode {
+ fn from(val: NetworkEdit) -> Self {
+ let comp = VComp::new::<ProxmoxNetworkEdit>(Rc::new(val), None);
VNode::from(comp)
}
}
diff --git a/src/configuration/network_view.rs b/src/configuration/network_view.rs
index cc2faae..fa9f985 100644
--- a/src/configuration/network_view.rs
+++ b/src/configuration/network_view.rs
@@ -319,9 +319,9 @@ impl LoadableComponent for ProxmoxNetworkView {
}
}
-impl Into<VNode> for NetworkView {
- fn into(self) -> VNode {
- let comp = VComp::new::<LoadableComponentMaster<ProxmoxNetworkView>>(Rc::new(self), None);
+impl From<NetworkView> for VNode {
+ fn from(val: NetworkView) -> Self {
+ let comp = VComp::new::<LoadableComponentMaster<ProxmoxNetworkView>>(Rc::new(val), None);
VNode::from(comp)
}
}
diff --git a/src/rrd_graph_new.rs b/src/rrd_graph_new.rs
index 21890a1..2c77a38 100644
--- a/src/rrd_graph_new.rs
+++ b/src/rrd_graph_new.rs
@@ -1030,9 +1030,9 @@ impl Component for PwtRRDGraph {
}
}
-impl Into<VNode> for RRDGraph {
- fn into(self) -> VNode {
- let comp = VComp::new::<PwtRRDGraph>(Rc::new(self), None);
+impl From<RRDGraph> for VNode {
+ fn from(val: RRDGraph) -> Self {
+ let comp = VComp::new::<PwtRRDGraph>(Rc::new(val), None);
VNode::from(comp)
}
}
diff --git a/src/rrd_timeframe_selector.rs b/src/rrd_timeframe_selector.rs
index a027046..d674f7c 100644
--- a/src/rrd_timeframe_selector.rs
+++ b/src/rrd_timeframe_selector.rs
@@ -233,9 +233,9 @@ impl Component for PwtRRDTimeframeSelector {
}
}
-impl Into<VNode> for RRDTimeframeSelector {
- fn into(self) -> VNode {
- let comp = VComp::new::<PwtRRDTimeframeSelector>(Rc::new(self), None);
+impl From<RRDTimeframeSelector> for VNode {
+ fn from(val: RRDTimeframeSelector) -> Self {
+ let comp = VComp::new::<PwtRRDTimeframeSelector>(Rc::new(val), None);
VNode::from(comp)
}
}
--
2.39.5
More information about the yew-devel
mailing list