diff --git a/src/concurrency_control/interface/scan/open_scan.cpp b/src/concurrency_control/interface/scan/open_scan.cpp index f950a565..8d6a2be3 100644 --- a/src/concurrency_control/interface/scan/open_scan.cpp +++ b/src/concurrency_control/interface/scan/open_scan.cpp @@ -41,8 +41,8 @@ constexpr Status check_empty_scan_range(const std::string_view l_key, const scan } if (l_end == scan_endpoint::INF) { // if left end is inf, not empty in most cases - if (r_end == scan_endpoint::EXCLUSIVE && r_key == "") { - return Status::WARN_NOT_FOUND; // exception + if (r_end == scan_endpoint::EXCLUSIVE && r_key.empty()) { + return Status::WARN_NOT_FOUND; // the only exception } return Status::OK; } @@ -50,11 +50,9 @@ constexpr Status check_empty_scan_range(const std::string_view l_key, const scan if (cmp_key < 0) { return Status::OK; } // if left is less, not empty if (cmp_key > 0) { return Status::WARN_NOT_FOUND; } // if left is greater, invalid range // l_key == r_key - if (l_end == scan_endpoint::INCLUSIVE && r_end == scan_endpoint::INCLUSIVE) { - return Status::OK; // single point, not empty - } else { - return Status::WARN_NOT_FOUND; // empty - } + return (l_end == scan_endpoint::INCLUSIVE && r_end == scan_endpoint::INCLUSIVE) + ? Status::OK // single point, not empty + : Status::WARN_NOT_FOUND; // empty } /**