do_with() optimization
do_with() optimization

do_with() is a commonly used idiom, so it is important that it is
optimal both in run-time and compile-time.

We used finally(), which is a construct over then_wrap() which adds
additional compile-time and currently, also runtime, overheads (see
issue #92 and issue #53).

do_with() uses finally() with a lambda returning a void (not a future)
and which cannot throw, and in this case much of the complexity of
finally() can be avoided, and it's trivial to switch to using then_wrapped
directly.

Signed-off-by: Nadav Har'El <625169824b719df98706d88646d0aae6f368ae4d@scylladb.com>

sjperkins/seastar,avikivity/seastar,kjniemi/seastar,avikivity/seastar,syuu1228/seastar,dreamsxin/seastar,scylladb/seastar,syuu1228/seastar,cloudius-systems/seastar,cloudius-systems/seastar,kjniemi/seastar,scylladb/seastar,sjperkins/seastar,avikivity/seastar,cloudius-systems/seastar,dreamsxin/seastar,kjniemi/seastar,scylladb/seastar,syuu1228/seastar,sjperkins/seastar,dreamsxin/seastar