diff --git a/src/builtin_eval.cpp b/src/builtin_eval.cpp index 7a3acc9b9..589525dad 100644 --- a/src/builtin_eval.cpp +++ b/src/builtin_eval.cpp @@ -27,7 +27,7 @@ int builtin_eval(parser_t &parser, io_streams_t &streams, wchar_t **argv) { const auto cached_exec_count = parser.libdata().exec_count; int status = STATUS_CMD_OK; if (argc > 1) { - if (parser.eval(std::move(new_cmd), *streams.io_chain) != eval_result_t::ok) { + if (parser.eval(new_cmd, *streams.io_chain) != eval_result_t::ok) { status = STATUS_CMD_ERROR; } else if (cached_exec_count == parser.libdata().exec_count) { // Issue #5692, in particular, to catch `eval ""`, `eval "begin; end;"`, etc. diff --git a/src/builtin_string.cpp b/src/builtin_string.cpp index 67f4c38b6..36a1b7042 100644 --- a/src/builtin_string.cpp +++ b/src/builtin_string.cpp @@ -615,7 +615,7 @@ class string_matcher_t { public: string_matcher_t(options_t opts_, io_streams_t &streams_) - : opts(std::move(opts_)), streams(streams_), total_matched(0) {} + : opts(opts_), streams(streams_), total_matched(0) {} virtual ~string_matcher_t() = default; virtual bool report_matches(const wcstring &arg) = 0; @@ -888,7 +888,7 @@ class string_replacer_t { public: string_replacer_t(const wchar_t *argv0_, options_t opts_, io_streams_t &streams_) - : argv0(argv0_), opts(std::move(opts_)), total_replaced(0), streams(streams_) {} + : argv0(argv0_), opts(opts_), total_replaced(0), streams(streams_) {} virtual ~string_replacer_t() = default; int replace_count() const { return total_replaced; } diff --git a/src/builtin_test.cpp b/src/builtin_test.cpp index 3c7485a25..2814a3046 100644 --- a/src/builtin_test.cpp +++ b/src/builtin_test.cpp @@ -217,7 +217,7 @@ struct range_t { /// Base class for expressions. class expression { protected: - expression(token_t what, range_t where) : token(what), range(std::move(where)) {} + expression(token_t what, range_t where) : token(what), range(where) {} public: const token_t token; diff --git a/src/complete.cpp b/src/complete.cpp index 440dba2e8..b1214c2fe 100644 --- a/src/complete.cpp +++ b/src/complete.cpp @@ -209,7 +209,7 @@ completion_t::completion_t(wcstring comp, wcstring desc, string_fuzzy_match_t ma complete_flags_t flags_val) : completion(std::move(comp)), description(std::move(desc)), - match(std::move(mat)), + match(mat), flags(resolve_auto_space(completion, flags_val)) {} completion_t::completion_t(const completion_t &) = default; diff --git a/src/env_universal_common.cpp b/src/env_universal_common.cpp index 2f6b23d21..acb7bc783 100644 --- a/src/env_universal_common.cpp +++ b/src/env_universal_common.cpp @@ -279,7 +279,7 @@ void env_universal_t::set_internal(const wcstring &key, const env_var_t &var) { void env_universal_t::set(const wcstring &key, env_var_t var) { scoped_lock locker(lock); - this->set_internal(key, std::move(var)); + this->set_internal(key, var); } bool env_universal_t::remove_internal(const wcstring &key) { diff --git a/src/parse_execution.cpp b/src/parse_execution.cpp index c292e7208..f103be7b5 100644 --- a/src/parse_execution.cpp +++ b/src/parse_execution.cpp @@ -1049,7 +1049,7 @@ eval_result_t parse_execution_context_t::apply_variable_assignments( vals.emplace_back(std::move(completion.completion)); } if (proc) proc->variable_assignments.push_back({variable_name, vals}); - parser->vars().set(std::move(variable_name), ENV_LOCAL | ENV_EXPORT, std::move(vals)); + parser->vars().set(variable_name, ENV_LOCAL | ENV_EXPORT, std::move(vals)); } return eval_result_t::ok; } @@ -1409,13 +1409,13 @@ eval_result_t parse_execution_context_t::run_job_list(tnode_t job_list, result = this->run_job_conjunction(job_conj, associated_block); } if (timer_started) { - auto t1 = std::move(active_timers.back()); + auto t1 = active_timers.back(); active_timers.pop_back(); auto t2 = timer_snapshot_t::take(); // Well, this is awkward. By defining `time` as a decorator and not a built-in, there's // no associated stream for its output! - auto output = timer_snapshot_t::print_delta(std::move(t1), std::move(t2), true); + auto output = timer_snapshot_t::print_delta(t1, t2, true); std::fwprintf(stderr, L"%S\n", output.c_str()); } } diff --git a/src/parser.cpp b/src/parser.cpp index e901b61d6..0a6b7f4d5 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -110,7 +110,7 @@ void parser_t::skip_all_blocks() { // Given a new-allocated block, push it onto our block list, acquiring ownership. block_t *parser_t::push_block(block_t &&block) { - block_t new_current{std::move(block)}; + block_t new_current{block}; const enum block_type_t type = new_current.type(); new_current.src_lineno = parser_t::get_lineno(); @@ -147,7 +147,7 @@ void parser_t::pop_block(const block_t *expected) { assert(!block_list.empty() && "empty block list"); // Acquire ownership out of the block list. - block_t old = std::move(block_list.front()); + block_t old = block_list.front(); block_list.pop_front(); if (old.wants_pop_env) vars().pop(); diff --git a/src/reader.cpp b/src/reader.cpp index b90d99ee7..eb406f35e 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -1299,7 +1299,7 @@ static std::function get_autosuggestion_performer history_search_t searcher(*history, search_string, history_search_type_t::prefix); while (!reader_test_should_cancel() && searcher.go_backwards()) { - history_item_t item = searcher.current_item(); + const history_item_t &item = searcher.current_item(); // Skip items with newlines because they make terrible autosuggestions. if (item.str().find(L'\n') != wcstring::npos) continue; diff --git a/src/screen.cpp b/src/screen.cpp index ed8668fa7..bda1996e9 100644 --- a/src/screen.cpp +++ b/src/screen.cpp @@ -278,7 +278,7 @@ maybe_t layout_cache_t::find_prompt_layout(const wcstring &inpu void layout_cache_t::add_prompt_layout(wcstring input, prompt_layout_t layout) { assert(!find_prompt_layout(input) && "Should not have a prompt layout for this input"); - prompt_cache_.emplace_front(std::move(input), std::move(layout)); + prompt_cache_.emplace_front(std::move(input), layout); if (prompt_cache_.size() > prompt_cache_max_size) { prompt_cache_.pop_back(); }