Apply clang-tidy

This commit is contained in:
ArthurSonzogni 2023-08-08 01:57:43 +02:00
parent e2a205ed0d
commit 461d557674
No known key found for this signature in database
GPG Key ID: 41D98248C074CD6C
5 changed files with 15 additions and 11 deletions

View File

@ -1,5 +1,6 @@
--- ---
Checks: "*, Checks: "*,
-*-macro-usage,
-*-magic-numbers, -*-magic-numbers,
-*-narrowing-conversions -*-narrowing-conversions
-*-unnecessary-value-param, -*-unnecessary-value-param,
@ -22,7 +23,9 @@ Checks: "*,
-readability-identifier-length, -readability-identifier-length,
-readability-implicit-bool-conversion, -readability-implicit-bool-conversion,
-readability-non-const-parameter, -readability-non-const-parameter,
-readability-simplify-boolean-expr,
-readability-static-accessed-through-instance, -readability-static-accessed-through-instance,
-readability-use-anyofallof,
-zircon-*, -zircon-*,
" "
WarningsAsErrors: '' WarningsAsErrors: ''

View File

@ -237,7 +237,7 @@ class TabContainer : public ContainerBase {
class StackedContainer : public ContainerBase { class StackedContainer : public ContainerBase {
public: public:
StackedContainer(Components children) explicit StackedContainer(Components children)
: ContainerBase(std::move(children), nullptr) {} : ContainerBase(std::move(children), nullptr) {}
private: private:
@ -252,7 +252,7 @@ class StackedContainer : public ContainerBase {
} }
bool Focusable() const final { bool Focusable() const final {
for (auto& child : children_) { for (const auto& child : children_) {
if (child->Focusable()) { if (child->Focusable()) {
return true; return true;
} }
@ -261,13 +261,14 @@ class StackedContainer : public ContainerBase {
} }
Component ActiveChild() final { Component ActiveChild() final {
if (children_.size() == 0) if (children_.empty()) {
return nullptr; return nullptr;
}
return children_[0]; return children_[0];
} }
void SetActiveChild(ComponentBase* child) final { void SetActiveChild(ComponentBase* child) final {
if (children_.size() == 0) { if (children_.empty()) {
return; return;
} }

View File

@ -91,7 +91,7 @@ Element DefaultRenderState(const WindowRenderState& state) {
element = window(text(state.title), element); element = window(text(state.title), element);
element |= clear_under; element |= clear_under;
Color color = Color::Red; const Color color = Color::Red;
element = std::make_shared<ResizeDecorator>( // element = std::make_shared<ResizeDecorator>( //
element, // element, //
@ -107,7 +107,7 @@ Element DefaultRenderState(const WindowRenderState& state) {
class WindowImpl : public ComponentBase, public WindowOptions { class WindowImpl : public ComponentBase, public WindowOptions {
public: public:
WindowImpl(WindowOptions option) : WindowOptions(std::move(option)) { explicit WindowImpl(WindowOptions option) : WindowOptions(std::move(option)) {
if (!inner) { if (!inner) {
inner = Make<ComponentBase>(); inner = Make<ComponentBase>();
} }
@ -118,7 +118,7 @@ class WindowImpl : public ComponentBase, public WindowOptions {
Element Render() final { Element Render() final {
auto element = ComponentBase::Render(); auto element = ComponentBase::Render();
bool captureable = const bool captureable =
captured_mouse_ || ScreenInteractive::Active()->CaptureMouse(); captured_mouse_ || ScreenInteractive::Active()->CaptureMouse();
const WindowRenderState state = { const WindowRenderState state = {

View File

@ -78,7 +78,7 @@ void UpdatePixelStyle(const Screen* screen,
} }
// Bold // Bold
if (FTXUI_UNLIKELY(next.bold != prev.bold || next.dim != prev.dim)) { if (FTXUI_UNLIKELY((next.bold ^ prev.bold) | (next.dim ^ prev.dim))) {
// BOLD_AND_DIM_RESET: // BOLD_AND_DIM_RESET:
ss << ((prev.bold && !next.bold) || (prev.dim && !next.dim) ? "\x1B[22m" ss << ((prev.bold && !next.bold) || (prev.dim && !next.dim) ? "\x1B[22m"
: ""); : "");

View File

@ -24,7 +24,7 @@ struct Interval {
}; };
// As of Unicode 13.0.0 // As of Unicode 13.0.0
static constexpr std::array<Interval, 116> g_full_width_characters = {{ constexpr std::array<Interval, 116> g_full_width_characters = {{
{0x01100, 0x0115f}, {0x0231a, 0x0231b}, {0x02329, 0x0232a}, {0x01100, 0x0115f}, {0x0231a, 0x0231b}, {0x02329, 0x0232a},
{0x023e9, 0x023ec}, {0x023f0, 0x023f0}, {0x023f3, 0x023f3}, {0x023e9, 0x023ec}, {0x023f0, 0x023f0}, {0x023f3, 0x023f3},
{0x025fd, 0x025fe}, {0x02614, 0x02615}, {0x02648, 0x02653}, {0x025fd, 0x025fe}, {0x02614, 0x02615}, {0x02648, 0x02653},
@ -75,7 +75,7 @@ struct WordBreakPropertyInterval {
// Properties from: // Properties from:
// https://www.unicode.org/Public/UCD/latest/ucd/auxiliary/WordBreakProperty.txt // https://www.unicode.org/Public/UCD/latest/ucd/auxiliary/WordBreakProperty.txt
static constexpr std::array<WordBreakPropertyInterval, 993> constexpr std::array<WordBreakPropertyInterval, 993>
g_word_break_intervals = {{ g_word_break_intervals = {{
{0x0000A, 0x0000A, WBP::LF}, {0x0000A, 0x0000A, WBP::LF},
{0x0000B, 0x0000C, WBP::Newline}, {0x0000B, 0x0000C, WBP::Newline},
@ -1090,7 +1090,7 @@ constexpr auto g_extend_characters{[]() constexpr {
size_t index = 0; size_t index = 0;
for (auto interval : g_word_break_intervals) { for (auto interval : g_word_break_intervals) {
if (interval.property == WBP::Extend) { if (interval.property == WBP::Extend) {
result[index++] = {interval.first, interval.last}; result[index++] = {interval.first, interval.last}; // NOLINT
} }
} }
return result; return result;