1
0
mirror of https://github.com/SerenityOS/serenity synced 2024-07-09 11:58:54 +00:00

Everywhere: Remove pessimizing and redundant move()

This commit is contained in:
Andreas Kling 2021-03-17 16:30:02 +01:00
parent fa28cc85e6
commit f59ad2dc57
9 changed files with 11 additions and 11 deletions

View File

@ -58,7 +58,7 @@ TEST_CASE(should_construct_by_copy)
TEST_CASE(should_construct_by_move) TEST_CASE(should_construct_by_move)
{ {
Counter c {}; Counter c {};
AK::NeverDestroyed<Counter> n { AK::move(c) }; AK::NeverDestroyed<Counter> n { move(c) };
EXPECT_EQ(0, n->num_copies); EXPECT_EQ(0, n->num_copies);
EXPECT_EQ(1, n->num_moves); EXPECT_EQ(1, n->num_moves);

View File

@ -45,9 +45,9 @@ public:
for (size_t i = 0; i < count; ++i) { for (size_t i = 0; i < count; ++i) {
if (destination <= source) if (destination <= source)
new (&destination[i]) T(AK::move(source[i])); new (&destination[i]) T(std::move(source[i]));
else else
new (&destination[count - i - 1]) T(AK::move(source[count - i - 1])); new (&destination[count - i - 1]) T(std::move(source[count - i - 1]));
} }
return; return;

View File

@ -75,7 +75,7 @@ OwnPtr<ParserAutoComplete::DocumentData> ParserAutoComplete::create_document_dat
update_declared_symbols(*document_data); update_declared_symbols(*document_data);
return move(document_data); return document_data;
} }
void ParserAutoComplete::set_document_data(const String& file, OwnPtr<DocumentData>&& data) void ParserAutoComplete::set_document_data(const String& file, OwnPtr<DocumentData>&& data)

View File

@ -67,7 +67,7 @@ OwnPtr<AutoComplete::DocumentData> AutoComplete::create_document_data_for(const
get_or_create_document_data(path); get_or_create_document_data(path);
update_declared_symbols(*document_data); update_declared_symbols(*document_data);
return move(document_data); return document_data;
} }
void AutoComplete::set_document_data(const String& file, OwnPtr<DocumentData>&& data) void AutoComplete::set_document_data(const String& file, OwnPtr<DocumentData>&& data)

View File

@ -120,7 +120,7 @@ OwnPtr<DebugSession> DebugSession::exec_and_attach(const String& command, String
// At this point, libraries should have been loaded // At this point, libraries should have been loaded
debug_session->update_loaded_libs(); debug_session->update_loaded_libs();
return move(debug_session); return debug_session;
} }
bool DebugSession::poke(u32* address, u32 data) bool DebugSession::poke(u32* address, u32 data)

View File

@ -78,7 +78,7 @@ Optional<DecodedImage> Client::decode_image(const ByteBuffer& encoded_data)
frame.bitmap = response->bitmaps()[i].bitmap(); frame.bitmap = response->bitmaps()[i].bitmap();
frame.duration = response->durations()[i]; frame.duration = response->durations()[i];
} }
return move(image); return image;
} }
} }

View File

@ -231,7 +231,7 @@ OwnPtr<Table> Table::parse(Vector<StringView>::ConstIterator& lines)
table->m_row_count = row_count; table->m_row_count = row_count;
return move(table); return table;
} }
} }

View File

@ -203,7 +203,7 @@ Vector<DNSAnswer> LookupServer::lookup(const DNSName& name, unsigned short recor
return {}; return {};
} }
return move(answers); return answers;
} }
Vector<DNSAnswer> LookupServer::lookup(const DNSName& name, const String& nameserver, bool& did_get_response, unsigned short record_type, ShouldRandomizeCase should_randomize_case) Vector<DNSAnswer> LookupServer::lookup(const DNSName& name, const String& nameserver, bool& did_get_response, unsigned short record_type, ShouldRandomizeCase should_randomize_case)
@ -296,7 +296,7 @@ Vector<DNSAnswer> LookupServer::lookup(const DNSName& name, const String& namese
answers.append(answer); answers.append(answer);
} }
return move(answers); return answers;
} }
void LookupServer::put_in_cache(const DNSAnswer& answer) void LookupServer::put_in_cache(const DNSAnswer& answer)

View File

@ -1239,7 +1239,7 @@ RefPtr<AST::Node> Parser::parse_string()
auto result = create<AST::StringLiteral>(move(text)); // String Literal auto result = create<AST::StringLiteral>(move(text)); // String Literal
if (is_error) if (is_error)
result->set_is_syntax_error(*create<AST::SyntaxError>("Expected a terminating single quote", true)); result->set_is_syntax_error(*create<AST::SyntaxError>("Expected a terminating single quote", true));
return move(result); return result;
} }
return nullptr; return nullptr;