Commit 6bbb6ba1 authored by gabi-250's avatar gabi-250 🕸️
Browse files

hsclient: Use Option<> combinators to get rid of branching (fmt)

parent 9cc45294
Loading
Loading
Loading
Loading
+11 −8
Original line number Diff line number Diff line
@@ -503,14 +503,17 @@ impl<'c, R: Runtime, M: MocksForConnect<R>> Context<'c, R, M> {
        // TODO SPEC: Discuss HS descriptor lifetime and expiry client behaviour
        let now = self.runtime.wallclock();

        let cur_revision = data.as_ref().map(|previously| {
        let cur_revision = data
            .as_ref()
            .map(|previously| {
                if let Ok(desc) = previously.as_ref().check_valid_at(&now) {
                    Some(desc.revision())
                } else {
                    // Seems to be not valid now.  Try to fetch a fresh one.
                    None
                }
        }).flatten();
            })
            .flatten();

        match (cur_revision, refetch) {
            (Some(_), None) => {