[clang-tidy] use nodiscard
Found with modernize-use-nodiscard Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
parent
12bc8d78e7
commit
cc2007cdb8
@ -45,6 +45,12 @@ THE SOFTWARE.
|
|||||||
#define CXXOPTS_HAS_OPTIONAL
|
#define CXXOPTS_HAS_OPTIONAL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if __cplusplus >= 201603L
|
||||||
|
#define CXXOPTS_NODISCARD [[nodiscard]]
|
||||||
|
#else
|
||||||
|
#define CXXOPTS_NODISCARD
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef CXXOPTS_VECTOR_DELIMITER
|
#ifndef CXXOPTS_VECTOR_DELIMITER
|
||||||
#define CXXOPTS_VECTOR_DELIMITER ','
|
#define CXXOPTS_VECTOR_DELIMITER ','
|
||||||
#endif
|
#endif
|
||||||
@ -330,6 +336,7 @@ namespace cxxopts
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CXXOPTS_NODISCARD
|
||||||
const char*
|
const char*
|
||||||
what() const noexcept override
|
what() const noexcept override
|
||||||
{
|
{
|
||||||
@ -922,6 +929,7 @@ namespace cxxopts
|
|||||||
public:
|
public:
|
||||||
using abstract_value<T>::abstract_value;
|
using abstract_value<T>::abstract_value;
|
||||||
|
|
||||||
|
CXXOPTS_NODISCARD
|
||||||
std::shared_ptr<Value>
|
std::shared_ptr<Value>
|
||||||
clone() const
|
clone() const
|
||||||
{
|
{
|
||||||
@ -1008,28 +1016,34 @@ namespace cxxopts
|
|||||||
|
|
||||||
OptionDetails(OptionDetails&& rhs) = default;
|
OptionDetails(OptionDetails&& rhs) = default;
|
||||||
|
|
||||||
|
CXXOPTS_NODISCARD
|
||||||
const String&
|
const String&
|
||||||
description() const
|
description() const
|
||||||
{
|
{
|
||||||
return m_desc;
|
return m_desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Value& value() const {
|
CXXOPTS_NODISCARD
|
||||||
|
const Value&
|
||||||
|
value() const {
|
||||||
return *m_value;
|
return *m_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CXXOPTS_NODISCARD
|
||||||
std::shared_ptr<Value>
|
std::shared_ptr<Value>
|
||||||
make_storage() const
|
make_storage() const
|
||||||
{
|
{
|
||||||
return m_value->clone();
|
return m_value->clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CXXOPTS_NODISCARD
|
||||||
const std::string&
|
const std::string&
|
||||||
short_name() const
|
short_name() const
|
||||||
{
|
{
|
||||||
return m_short;
|
return m_short;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CXXOPTS_NODISCARD
|
||||||
const std::string&
|
const std::string&
|
||||||
long_name() const
|
long_name() const
|
||||||
{
|
{
|
||||||
@ -1088,6 +1102,7 @@ namespace cxxopts
|
|||||||
m_value->parse();
|
m_value->parse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CXXOPTS_NODISCARD
|
||||||
size_t
|
size_t
|
||||||
count() const noexcept
|
count() const noexcept
|
||||||
{
|
{
|
||||||
@ -1095,6 +1110,7 @@ namespace cxxopts
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: maybe default options should count towards the number of arguments
|
// TODO: maybe default options should count towards the number of arguments
|
||||||
|
CXXOPTS_NODISCARD
|
||||||
bool
|
bool
|
||||||
has_default() const noexcept
|
has_default() const noexcept
|
||||||
{
|
{
|
||||||
@ -1140,15 +1156,15 @@ namespace cxxopts
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const
|
CXXOPTS_NODISCARD
|
||||||
std::string&
|
const std::string&
|
||||||
key() const
|
key() const
|
||||||
{
|
{
|
||||||
return m_key;
|
return m_key;
|
||||||
}
|
}
|
||||||
|
|
||||||
const
|
CXXOPTS_NODISCARD
|
||||||
std::string&
|
const std::string&
|
||||||
value() const
|
value() const
|
||||||
{
|
{
|
||||||
return m_value;
|
return m_value;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user