Skip to content

Commit 6392ec6

Browse files
committed
[clang-tidy] remove pointless const
Found with readability-const-return-type Signed-off-by: Rosen Penev <rosenp@gmail.com>
1 parent 98acc5a commit 6392ec6

8 files changed

Lines changed: 12 additions & 14 deletions

File tree

include/yaml-cpp/emitter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class YAML_CPP_API Emitter {
4444

4545
// state checking
4646
bool good() const;
47-
const std::string GetLastError() const;
47+
std::string GetLastError() const;
4848

4949
// global setters
5050
bool SetOutputCharset(EMITTER_MANIP value);

src/directives.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace YAML {
44
Directives::Directives() : version{true, 1, 2}, tags{} {}
55

6-
const std::string Directives::TranslateTagHandle(
6+
std::string Directives::TranslateTagHandle(
77
const std::string& handle) const {
88
auto it = tags.find(handle);
99
if (it == tags.end()) {

src/directives.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ struct Version {
1919
struct Directives {
2020
Directives();
2121

22-
const std::string TranslateTagHandle(const std::string& handle) const;
22+
std::string TranslateTagHandle(const std::string& handle) const;
2323

2424
Version version;
2525
std::map<std::string, std::string> tags;

src/emitter.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ std::size_t Emitter::size() const { return m_stream.pos(); }
2525
// state checking
2626
bool Emitter::good() const { return m_pState->good(); }
2727

28-
const std::string Emitter::GetLastError() const {
29-
return m_pState->GetLastError();
30-
}
28+
std::string Emitter::GetLastError() const { return m_pState->GetLastError(); }
3129

3230
// global setters
3331
bool Emitter::SetOutputCharset(EMITTER_MANIP value) {

src/scantag.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include "yaml-cpp/mark.h"
77

88
namespace YAML {
9-
const std::string ScanVerbatimTag(Stream& INPUT) {
9+
std::string ScanVerbatimTag(Stream& INPUT) {
1010
std::string tag;
1111

1212
// eat the start character
@@ -29,7 +29,7 @@ const std::string ScanVerbatimTag(Stream& INPUT) {
2929
throw ParserException(INPUT.mark(), ErrorMsg::END_OF_VERBATIM_TAG);
3030
}
3131

32-
const std::string ScanTagHandle(Stream& INPUT, bool& canBeHandle) {
32+
std::string ScanTagHandle(Stream& INPUT, bool& canBeHandle) {
3333
std::string tag;
3434
canBeHandle = true;
3535
Mark firstNonWordChar;
@@ -62,7 +62,7 @@ const std::string ScanTagHandle(Stream& INPUT, bool& canBeHandle) {
6262
return tag;
6363
}
6464

65-
const std::string ScanTagSuffix(Stream& INPUT) {
65+
std::string ScanTagSuffix(Stream& INPUT) {
6666
std::string tag;
6767

6868
while (INPUT) {

src/scantag.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
#include "stream.h"
1212

1313
namespace YAML {
14-
const std::string ScanVerbatimTag(Stream& INPUT);
15-
const std::string ScanTagHandle(Stream& INPUT, bool& canBeHandle);
16-
const std::string ScanTagSuffix(Stream& INPUT);
14+
std::string ScanVerbatimTag(Stream& INPUT);
15+
std::string ScanTagHandle(Stream& INPUT, bool& canBeHandle);
16+
std::string ScanTagSuffix(Stream& INPUT);
1717
}
1818

1919
#endif // SCANTAG_H_62B23520_7C8E_11DE_8A39_0800200C9A66

src/tag.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Tag::Tag(const Token& token)
2929
}
3030
}
3131

32-
const std::string Tag::Translate(const Directives& directives) {
32+
std::string Tag::Translate(const Directives& directives) {
3333
switch (type) {
3434
case VERBATIM:
3535
return value;

src/tag.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ struct Tag {
2323
};
2424

2525
Tag(const Token& token);
26-
const std::string Translate(const Directives& directives);
26+
std::string Translate(const Directives& directives);
2727

2828
TYPE type;
2929
std::string handle, value;

0 commit comments

Comments
 (0)