hspool: Use let-else pattern; our MSRV permits it.

This commit is contained in:
Nick Mathewson 2023-06-22 13:21:36 -04:00
parent 8a6836cf4a
commit 5ce7221f06
1 changed files with 2 additions and 6 deletions

View File

@ -125,9 +125,7 @@ impl<R: Runtime> HsCircPool<R> {
let path = circ.path_ref();
match path.hops().last() {
Some(ent) => {
let ct = if let Some(ct) = ent.as_chan_target() {
ct
} else {
let Some(ct) = ent.as_chan_target() else {
return Err(
internal!("HsPool gave us a circuit with a virtual last hop!?").into(),
);
@ -340,9 +338,7 @@ fn circuit_compatible_with_target(
let path = circ.path_ref();
// (We have to use a binding here to appease borrowck.)
let all_compatible = path.iter().all(|ent: &circuit::PathEntry| {
let c = if let Some(c) = ent.as_chan_target() {
c
} else {
let Some(c) = ent.as_chan_target() else {
// This is a virtual hop; it's necessarily compatible with everything.
return true;
};