From 437e131aef334ba35b394b78db110233ddaeeec8 Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Sun, 20 Oct 2019 15:15:05 +0300 Subject: [PATCH] test: sstable_test: detemplate write_and_validate_sst() Reduce code bloat and improve error messages by replacing a template with noncopyable_function<>. --- test/boost/sstable_test.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/test/boost/sstable_test.cc b/test/boost/sstable_test.cc index 29e850d28c..08cfc42cf6 100644 --- a/test/boost/sstable_test.cc +++ b/test/boost/sstable_test.cc @@ -245,10 +245,9 @@ SEASTAR_TEST_CASE(check_compressed_info_func) { return check_component_integrity(component_type::CompressionInfo); } -template -inline auto -write_and_validate_sst(schema_ptr s, sstring dir, Func&& func) { - return test_env::do_with(tmpdir(), [s = std::move(s), dir = std::move(dir), func = std::move(func)] (test_env& env, tmpdir& tmp) { +future<> +write_and_validate_sst(schema_ptr s, sstring dir, noncopyable_function (shared_sstable sst1, shared_sstable sst2)> func) { + return test_env::do_with(tmpdir(), [s = std::move(s), dir = std::move(dir), func = std::move(func)] (test_env& env, tmpdir& tmp) mutable { return do_write_sst(env, s, dir, tmp.path().string(), 1).then([&env, &tmp, s = std::move(s), func = std::move(func)] (auto sst1) { auto sst2 = env.make_sstable(s, tmp.path().string(), 2, la, big); return func(std::move(sst1), std::move(sst2));