[clang-tidy] remove redundant string initialization

Found with readability-redundant-string-init

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2020-04-02 19:43:34 -07:00 committed by Fabian Homborg
parent 473a5250ae
commit 68467eeca7
6 changed files with 7 additions and 6 deletions

View File

@ -1,5 +1,5 @@
---
Checks: 'clang-diagnostic-*,clang-analyzer-*,cert-*,performance-*,portability-*,modernize-use-auto,modernize-loop-convert,modernize-use-bool-literals,modernize-use-using,hicpp-uppercase-literal-suffix,readability-make-member-function-const'
Checks: 'clang-diagnostic-*,clang-analyzer-*,cert-*,performance-*,portability-*,modernize-use-auto,modernize-loop-convert,modernize-use-bool-literals,modernize-use-using,hicpp-uppercase-literal-suffix,readability-make-member-function-const,readability-redundant-string-init,readability-inconsistent-declaration-parameter-name'
WarningsAsErrors: ''
HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false

View File

@ -51,7 +51,7 @@ struct argparse_cmd_opts_t {
size_t min_args = 0;
size_t max_args = SIZE_MAX;
wchar_t implicit_int_flag = L'\0';
wcstring name = L"";
wcstring name;
wcstring_list_t raw_exclusive_flags;
wcstring_list_t argv;
std::unordered_map<wchar_t, option_spec_ref_t> options;

View File

@ -29,7 +29,7 @@
struct function_cmd_opts_t {
bool print_help = false;
bool shadow_scope = true;
wcstring description = L"";
wcstring description;
std::vector<event_description_t> events;
wcstring_list_t named_arguments;
wcstring_list_t inherit_vars;

View File

@ -9,5 +9,6 @@ class parser_t;
struct io_streams_t;
int builtin_function(parser_t &parser, io_streams_t &streams, const wcstring_list_t &c_args,
const parsed_source_ref_t &source, tnode_t<grammar::block_statement> body);
const parsed_source_ref_t &source,
tnode_t<grammar::block_statement> func_node);
#endif

View File

@ -189,7 +189,7 @@ wcstring expand_escape_variable(const env_var_t &var);
/// Convert a string value to a human readable form, i.e. escape things, handle arrays, etc.
/// Suitable for pretty-printing.
wcstring expand_escape_string(const wcstring &str);
wcstring expand_escape_string(const wcstring &el);
/// Perform tilde expansion and nothing else on the specified string, which is modified in place.
///

View File

@ -485,7 +485,7 @@ end_execution_reason_t parse_execution_context_t::run_switch_statement(
// If we expanded to nothing, match the empty string.
assert(switch_values_expanded.size() <= 1 && "Should have at most one expansion");
wcstring switch_value_expanded = L"";
wcstring switch_value_expanded;
if (!switch_values_expanded.empty()) {
switch_value_expanded = std::move(switch_values_expanded.front().completion);
}