Clang-Tidy: Address readability-redundant-string-init

This commit is contained in:
Sergey Sharybin 2020-08-07 12:17:29 +02:00
parent 156448ba4b
commit cfc6f9eb18
7 changed files with 6 additions and 8 deletions

View File

@ -17,7 +17,6 @@ Checks: >
-readability-redundant-preprocessor,
-readability-function-size,
-readability-function-size,
-readability-redundant-string-init,
-readability-redundant-member-init,
-readability-const-return-type,
-readability-static-accessed-through-instance,

View File

@ -83,7 +83,7 @@ string gnuplotify_id_code(const string &name)
string gnuplotify_name(const string &name)
{
string result = "";
string result;
const int length = name.length();
for (int i = 0; i < length; i++) {
const char ch = name[i];

View File

@ -429,7 +429,7 @@ string stringify_update_bitfield(int flag)
if (flag == 0) {
return "LEGACY_0";
}
string result = "";
string result;
int current_flag = flag;
/* Special cases to avoid ALL flags form being split into
* individual bits. */

View File

@ -741,7 +741,7 @@ static void imb_exr_get_views(MultiPartInputFile &file, StringVector &views)
else {
for (int p = 0; p < file.parts(); p++) {
std::string view = "";
std::string view;
if (file.header(p).hasView()) {
view = file.header(p).view();
}

View File

@ -230,7 +230,7 @@ void AnimationExporter::export_matrix_animation(Object *ob, BCAnimationSampler &
std::string name = encode_xml(id_name(ob));
std::string action_name = (action == NULL) ? name + "-action" : id_name(action);
std::string channel_type = "transform";
std::string axis = "";
std::string axis;
std::string id = bc_get_action_id(action_name, name, channel_type, axis);
std::string target = translate_id(name) + '/' + channel_type;

View File

@ -277,7 +277,7 @@ std::string encode_xml(std::string xml)
{'<', "&lt;"}, {'>', "&gt;"}, {'"', "&quot;"}, {'\'', "&apos;"}, {'&', "&amp;"}};
std::map<char, std::string>::const_iterator it;
std::string encoded_xml = "";
std::string encoded_xml;
for (unsigned int i = 0; i < xml.size(); i++) {
char c = xml.at(i);

View File

@ -672,8 +672,7 @@ void BoneExtended::set_bone_layers(std::string layerString, std::vector<std::str
std::string BoneExtended::get_bone_layers(int bitfield)
{
std::string result = "";
std::string sep = "";
std::string sep;
int bit = 1u;
std::ostringstream ss;