srctree

Robin Linden parent 6f6bb70b f6f4719e
meta/clang-tidy: Enable container-size-empty

inlinesplit
.clang-tidy added: 13, removed: 10, total 3
@@ -41,6 +41,7 @@ Checks: >
misc-*,
modernize-*,
performance-*,
readability-container-size-empty,
readability-identifier-naming,
readability-inconsistent-declaration-parameter-name,
readability-qualified-auto,
 
css/parser.cpp added: 13, removed: 10, total 3
@@ -487,7 +487,7 @@ void Parser::expand_border_impl(
}();
 
Tokenizer tokenizer(value, ' ');
if (tokenizer.size() == 0 || tokenizer.size() > 3) {
if (tokenizer.empty() || tokenizer.size() > 3) {
// TODO(robinlinden): Propagate info about invalid properties.
return;
}
 
etest/etest2.cpp added: 13, removed: 10, total 3
@@ -68,7 +68,7 @@ int Suite::run(RunOptions const &opts) {
std::ranges::copy(begin(tests_), end(tests_), std::back_inserter(tests_to_run));
 
std::cout << tests_.size() + disabled_tests_.size() << " test(s) registered";
if (disabled_tests_.size() == 0) {
if (disabled_tests_.empty()) {
std::cout << ".\n" << std::flush;
} else {
std::cout << ", " << disabled_tests_.size() << " disabled.\n" << std::flush;
 
layout/layout.cpp added: 13, removed: 10, total 3
@@ -334,7 +334,7 @@ void layout(LayoutBox &box, geom::Rect const &bounds, int const root_font_size)
calculate_position(box, bounds);
int last_child_end{};
int current_line{};
auto font_size = box.children.size() > 0 ? box.children[0].get_property<css::PropertyId::FontSize>() : 0;
auto font_size = !box.children.empty() ? box.children[0].get_property<css::PropertyId::FontSize>() : 0;
for (std::size_t i = 0; i < box.children.size(); ++i) {
auto *child = &box.children[i];
layout(*child,
 
url/url_test.cpp added: 13, removed: 10, total 3
@@ -765,11 +765,13 @@ int main() {
etest::expect_eq(url->serialize_path(), pathname);
 
std::string_view search = obj["search"];
etest::expect_eq(url->query.has_value() && *url->query != "" ? std::string{"?"} + *url->query : "", search);
etest::expect_eq(
url->query.has_value() && !url->query->empty() ? std::string{"?"} + *url->query : "", search);
 
std::string_view hash = obj["hash"];
etest::expect_eq(
url->fragment.has_value() && *url->fragment != "" ? std::string{"#"} + *url->fragment : "", hash);
url->fragment.has_value() && !url->fragment->empty() ? std::string{"#"} + *url->fragment : "",
hash);
}
});