Merge pull request #13671 from tygyh/Source/Remove-redundant-lambda-parameter-lists

Source: Remove redundant lambda parameter lists
This commit is contained in:
Jordan Woyak
2025-06-14 03:49:47 -05:00
committed by GitHub
54 changed files with 108 additions and 111 deletions
+4 -5
View File
@@ -504,16 +504,15 @@ void GekkoIRPlugin::AddBinaryEvaluator(u32 (*evaluator)(u32, u32))
m_fixup_stack.pop();
std::function<u32()> lhs = std::move(m_fixup_stack.top());
m_fixup_stack.pop();
m_fixup_stack.emplace([evaluator, lhs = std::move(lhs), rhs = std::move(rhs)]() {
return evaluator(lhs(), rhs());
});
m_fixup_stack.emplace(
[evaluator, lhs = std::move(lhs), rhs = std::move(rhs)] { return evaluator(lhs(), rhs()); });
}
void GekkoIRPlugin::AddUnaryEvaluator(u32 (*evaluator)(u32))
{
std::function<u32()> sub = std::move(m_fixup_stack.top());
m_fixup_stack.pop();
m_fixup_stack.emplace([evaluator, sub = std::move(sub)]() { return evaluator(sub()); });
m_fixup_stack.emplace([evaluator, sub = std::move(sub)] { return evaluator(sub()); });
}
void GekkoIRPlugin::AddAbsoluteAddressConv()
@@ -579,7 +578,7 @@ void GekkoIRPlugin::AddNumLabelSymResolve(std::string_view sym, u32 num)
// Searching forward only
size_t search_start_idx = static_cast<size_t>(m_numlabs.size());
m_fixup_stack.emplace(
[this, num, source_address, search_start_idx, err_on_fail = std::move(err_on_fail)]() {
[this, num, source_address, search_start_idx, err_on_fail = std::move(err_on_fail)] {
for (size_t i = search_start_idx; i < m_numlabs.size(); i++)
{
if (num == m_numlabs[i].first)
+3 -3
View File
@@ -380,7 +380,7 @@ bool AchievementManager::CanPause()
void AchievementManager::DoIdle()
{
std::thread([this]() {
std::thread([this] {
while (true)
{
Common::SleepCurrentThread(1000);
@@ -959,7 +959,7 @@ void AchievementManager::LeaderboardEntriesCallback(int result, const char* erro
rc_client_t* client, void* userdata)
{
u32* leaderboard_id = static_cast<u32*>(userdata);
Common::ScopeGuard on_end_scope([&]() { delete leaderboard_id; });
Common::ScopeGuard on_end_scope([&] { delete leaderboard_id; });
if (result != RC_OK)
{
@@ -1372,7 +1372,7 @@ void AchievementManager::FetchBadge(AchievementManager::Badge* badge, u32 badge_
m_image_queue.Push([this, badge, badge_type, function = std::move(function),
callback_data = std::move(callback_data)] {
Common::ScopeGuard on_end_scope([&]() {
Common::ScopeGuard on_end_scope([&] {
if (m_display_welcome_message && badge_type == RC_IMAGE_TYPE_GAME)
DisplayWelcomeMessage();
});
+3 -4
View File
@@ -506,14 +506,13 @@ static void EmuThread(Core::System& system, std::unique_ptr<BootParameters> boot
Config::Get(Config::MAIN_WII_SD_CARD_ENABLE_FOLDER_SYNC);
if (sync_sd_folder)
{
sync_sd_folder =
Common::SyncSDFolderToSDImage([]() { return false; }, Core::WantsDeterminism());
sync_sd_folder = Common::SyncSDFolderToSDImage([] { return false; }, Core::WantsDeterminism());
}
Common::ScopeGuard sd_folder_sync_guard{[sync_sd_folder] {
if (sync_sd_folder && Config::Get(Config::MAIN_ALLOW_SD_WRITES))
{
const bool sync_ok = Common::SyncSDImageToSDFolder([]() { return false; });
const bool sync_ok = Common::SyncSDImageToSDFolder([] { return false; });
if (!sync_ok)
{
PanicAlertFmtT(
@@ -829,7 +828,7 @@ void RunOnCPUThread(Core::System& system, Common::MoveOnlyFunction<void()> funct
{
// Trigger the event after executing the function.
s_cpu_thread_job_finished.Reset();
system.GetCPU().AddCPUThreadJob([&function]() {
system.GetCPU().AddCPUThreadJob([&function] {
function();
s_cpu_thread_job_finished.Set();
});
+1 -1
View File
@@ -209,7 +209,7 @@ std::unique_ptr<FifoDataFile> FifoDataFile::Load(const std::string& filename, bo
if (!file)
return nullptr;
auto panic_failed_to_read = []() {
auto panic_failed_to_read = [] {
CriticalAlertFmtT("Failed to read DFF file.");
return nullptr;
};
+1 -1
View File
@@ -296,7 +296,7 @@ void CEXIIPL::TransferByte(u8& data)
DEBUG_LOG_FMT(EXPANSIONINTERFACE, "IPL-DEV data {} {:08x} {:02x}",
m_command.is_write() ? "write" : "read", address, data);
auto UartFifoAccess = [&]() {
auto UartFifoAccess = [&] {
if (m_command.is_write())
{
if (data != '\0')
@@ -305,7 +305,7 @@ ErrorCode WriteToVFF(const std::string& path, const std::string& filename,
{
VffFatFsCallbacks callbacks;
ErrorCode return_value;
Common::RunInFatFsContext(callbacks, [&]() {
Common::RunInFatFsContext(callbacks, [&] {
auto temp = fs->OpenFile(PID_KD, PID_KD, path, FS::Mode::ReadWrite);
if (!temp)
{
@@ -360,7 +360,7 @@ ErrorCode ReadFromVFF(const std::string& path, const std::string& filename,
{
VffFatFsCallbacks callbacks;
ErrorCode return_value;
Common::RunInFatFsContext(callbacks, [&]() {
Common::RunInFatFsContext(callbacks, [&] {
auto temp = fs->OpenFile(PID_KD, PID_KD, path, FS::Mode::ReadWrite);
if (!temp)
{
@@ -411,7 +411,7 @@ ErrorCode DeleteFileFromVFF(const std::string& path, const std::string& filename
{
VffFatFsCallbacks callbacks;
ErrorCode return_value;
Common::RunInFatFsContext(callbacks, [&]() {
Common::RunInFatFsContext(callbacks, [&] {
auto temp = fs->OpenFile(PID_KD, PID_KD, path, FS::Mode::ReadWrite);
if (!temp)
{
+1 -1
View File
@@ -335,7 +335,7 @@ std::optional<IPCReply> OH0::DeviceIOCtlV(const u64 device_id, const IOCtlVReque
case USB::IOCTLV_USBV0_INTRMSG:
case USB::IOCTLV_USBV0_ISOMSG:
return HandleTransfer(device, request.request,
[&, this]() { return SubmitTransfer(*device, request); });
[&, this] { return SubmitTransfer(*device, request); });
case USB::IOCTLV_USBV0_UNKNOWN_32:
request.DumpUnknown(GetSystem(), GetDeviceName(), Common::Log::LogType::IOS_USB);
return IPCReply(IPC_SUCCESS);
+1 -1
View File
@@ -61,7 +61,7 @@ std::optional<IPCReply> USB_HIDv4::IOCtl(const IOCtlRequest& request)
if (!device->Attach())
return IPCReply(IPC_EINVAL);
return HandleTransfer(device, request.request,
[&, this]() { return SubmitTransfer(*device, request); });
[&, this] { return SubmitTransfer(*device, request); });
}
default:
request.DumpUnknown(GetSystem(), GetDeviceName(), Common::Log::LogType::IOS_USB);
+1 -1
View File
@@ -75,7 +75,7 @@ std::optional<IPCReply> USB_HIDv5::IOCtlV(const IOCtlVRequest& request)
else
host_device->AttachAndChangeInterface(device->interface_number);
return HandleTransfer(host_device, request.request,
[&, this]() { return SubmitTransfer(*device, *host_device, request); });
[&, this] { return SubmitTransfer(*device, *host_device, request); });
}
default:
request.DumpUnknown(GetSystem(), GetDeviceName(), Common::Log::LogType::IOS_USB);
+1 -1
View File
@@ -85,7 +85,7 @@ std::optional<IPCReply> USB_VEN::IOCtlV(const IOCtlVRequest& request)
else
host_device->AttachAndChangeInterface(device->interface_number);
return HandleTransfer(host_device, request.request,
[&, this]() { return SubmitTransfer(*host_device, request); });
[&, this] { return SubmitTransfer(*host_device, request); });
}
default:
return IPCReply(IPC_EINVAL);
+1 -1
View File
@@ -2596,7 +2596,7 @@ void NetPlayClient::ComputeGameDigest(const SyncIdentifier& sync_identifier)
if (m_game_digest_thread.joinable())
m_game_digest_thread.join();
m_game_digest_thread = std::thread([this, file]() {
m_game_digest_thread = std::thread([this, file] {
std::string sum = SHA1Sum(file, [&](int progress) {
sf::Packet packet;
packet << MessageID::GameDigestProgress;
@@ -119,7 +119,7 @@ std::size_t CachedInterpreter::Disassemble(const JitBlock& block, std::ostream&
#undef LOOKUP_KV
std::call_once(s_sorted_lookup_flag, []() {
std::call_once(s_sorted_lookup_flag, [] {
const auto end = std::ranges::sort(sorted_lookup, {}, &LookupKV::first);
ASSERT_MSG(DYNA_REC, std::ranges::adjacent_find(sorted_lookup, {}, &LookupKV::first) == end,
"Sorted lookup should not contain duplicate keys.");
+1 -1
View File
@@ -765,7 +765,7 @@ static void LoadFileStateData(const std::string& filename, Common::UniqueBuffer<
if (s_state_writes_in_queue != 0)
{
if (!s_state_write_queue_is_empty.wait_for(lk, std::chrono::seconds(3),
[]() { return s_state_writes_in_queue == 0; }))
[] { return s_state_writes_in_queue == 0; }))
{
Core::DisplayMessage(
"A previous state saving operation is still in progress, cancelling load.", 2000);
+2 -2
View File
@@ -85,7 +85,7 @@ static bool ImportWAD(IOS::HLE::Kernel& ios, const DiscIO::VolumeWAD& wad,
return false;
}
const bool contents_imported = [&]() {
const bool contents_imported = [&] {
const u64 title_id = tmd.GetTitleId();
for (const IOS::ES::Content& content : tmd.GetContents())
{
@@ -584,7 +584,7 @@ UpdateResult OnlineSystemUpdater::InstallTitleFromNUS(const std::string& prefix_
// Now download and install contents listed in the TMD.
const std::vector<IOS::ES::Content> stored_contents = es.GetStoredContentsFromTMD(tmd.first);
const UpdateResult import_result = [&]() {
const UpdateResult import_result = [&] {
for (const IOS::ES::Content& content : tmd.first.GetContents())
{
const bool is_already_installed =
+1 -1
View File
@@ -518,7 +518,7 @@ bool VolumeWii::HashGroup(const std::array<u8, BLOCK_DATA_SIZE> in[BLOCKS_PER_GR
if (read_function && success)
success = read_function(i);
hash_futures[i] = std::async(std::launch::async, [&in, &out, &hash_futures, success, i]() {
hash_futures[i] = std::async(std::launch::async, [&in, &out, &hash_futures, success, i] {
const size_t h1_base = Common::AlignDown(i, 8);
if (success)
+1 -1
View File
@@ -1569,7 +1569,7 @@ WIARVZFileReader<RVZ>::ProcessAndCompress(CompressThreadState* state, CompressPa
continue;
}
const auto pad_exception_lists = [&entry]() {
const auto pad_exception_lists = [&entry] {
while (entry.exception_lists.size() % 4 != 0)
entry.exception_lists.push_back(0);
};
@@ -33,7 +33,7 @@ void ConfigInteger::OnConfigChanged()
ConfigIntegerLabel::ConfigIntegerLabel(const QString& text, ConfigInteger* widget)
: QLabel(text), m_widget(QPointer<ConfigInteger>(widget))
{
connect(&Settings::Instance(), &Settings::ConfigChanged, this, [this]() {
connect(&Settings::Instance(), &Settings::ConfigChanged, this, [this] {
// Label shares font changes with ConfigInteger to mark game ini settings.
if (m_widget)
setFont(m_widget->font());
@@ -113,7 +113,7 @@ void ConfigSliderU32::OnConfigChanged()
ConfigSliderLabel::ConfigSliderLabel(const QString& text, ConfigSlider* slider)
: QLabel(text), m_slider(QPointer<ConfigSlider>(slider))
{
connect(&Settings::Instance(), &Settings::ConfigChanged, this, [this]() {
connect(&Settings::Instance(), &Settings::ConfigChanged, this, [this] {
// Label shares font changes with slider to mark game ini settings.
if (m_slider)
setFont(m_slider->font());
@@ -88,7 +88,7 @@ GameConfigWidget::GameConfigWidget(const UICommon::GameFile& game) : m_game(game
}
// Fails to change font if it's directly called at this time. Is there a better workaround?
QTimer::singleShot(100, this, [this]() {
QTimer::singleShot(100, this, [this] {
SetItalics();
Config::OnConfigChanged();
});
@@ -41,10 +41,10 @@ EnhancementsWidget::EnhancementsWidget(GraphicsWindow* parent)
// BackendChanged is called by parent on window creation.
connect(parent, &GraphicsWindow::BackendChanged, this, &EnhancementsWidget::OnBackendChanged);
connect(parent, &GraphicsWindow::UseFastTextureSamplingChanged, this, [this]() {
connect(parent, &GraphicsWindow::UseFastTextureSamplingChanged, this, [this] {
m_texture_filtering_combo->setEnabled(ReadSetting(Config::GFX_HACK_FAST_TEXTURE_SAMPLING));
});
connect(parent, &GraphicsWindow::UseGPUTextureDecodingChanged, this, [this]() {
connect(parent, &GraphicsWindow::UseGPUTextureDecodingChanged, this, [this] {
m_arbitrary_mipmap_detection->setEnabled(!ReadSetting(Config::GFX_ENABLE_GPU_TEXTURE_DECODING));
});
}

Some files were not shown because too many files have changed in this diff Show More