Skip to content

Commit

Permalink
remove unnecessary to_vec() conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
jdockerty committed Dec 3, 2023
1 parent 1306fdb commit 7ef3354
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 1 addition & 3 deletions src/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,15 @@ impl Proxy for HttpProxy {

async fn proxy(mut connection: Connection, routing_idx: Arc<RwLock<usize>>) -> Result<()> {
if let Some(backends) = connection.targets.get(&connection.target_name) {
let backends = backends.to_vec();
debug!("Backends configured {:?}", &backends);
let backend_count = backends.len();

if backend_count == 0 {
info!(
"[HTTP] No routable backends for {}, nothing to do",
&connection.target_name
);
return Ok(());
}
debug!("Backends configured {:?}", &backends);

// Limit the scope of the index write lock.
let http_backend: String;
Expand Down
4 changes: 1 addition & 3 deletions src/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,15 @@ impl Proxy for TcpProxy {

async fn proxy(mut connection: Connection, routing_idx: Arc<RwLock<usize>>) -> Result<()> {
if let Some(backends) = connection.targets.get(&connection.target_name) {
let backends = backends.to_vec();
debug!("Backends configured {:?}", &backends);
let backend_count = backends.len();

if backend_count == 0 {
info!(
"[TCP] No routable backends for {}, nothing to do",
&connection.target_name
);
return Ok(());
}
debug!("Backends configured {:?}", &backends);

// Limit the scope of the index write lock.
let backend_addr: String;
Expand Down

0 comments on commit 7ef3354

Please sign in to comment.