diff options
author | tobo <tobo@yandex-team.com> | 2022-08-04 01:20:39 +0300 |
---|---|---|
committer | tobo <tobo@yandex-team.com> | 2022-08-04 01:20:39 +0300 |
commit | 16b2eba4a9b2f5e1b2891730b8c39c7289f1ec1e (patch) | |
tree | 0a0dd8b76dc183a6d6c087141b17d1315e640a97 | |
parent | dbd229b9d6e3ae64e48726e3a8e790a3bf31f518 (diff) | |
download | ydb-16b2eba4a9b2f5e1b2891730b8c39c7289f1ec1e.tar.gz |
add [[nodiscard]] attribute to Strip functions
-rw-r--r-- | util/string/strip.h | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/util/string/strip.h b/util/string/strip.h index 8d9e5ed988..599fdd93ad 100644 --- a/util/string/strip.h +++ b/util/string/strip.h @@ -102,14 +102,14 @@ struct TStripImpl { } template <class T, class TStripCriterion> - static inline T StripString(const T& from, TStripCriterion&& criterion) { + [[nodiscard]] static inline T StripString(const T& from, TStripCriterion&& criterion) { T ret; StripString(from, ret, criterion); return ret; } template <class T> - static inline T StripString(const T& from) { + [[nodiscard]] static inline T StripString(const T& from) { return StripString(from, IsAsciiSpaceAdapter(from.begin())); } }; @@ -153,32 +153,32 @@ static inline bool StripString(const T& from, T& to) { } template <class T, class TStripCriterion> -static inline T StripString(const T& from, TStripCriterion&& criterion) { +[[nodiscard]] static inline T StripString(const T& from, TStripCriterion&& criterion) { return TStripImpl<true, true>::StripString(from, criterion); } template <class T> -static inline T StripString(const T& from) { +[[nodiscard]] static inline T StripString(const T& from) { return TStripImpl<true, true>::StripString(from); } template <class T> -static inline T StripStringLeft(const T& from) { +[[nodiscard]] static inline T StripStringLeft(const T& from) { return TStripImpl<true, false>::StripString(from); } template <class T> -static inline T StripStringRight(const T& from) { +[[nodiscard]] static inline T StripStringRight(const T& from) { return TStripImpl<false, true>::StripString(from); } template <class T, class TStripCriterion> -static inline T StripStringLeft(const T& from, TStripCriterion&& criterion) { +[[nodiscard]] static inline T StripStringLeft(const T& from, TStripCriterion&& criterion) { return TStripImpl<true, false>::StripString(from, criterion); } template <class T, class TStripCriterion> -static inline T StripStringRight(const T& from, TStripCriterion&& criterion) { +[[nodiscard]] static inline T StripStringRight(const T& from, TStripCriterion&& criterion) { return TStripImpl<false, true>::StripString(from, criterion); } @@ -199,8 +199,7 @@ inline void StripInPlace(T& s) { } /// Returns a copy of the given string with removed leading and trailing spaces. -inline TString Strip(const TString& s) Y_WARN_UNUSED_RESULT; -inline TString Strip(const TString& s) { +[[nodiscard]] inline TString Strip(const TString& s) { TString ret = s; Strip(ret, ret); return ret; @@ -263,8 +262,7 @@ inline TStringType& CollapseInPlace(TStringType& s, TWhitespaceFunc isWhitespace } /// Replaces several consequtive space symbols with one (processing is limited to maxLen bytes) -inline TString Collapse(const TString& s, size_t maxLen = 0) Y_WARN_UNUSED_RESULT; -inline TString Collapse(const TString& s, size_t maxLen) { +[[nodiscard]] inline TString Collapse(const TString& s, size_t maxLen = 0) { TString ret; Collapse(s, ret, maxLen); return ret; |