mirror of
https://github.com/esphome/esphome.git
synced 2026-08-26 16:10:29 +00:00
[core] Fix false-positive readability-non-const-parameter in string_ref.h (#18758)
This commit is contained in:
@@ -239,7 +239,9 @@ template<typename R, typename F> inline R parse_number(const StringRef &str, siz
|
||||
}
|
||||
// NOLINTEND(google-runtime-int)
|
||||
} // namespace internal
|
||||
// NOLINTBEGIN(readability-identifier-naming,google-runtime-int)
|
||||
// readability-non-const-parameter: `pos` is written through by internal::parse_number, one call
|
||||
// frame away; the check only inspects these bodies, so it wrongly proposes `const size_t *`.
|
||||
// NOLINTBEGIN(readability-identifier-naming,google-runtime-int,readability-non-const-parameter)
|
||||
inline int stoi(const StringRef &str, size_t *pos = nullptr, int base = 10) {
|
||||
return static_cast<int>(internal::parse_number<long>(str, pos, base, std::strtol));
|
||||
}
|
||||
@@ -252,7 +254,7 @@ inline float stof(const StringRef &str, size_t *pos = nullptr) {
|
||||
inline double stod(const StringRef &str, size_t *pos = nullptr) {
|
||||
return internal::parse_number<double>(str, pos, std::strtod);
|
||||
}
|
||||
// NOLINTEND(readability-identifier-naming,google-runtime-int)
|
||||
// NOLINTEND(readability-identifier-naming,google-runtime-int,readability-non-const-parameter)
|
||||
|
||||
#ifdef USE_JSON
|
||||
// NOLINTNEXTLINE(readability-identifier-naming)
|
||||
|
||||
Reference in New Issue
Block a user