Skip to content

Commit 4abf4ec

Browse files
hjmjohnsoncdunn2001
authored andcommitted
PERF: Replace explicit return calls of constructor
Replaces explicit calls to the constructor in a return with a braced initializer list. This way the return type is not needlessly duplicated in the function definition and the return statement. SRCDIR=/Users/johnsonhj/src/jsoncpp #My local SRC BLDDIR=/Users/johnsonhj/src/jsoncpp/cmake-build-debug/ #My local BLD cd /Users/johnsonhj/src/jsoncpp/cmake-build-debug/ run-clang-tidy.py -extra-arg=-D__clang__ -checks=-*,modernize-return-braced-init-list -header-filter=.* -fix
1 parent 9026a16 commit 4abf4ec

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/lib_json/json_reader.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Features::Features()
6969
: allowComments_(true), strictRoot_(false),
7070
allowDroppedNullPlaceholders_(false), allowNumericKeys_(false) {}
7171

72-
Features Features::all() { return Features(); }
72+
Features Features::all() { return {}; }
7373

7474
Features Features::strictMode() {
7575
Features features;
@@ -906,7 +906,7 @@ class OurFeatures {
906906
// exact copy of Implementation of class Features
907907
// ////////////////////////////////
908908

909-
OurFeatures OurFeatures::all() { return OurFeatures(); }
909+
OurFeatures OurFeatures::all() { return {}; }
910910

911911
// Implementation of class Reader
912912
// ////////////////////////////////

src/lib_json/json_value.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,7 +1507,7 @@ Value::const_iterator Value::begin() const {
15071507
default:
15081508
break;
15091509
}
1510-
return const_iterator();
1510+
return {};
15111511
}
15121512

15131513
Value::const_iterator Value::end() const {
@@ -1520,7 +1520,7 @@ Value::const_iterator Value::end() const {
15201520
default:
15211521
break;
15221522
}
1523-
return const_iterator();
1523+
return {};
15241524
}
15251525

15261526
Value::iterator Value::begin() {

0 commit comments

Comments
 (0)