[helpers, optional] clang-tidy fixes for #7822 (#7841)

This commit is contained in:
Keith Burzinski 2024-11-26 12:08:02 -06:00 committed by GitHub
parent 39f3f795e2
commit e3d673d16c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View file

@ -293,7 +293,7 @@ std::string str_sanitize(const std::string &str) {
std::replace_if(
out.begin(), out.end(),
[](const char &c) {
return !(c == '-' || c == '_' || (c >= '0' && c <= '9') || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
return c != '-' && c != '_' && (c < '0' || c > '9') && (c < 'a' || c > 'z') && (c < 'A' || c > 'Z');
},
'_');
return out;

View file

@ -59,7 +59,7 @@ template<typename T> class optional { // NOLINT
return *this;
}
void swap(optional &rhs) {
void swap(optional &rhs) noexcept {
using std::swap;
if (has_value() && rhs.has_value()) {
swap(**this, *rhs);
@ -206,7 +206,7 @@ template<typename T, typename U> inline bool operator>=(U const &v, optional<T>
// Specialized algorithms
template<typename T> void swap(optional<T> &x, optional<T> &y) { x.swap(y); }
template<typename T> void swap(optional<T> &x, optional<T> &y) noexcept { x.swap(y); }
// Convenience function to create an optional.