[clang-tidy] performance

Found with performance*

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2020-04-02 17:07:36 -07:00 committed by Fabian Homborg
parent 8d3377e923
commit 194fa4a548
7 changed files with 12 additions and 12 deletions

View File

@ -141,7 +141,7 @@ maybe_t<autoloadable_file_t> autoload_file_cache_t::check(const wcstring &cmd, b
autoload_t::autoload_t(wcstring env_var_name)
: env_var_name_(std::move(env_var_name)), cache_(make_unique<autoload_file_cache_t>()) {}
autoload_t::autoload_t(autoload_t &&) = default;
autoload_t::autoload_t(autoload_t &&) noexcept = default;
autoload_t::~autoload_t() = default;
void autoload_t::invalidate_cache() {

View File

@ -923,7 +923,7 @@ expand_result_t expander_t::stage_variables(wcstring input, completion_list_t *o
// We accept incomplete strings here, since complete uses expand_string to expand incomplete
// strings from the commandline.
wcstring next;
unescape_string(std::move(input), &next, UNESCAPE_SPECIAL | UNESCAPE_INCOMPLETE);
unescape_string(input, &next, UNESCAPE_SPECIAL | UNESCAPE_INCOMPLETE);
if (flags & expand_flag::skip_variables) {
for (auto &i : next) {

View File

@ -431,9 +431,9 @@ bool inputter_t::mapping_is_match(const input_mapping_t &m) {
return true;
}
void inputter_t::queue_ch(const char_event_t &ch) { event_queue_.push_back(std::move(ch)); }
void inputter_t::queue_ch(const char_event_t &ch) { event_queue_.push_back(ch); }
void inputter_t::push_front(const char_event_t &ch) { event_queue_.push_front(std::move(ch)); }
void inputter_t::push_front(const char_event_t &ch) { event_queue_.push_front(ch); }
/// \return the first mapping that matches, walking first over the user's mapping list, then the
/// preset list. \return null if nothing matches.

View File

@ -39,7 +39,7 @@ static int wait_on_escape_ms = WAIT_ON_ESCAPE_DEFAULT;
/// Callback function for handling interrupts on reading.
static interrupt_func_t interrupt_handler;
void input_common_init(interrupt_func_t func) { interrupt_handler = std::move(func); }
void input_common_init(interrupt_func_t func) { interrupt_handler = func; }
/// Internal function used by input_common_readch to read one byte from fd 0. This function should
/// only be called by input_common_readch().

View File

@ -240,7 +240,7 @@ bool editable_line_t::undo() {
edit_t inverse = edit_t(edit.offset, edit.replacement.size(), L"");
inverse.replacement = edit.old;
size_t old_position = edit.cursor_position_before_edit;
apply_edit(&text_, std::move(inverse));
apply_edit(&text_, inverse);
set_position(old_position);
undo_history.may_coalesce = false;
return true;
@ -2330,10 +2330,10 @@ void reader_set_expand_abbreviations(bool flag) { current_data()->expand_abbrevi
void reader_set_complete_ok(bool flag) { current_data()->complete_ok = flag; }
void reader_set_highlight_function(highlight_function_t func) {
current_data()->highlight_func = std::move(func);
current_data()->highlight_func = func;
}
void reader_set_test_function(test_function_t f) { current_data()->test_func = std::move(f); }
void reader_set_test_function(test_function_t f) { current_data()->test_func = f; }
void reader_set_exit_on_interrupt(bool i) { current_data()->exit_on_interrupt = i; }

View File

@ -201,13 +201,13 @@ wcstring timer_snapshot_t::print_delta(timer_snapshot_t t1, timer_snapshot_t t2,
static std::vector<timer_snapshot_t> active_timers;
static void pop_timer() {
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());
}

View File

@ -166,7 +166,7 @@ static wcstring resolve_description(const wcstring &full_completion, wcstring *c
size_t complete_sep_loc = completion->find(PROG_COMPLETE_SEP);
if (complete_sep_loc != wcstring::npos) {
// This completion has an embedded description, do not use the generic description.
const wcstring description = completion->substr(complete_sep_loc + 1);
wcstring description = completion->substr(complete_sep_loc + 1);
completion->resize(complete_sep_loc);
return description;
}
@ -218,7 +218,7 @@ static bool wildcard_complete_internal(const wchar_t *str, const wchar_t *wc,
// Maybe we have no more wildcards at all. This includes the empty string.
if (next_wc_char_pos == wcstring::npos) {
string_fuzzy_match_t match = string_fuzzy_match_string(wc, str);
auto match = string_fuzzy_match_string(wc, str);
// If we're allowing fuzzy match, any match is OK. Otherwise we require a prefix match.
bool match_acceptable;