From 16f5e2e6eafbe92f8c5985277183bdd2bac1eaad Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Mon, 22 Jul 2024 23:47:31 -0500 Subject: [PATCH] backlight: clang-tidy --- include/modules/backlight.hpp | 7 +------ src/modules/backlight.cpp | 7 +++---- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/include/modules/backlight.hpp b/include/modules/backlight.hpp index 110cd434b..bdcc3aaf2 100644 --- a/include/modules/backlight.hpp +++ b/include/modules/backlight.hpp @@ -1,14 +1,9 @@ #pragma once -#include -#include #include -#include -#include #include "ALabel.hpp" #include "util/backlight_backend.hpp" -#include "util/json.hpp" struct udev; struct udev_device; @@ -18,7 +13,7 @@ namespace waybar::modules { class Backlight : public ALabel { public: Backlight(const std::string &, const Json::Value &); - virtual ~Backlight() = default; + ~Backlight() override = default; auto update() -> void override; bool handleScroll(GdkEventScroll *e) override; diff --git a/src/modules/backlight.cpp b/src/modules/backlight.cpp index 4ae511eb9..20fad829a 100644 --- a/src/modules/backlight.cpp +++ b/src/modules/backlight.cpp @@ -6,9 +6,8 @@ #include #include -#include #include -#include +#include #include "util/backend_common.hpp" #include "util/backlight_backend.hpp" @@ -27,7 +26,7 @@ waybar::modules::Backlight::Backlight(const std::string &id, const Json::Value & auto waybar::modules::Backlight::update() -> void { GET_BEST_DEVICE(best, backend, preferred_device_); - const auto previous_best_device = backend.get_previous_best_device(); + const auto *const previous_best_device = backend.get_previous_best_device(); if (best != nullptr) { if (previous_best_device != nullptr && *previous_best_device == *best && !previous_format_.empty() && previous_format_ == format_) { @@ -37,7 +36,7 @@ auto waybar::modules::Backlight::update() -> void { if (best->get_powered()) { event_box_.show(); const uint8_t percent = - best->get_max() == 0 ? 100 : round(best->get_actual() * 100.0f / best->get_max()); + best->get_max() == 0 ? 100 : std::round(best->get_actual() * 100.0F / best->get_max()); std::string desc = fmt::format(fmt::runtime(format_), fmt::arg("percent", percent), fmt::arg("icon", getIcon(percent))); label_.set_markup(desc);