Skip to content

Commit f40cabd

Browse files
committed
Pass Url instead of &Url
1 parent 875fb24 commit f40cabd

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

trino-lb-core/src/trino_api.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl TrinoQueryApiResponse {
9797
skip(self),
9898
fields(trino_lb_addr = %trino_lb_addr),
9999
)]
100-
pub fn change_next_uri_to_trino_lb(&mut self, trino_lb_addr: &Url) -> Result<(), Error> {
100+
pub fn change_next_uri_to_trino_lb(&mut self, trino_lb_addr: Url) -> Result<(), Error> {
101101
if let Some(next_uri) = &self.next_uri {
102102
self.next_uri = Some(change_next_uri_to_trino_lb(next_uri, trino_lb_addr));
103103
}
@@ -185,7 +185,7 @@ impl TrinoQueryApiResponse {
185185
)]
186186
pub fn update_trino_references(
187187
&mut self,
188-
trino_lb_addr: &Url,
188+
trino_lb_addr: Url,
189189
external_trino_addr: Option<&Url>,
190190
) -> Result<(), Error> {
191191
// Point nextUri to trino-lb
@@ -207,8 +207,8 @@ impl TrinoQueryApiResponse {
207207
#[instrument(
208208
fields(next_uri = %next_uri, trino_lb_addr = %trino_lb_addr),
209209
)]
210-
fn change_next_uri_to_trino_lb(next_uri: &Url, trino_lb_addr: &Url) -> Url {
211-
let mut result = trino_lb_addr.clone();
210+
fn change_next_uri_to_trino_lb(next_uri: &Url, trino_lb_addr: Url) -> Url {
211+
let mut result = trino_lb_addr;
212212
result.set_path(next_uri.path());
213213
result
214214
}
@@ -275,7 +275,7 @@ mod tests {
275275
) {
276276
let next_uri = Url::parse(&next_uri).unwrap();
277277
let trino_lb_addr = Url::parse(&trino_lb_addr).unwrap();
278-
let result = change_next_uri_to_trino_lb(&next_uri, &trino_lb_addr);
278+
let result = change_next_uri_to_trino_lb(&next_uri, trino_lb_addr);
279279
assert_eq!(result.to_string(), expected);
280280
}
281281

trino-lb/src/http_server/v1/statement.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ async fn queue_or_hand_over_query(
349349

350350
trino_query_api_response
351351
.update_trino_references(
352-
&state.config.trino_lb.external_address,
352+
state.config.trino_lb.external_address.clone(),
353353
cluster.external_endpoint.as_ref(),
354354
)
355355
.context(ModifyNextUriSnafu)?;
@@ -517,7 +517,7 @@ async fn handle_query_running_on_trino(
517517
// Change the nextUri to actually point to trino-lb instead of Trino.
518518
trino_query_api_response
519519
.update_trino_references(
520-
&state.config.trino_lb.external_address,
520+
state.config.trino_lb.external_address.clone(),
521521
query.trino_external_endpoint.as_ref(),
522522
)
523523
.context(ModifyNextUriSnafu)?;

0 commit comments

Comments
 (0)