From 035f6c732504be6fc61564d49e614b7ca9b8813a Mon Sep 17 00:00:00 2001 From: Dennis Loose Date: Thu, 12 Dec 2024 16:59:22 +0100 Subject: [PATCH] refactor: pass `snap_name` as `String` in pb conversion --- src/grpc/charts.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/grpc/charts.rs b/src/grpc/charts.rs index 8615dc7..00283b2 100644 --- a/src/grpc/charts.rs +++ b/src/grpc/charts.rs @@ -66,7 +66,7 @@ impl chart_server::Chart for ChartService { .await?; Result::::Ok( - PbChartData::from_chart_data_and_snap_name(chart_data, &snap_name), + PbChartData::from_chart_data_and_snap_name(chart_data, snap_name), ) })) .await @@ -106,7 +106,7 @@ async fn get_chart_cached( } impl PbChartData { - fn from_chart_data_and_snap_name(chart_data: ChartData, snap_name: &str) -> Self { + fn from_chart_data_and_snap_name(chart_data: ChartData, snap_name: String) -> Self { Self { raw_rating: chart_data.raw_rating, rating: Some(PbRating::from_rating_and_snap_name( @@ -118,12 +118,12 @@ impl PbChartData { } impl PbRating { - fn from_rating_and_snap_name(rating: Rating, snap_name: &str) -> Self { + fn from_rating_and_snap_name(rating: Rating, snap_name: String) -> Self { Self { snap_id: rating.snap_id, total_votes: rating.total_votes, ratings_band: rating.ratings_band as i32, - snap_name: snap_name.into(), + snap_name, } } }