mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-01-21 00:51:43 +08:00
[cppcheck] add some std::move
Found with passedByValue Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
parent
c3cb44cd22
commit
39861d54c5
|
@ -617,7 +617,7 @@ class string_matcher_t {
|
|||
|
||||
public:
|
||||
string_matcher_t(options_t opts_, io_streams_t &streams_)
|
||||
: opts(opts_), streams(streams_), total_matched(0) {}
|
||||
: opts(std::move(opts_)), streams(streams_), total_matched(0) {}
|
||||
|
||||
virtual ~string_matcher_t() = default;
|
||||
virtual bool report_matches(const wcstring &arg) = 0;
|
||||
|
@ -879,7 +879,7 @@ class string_replacer_t {
|
|||
|
||||
public:
|
||||
string_replacer_t(const wchar_t *argv0_, options_t opts_, io_streams_t &streams_)
|
||||
: argv0(argv0_), opts(opts_), total_replaced(0), streams(streams_) {}
|
||||
: argv0(argv0_), opts(std::move(opts_)), total_replaced(0), streams(streams_) {}
|
||||
|
||||
virtual ~string_replacer_t() = default;
|
||||
int replace_count() const { return total_replaced; }
|
||||
|
|
|
@ -27,7 +27,7 @@ class enum_set_t : private std::bitset<enum_count<T>()> {
|
|||
static size_t index_of(T t) { return static_cast<size_t>(t); }
|
||||
|
||||
explicit enum_set_t(unsigned long raw) : super(raw) {}
|
||||
explicit enum_set_t(super sup) : super(sup) {}
|
||||
explicit enum_set_t(super sup) : super(std::move(sup)) {}
|
||||
|
||||
public:
|
||||
enum_set_t() = default;
|
||||
|
|
|
@ -74,7 +74,7 @@ struct event_handler_t {
|
|||
|
||||
explicit event_handler_t(event_type_t t) : desc(t) {}
|
||||
event_handler_t(event_description_t d, wcstring name)
|
||||
: desc(d), function_name(std::move(name)) {}
|
||||
: desc(std::move(d)), function_name(std::move(name)) {}
|
||||
};
|
||||
using event_handler_list_t = std::vector<std::shared_ptr<event_handler_t>>;
|
||||
|
||||
|
|
|
@ -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(input, &next, UNESCAPE_SPECIAL | UNESCAPE_INCOMPLETE);
|
||||
unescape_string(std::move(input), &next, UNESCAPE_SPECIAL | UNESCAPE_INCOMPLETE);
|
||||
|
||||
if (flags & expand_flag::skip_variables) {
|
||||
for (auto &i : next) {
|
||||
|
|
|
@ -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 = func; }
|
||||
void input_common_init(interrupt_func_t func) { interrupt_handler = std::move(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().
|
||||
|
|
|
@ -2324,10 +2324,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 = func;
|
||||
current_data()->highlight_func = std::move(func);
|
||||
}
|
||||
|
||||
void reader_set_test_function(test_function_t f) { current_data()->test_func = f; }
|
||||
void reader_set_test_function(test_function_t f) { current_data()->test_func = std::move(f); }
|
||||
|
||||
void reader_set_exit_on_interrupt(bool i) { current_data()->exit_on_interrupt = i; }
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user