Skip to content

Commit

Permalink
refactor: pass snap_name as String in pb conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
d-loose committed Dec 12, 2024
1 parent 2a2b964 commit 035f6c7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/grpc/charts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ impl chart_server::Chart for ChartService {
.await?;

Result::<PbChartData, Error>::Ok(
PbChartData::from_chart_data_and_snap_name(chart_data, &snap_name),
PbChartData::from_chart_data_and_snap_name(chart_data, snap_name),
)
}))
.await
Expand Down Expand Up @@ -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(
Expand All @@ -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,
}
}
}
Expand Down

0 comments on commit 035f6c7

Please sign in to comment.