Skip to content

Commit

Permalink
rename to make clippy happy
Browse files Browse the repository at this point in the history
  • Loading branch information
conradludgate committed Jun 26, 2024
1 parent 4543430 commit d0feece
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions proxy/src/proxy/copy_bidirectional.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ pub enum ErrorDirection {
Write(io::Error),
}

impl ErrorDirection {
fn from_client(self) -> ErrorSource {
match self {
ErrorDirection::Read(client) => ErrorSource::Client(client),
ErrorDirection::Write(compute) => ErrorSource::Compute(compute),
impl ErrorSource {
fn from_client(err: ErrorDirection) -> ErrorSource {
match err {
ErrorDirection::Read(client) => Self::Client(client),
ErrorDirection::Write(compute) => Self::Compute(compute),
}
}
fn to_client(self) -> ErrorSource {
match self {
ErrorDirection::Write(client) => ErrorSource::Client(client),
ErrorDirection::Read(compute) => ErrorSource::Compute(compute),
fn from_compute(err: ErrorDirection) -> ErrorSource {
match err {
ErrorDirection::Write(client) => Self::Client(client),
ErrorDirection::Read(compute) => Self::Compute(compute),
}
}
}
Expand Down Expand Up @@ -82,10 +82,10 @@ where
poll_fn(|cx| {
let mut client_to_compute_result =
transfer_one_direction(cx, &mut client_to_compute, client, compute)
.map_err(ErrorDirection::from_client)?;
.map_err(ErrorSource::from_client)?;
let mut compute_to_client_result =
transfer_one_direction(cx, &mut compute_to_client, compute, client)
.map_err(ErrorDirection::to_client)?;
.map_err(ErrorSource::from_compute)?;

// Early termination checks from compute to client.
if let TransferState::Done(_) = compute_to_client {
Expand All @@ -95,7 +95,7 @@ where
client_to_compute = TransferState::ShuttingDown(buf.amt);
client_to_compute_result =
transfer_one_direction(cx, &mut client_to_compute, client, compute)
.map_err(ErrorDirection::from_client)?;
.map_err(ErrorSource::from_client)?;
}
}

Expand All @@ -107,7 +107,7 @@ where
compute_to_client = TransferState::ShuttingDown(buf.amt);
compute_to_client_result =
transfer_one_direction(cx, &mut compute_to_client, compute, client)
.map_err(ErrorDirection::to_client)?;
.map_err(ErrorSource::from_compute)?;
}
}

Expand Down

0 comments on commit d0feece

Please sign in to comment.