Execute clang tidy. (#477)

This commit is contained in:
Arthur Sonzogni 2022-09-05 20:56:41 +02:00 committed by GitHub
parent c8ec151154
commit fab74f745d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 42 additions and 15 deletions

View File

@ -181,11 +181,13 @@ ButtonOption ButtonOption::Animated(Color color) {
/// @brief Create a ButtonOption, using animated colors.
// static
ButtonOption ButtonOption::Animated(Color background, Color foreground) {
// NOLINTBEGIN
return ButtonOption::Animated(
/*bakground=*/background,
/*foreground=*/foreground,
/*background_active=*/foreground,
/*foreground_active=*/background);
// NOLINTEND
}
/// @brief Create a ButtonOption, using animated colors.

View File

@ -10,6 +10,7 @@
#include <iostream> // for cout, ostream, basic_ostream, operator<<, endl, flush
#include <stack> // for stack
#include <thread> // for thread, sleep_for
#include <tuple>
#include <type_traits> // for decay_t
#include <utility> // for move, swap
#include <variant> // for visit
@ -240,7 +241,8 @@ void OnExit(int signal) {
const auto install_signal_handler = [](int sig, SignalHandler handler) {
auto old_signal_handler = std::signal(sig, handler);
on_exit_functions.push([=] { std::signal(sig, old_signal_handler); });
on_exit_functions.push(
[=] { std::ignore = std::signal(sig, old_signal_handler); });
};
Closure g_on_resize = [] {}; // NOLINT
@ -289,22 +291,42 @@ ScreenInteractive::ScreenInteractive(int dimx,
// static
ScreenInteractive ScreenInteractive::FixedSize(int dimx, int dimy) {
return ScreenInteractive(dimx, dimy, Dimension::Fixed, false);
return {
dimx,
dimy,
Dimension::Fixed,
false,
};
}
// static
ScreenInteractive ScreenInteractive::Fullscreen() {
return ScreenInteractive(0, 0, Dimension::Fullscreen, true);
return {
0,
0,
Dimension::Fullscreen,
true,
};
}
// static
ScreenInteractive ScreenInteractive::TerminalOutput() {
return ScreenInteractive(0, 0, Dimension::TerminalOutput, false);
return {
0,
0,
Dimension::TerminalOutput,
false,
};
}
// static
ScreenInteractive ScreenInteractive::FitComponent() {
return ScreenInteractive(0, 0, Dimension::FitComponent, false);
return {
0,
0,
Dimension::FitComponent,
false,
};
}
void ScreenInteractive::Post(Task task) {
@ -684,7 +706,7 @@ void ScreenInteractive::SigStop() {
dimx_ = 0;
dimy_ = 0;
Flush();
std::raise(SIGTSTP);
std::ignore = std::raise(SIGTSTP);
Install();
});
#endif

View File

@ -33,7 +33,7 @@ Decorator flexDirection(GaugeDirection direction) {
template <class T>
class SliderBase : public ComponentBase {
public:
SliderBase(Ref<SliderOption<T>> options)
explicit SliderBase(Ref<SliderOption<T>> options)
: value_(options->value),
min_(options->min),
max_(options->max),
@ -125,8 +125,9 @@ class SliderBase : public ComponentBase {
}
value_() = util::clamp(value_(), min_(), max_());
if (old_value != value_())
if (old_value != value_()) {
return true;
}
return ComponentBase::OnEvent(event);
}
@ -196,15 +197,17 @@ class SliderBase : public ComponentBase {
class SliderWithLabel : public ComponentBase {
public:
SliderWithLabel(ConstStringRef label, Component inner) : label_(label) {
Add(inner);
SetActiveChild(inner);
SliderWithLabel(ConstStringRef label, Component inner)
: label_(std::move(label)) {
Add(std::move(inner));
SetActiveChild(ChildAt(0));
}
private:
bool OnEvent(Event event) final {
if (ComponentBase::OnEvent(event))
if (ComponentBase::OnEvent(event)) {
return true;
}
if (!event.is_mouse()) {
return false;
@ -272,7 +275,7 @@ Component Slider(ConstStringRef label,
option.max = max;
option.increment = increment;
auto slider = Make<SliderBase<int>>(option);
return Make<SliderWithLabel>(label, slider);
return Make<SliderWithLabel>(std::move(label), slider);
}
Component Slider(ConstStringRef label,
@ -286,7 +289,7 @@ Component Slider(ConstStringRef label,
option.max = max;
option.increment = increment;
auto slider = Make<SliderBase<float>>(option);
return Make<SliderWithLabel>(label, slider);
return Make<SliderWithLabel>(std::move(label), slider);
}
Component Slider(ConstStringRef label,
Ref<long> value,
@ -299,7 +302,7 @@ Component Slider(ConstStringRef label,
option.max = max;
option.increment = increment;
auto slider = Make<SliderBase<long>>(option);
return Make<SliderWithLabel>(label, slider);
return Make<SliderWithLabel>(std::move(label), slider);
}
/// @brief A slider in any direction.