From 677265461b3c596ab2a88858e74b0970196198fe Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Mon, 8 Sep 2025 23:09:21 +0200 Subject: Make clang-tidy happy --- test/args.cc | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) (limited to 'test') diff --git a/test/args.cc b/test/args.cc index b60a4a4..a43c59c 100644 --- a/test/args.cc +++ b/test/args.cc @@ -2,25 +2,33 @@ #include "args.hh" +#include +#include +#include +#include +#include +#include +#include + #define SETUP_OPTIONS(args) \ - auto short_only = args->option('a', "", "an option"); \ - auto short_long = args->option('b', "bold", "set font style to bold"); \ - auto long_only = args->option("cold", "use if it is cold outside"); \ - auto short_only_req = args->option_argument('d', "", "", "distance"); \ - auto short_long_req = args->option_argument('e', "eat", "FOOD", \ - "what to order, what to eat?"); \ - auto long_only_req = args->option_argument( \ + auto short_only = (args)->option('a', "", "an option"); \ + auto short_long = (args)->option('b', "bold", "set font style to bold"); \ + auto long_only = (args)->option("cold", "use if it is cold outside"); \ + auto short_only_req = (args)->option_argument('d', "", "", "distance"); \ + auto short_long_req = (args)->option_argument( \ + 'e', "eat", "FOOD", "what to order, what to eat?"); \ + auto long_only_req = (args)->option_argument( \ "form", "", "circle, shape or something else?"); \ - auto short_only_opt = args->option_argument('g', "", "", "", false); \ - auto short_long_opt = args->option_argument('h', "hold", "", "", false); \ - auto long_only_opt = args->option_argument("invert", "", "", false); + auto short_only_opt = (args)->option_argument('g', "", "", "", false); \ + auto short_long_opt = (args)->option_argument('h', "hold", "", "", false); \ + auto long_only_opt = (args)->option_argument("invert", "", "", false); namespace { class Arguments { public: - int c() const { return static_cast(str_.size()); }; - char** v() const { return ptr_.get(); } + [[nodiscard]] int c() const { return static_cast(str_.size()); }; + [[nodiscard]] char** v() const { return ptr_.get(); } explicit Arguments(std::vector str) : str_(std::move(str)) { @@ -45,7 +53,7 @@ class Builder { } Builder& add(std::string str) { - str_.push_back(std::move(str)); + str_.emplace_back(std::move(str)); return *this; } -- cgit v1.3