[yew-devel] [PATCH yew-comp 12/20] rrd: remove wrongly annotated lifetime

Dominik Csapak d.csapak at proxmox.com
Fri May 30 14:21:54 CEST 2025


the data returned from get_view_data does not depend on self, but the
way the lifetimes are annotated implies this. This can be a problem when
we want to borrow self mutably, but want to keep the data returned from
this method. By simply removing the lifetime annotation from &self, we
tell the compiler that we don't have to borrow &self immutably

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 src/rrd/graph.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/rrd/graph.rs b/src/rrd/graph.rs
index e011c21..b58bd58 100644
--- a/src/rrd/graph.rs
+++ b/src/rrd/graph.rs
@@ -350,7 +350,7 @@ fn compute_fill_path(
 }
 
 impl PwtRRDGraph {
-    fn get_view_data<'a>(&'a self, ctx: &'a Context<Self>) -> (&'a [i64], &'a [f64], &'a [f64]) {
+    fn get_view_data<'a>(&self, ctx: &'a Context<Self>) -> (&'a [i64], &'a [f64], &'a [f64]) {
         let props = ctx.props();
 
         let time_data = &props.time_data;
-- 
2.39.5





More information about the yew-devel mailing list