1
0
mirror of https://github.com/esphome/esphome.git synced 2025-02-07 13:40:59 +00:00

fixed new clang-tidy issue

This commit is contained in:
j0ta29 2024-12-27 21:22:05 +00:00
parent 62b8a77c49
commit ab65fda4c2

View File

@ -3,6 +3,7 @@
#include "helpers.h" #include "helpers.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
#include <cstring> #include <cstring>
#include <algorithm>
namespace esphome { namespace esphome {
namespace optolink { namespace optolink {
@ -14,10 +15,9 @@ void rtrim(std::string &s) {
return; return;
std::string::iterator p; std::string::iterator p;
for (p = s.end(); p != s.begin() && *--p == ' ';) p = std::find_if(s.rbegin(), s.rend(), [](char ch) { return ch != ' '; }).base();
;
if (*p != ' ') if (p != s.begin() && *p != ' ')
p++; p++;
s.erase(p, s.end()); s.erase(p, s.end());