refactor(Core): apply clang-tidy modernize-use-nodiscard (#3835)

This commit is contained in:
Francesco Borzì
2020-12-06 19:39:48 +01:00
committed by GitHub
parent d4a58700d4
commit 161302252e
82 changed files with 1565 additions and 1569 deletions

View File

@@ -24,7 +24,7 @@ class ByteBufferException : public std::exception
public:
~ByteBufferException() throw() override { }
char const* what() const throw() override { return msg_.c_str(); }
[[nodiscard]] char const* what() const throw() override { return msg_.c_str(); }
protected:
std::string& message() throw() { return msg_; }
@@ -277,7 +277,7 @@ public:
return _storage[pos];
}
size_t rpos() const { return _rpos; }
[[nodiscard]] size_t rpos() const { return _rpos; }
size_t rpos(size_t rpos_)
{
@@ -290,7 +290,7 @@ public:
_rpos = wpos();
}
size_t wpos() const { return _wpos; }
[[nodiscard]] size_t wpos() const { return _wpos; }
size_t wpos(size_t wpos_)
{
@@ -315,7 +315,7 @@ public:
return r;
}
template <typename T> T read(size_t pos) const
template <typename T> [[nodiscard]] [[nodiscard]] [[nodiscard]] [[nodiscard]] [[nodiscard]] [[nodiscard]] [[nodiscard]] [[nodiscard]] [[nodiscard]] [[nodiscard]] [[nodiscard]] T read(size_t pos) const
{
if (pos + sizeof(T) > size())
throw ByteBufferPositionException(false, pos, sizeof(T), size());
@@ -385,15 +385,15 @@ public:
return &_storage[0];
}
const uint8* contents() const
[[nodiscard]] const uint8* contents() const
{
if (_storage.empty())
throw ByteBufferException();
return &_storage[0];
}
size_t size() const { return _storage.size(); }
bool empty() const { return _storage.empty(); }
[[nodiscard]] size_t size() const { return _storage.size(); }
[[nodiscard]] bool empty() const { return _storage.empty(); }
void resize(size_t newsize)
{