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
This commit is contained in:
Hans Johnson 2018-12-12 13:42:53 -06:00 committed by Christopher Dunn
parent 9026a16ff5
commit 4abf4ec208
2 changed files with 4 additions and 4 deletions

View File

@ -69,7 +69,7 @@ Features::Features()
: allowComments_(true), strictRoot_(false),
allowDroppedNullPlaceholders_(false), allowNumericKeys_(false) {}
Features Features::all() { return Features(); }
Features Features::all() { return {}; }
Features Features::strictMode() {
Features features;
@ -906,7 +906,7 @@ public:
// exact copy of Implementation of class Features
// ////////////////////////////////
OurFeatures OurFeatures::all() { return OurFeatures(); }
OurFeatures OurFeatures::all() { return {}; }
// Implementation of class Reader
// ////////////////////////////////

View File

@ -1507,7 +1507,7 @@ Value::const_iterator Value::begin() const {
default:
break;
}
return const_iterator();
return {};
}
Value::const_iterator Value::end() const {
@ -1520,7 +1520,7 @@ Value::const_iterator Value::end() const {
default:
break;
}
return const_iterator();
return {};
}
Value::iterator Value::begin() {