clang-tidy - abseil-cleanup-ctad — Extra Clang Tools 22.1.6 documentation

# Extra Clang Tools 22.1.6 documentation

## clang-tidy - abseil-cleanup-ctad

# abseil-cleanup-ctad

Suggests switching the initialization pattern of `absl::Cleanup` instances from the factory function to class template argument deduction (CTAD), in C++17 and higher.

    auto c1 = absl::MakeCleanup([] {});

    const auto c2 = absl::MakeCleanup(std::function<void()>([] {}));

becomes

    absl::Cleanup c1 = [] {};

    const absl::Cleanup c2 = std::function<void()>([] {});