mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
refactor: prefer std::ranges over begin() and end() (#43464)
This commit is contained in:
@@ -409,15 +409,15 @@ void ClientFrameViewLinux::LayoutButtonsOnSide(
|
||||
frame_buttons = trailing_frame_buttons_;
|
||||
// We always lay buttons out going from the edge towards the center, but
|
||||
// they are given to us as left-to-right, so reverse them.
|
||||
std::reverse(frame_buttons.begin(), frame_buttons.end());
|
||||
std::ranges::reverse(frame_buttons);
|
||||
break;
|
||||
default:
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
for (views::FrameButton frame_button : frame_buttons) {
|
||||
auto* button = std::find_if(
|
||||
nav_buttons_.begin(), nav_buttons_.end(), [&](const NavButton& test) {
|
||||
auto* button =
|
||||
std::ranges::find_if(nav_buttons_, [&](const NavButton& test) {
|
||||
return test.type != skip_type && test.frame_button == frame_button;
|
||||
});
|
||||
CHECK(button != nav_buttons_.end())
|
||||
|
||||
@@ -211,8 +211,7 @@ NotifyIcon* NotifyIconHost::CreateNotifyIcon(std::optional<UUID> guid) {
|
||||
}
|
||||
|
||||
void NotifyIconHost::Remove(NotifyIcon* icon) {
|
||||
NotifyIcons::iterator i(
|
||||
std::find(notify_icons_.begin(), notify_icons_.end(), icon));
|
||||
const auto i = std::ranges::find(notify_icons_, icon);
|
||||
|
||||
if (i == notify_icons_.end()) {
|
||||
NOTREACHED();
|
||||
@@ -241,11 +240,7 @@ LRESULT CALLBACK NotifyIconHost::WndProc(HWND hwnd,
|
||||
LPARAM lparam) {
|
||||
if (message == taskbar_created_message_) {
|
||||
// We need to reset all of our icons because the taskbar went away.
|
||||
for (NotifyIcons::const_iterator i(notify_icons_.begin());
|
||||
i != notify_icons_.end(); ++i) {
|
||||
auto* win_icon = static_cast<NotifyIcon*>(*i);
|
||||
win_icon->ResetIcon();
|
||||
}
|
||||
std::ranges::for_each(notify_icons_, [](auto* icon) { icon->ResetIcon(); });
|
||||
return TRUE;
|
||||
} else if (message == kNotifyIconMessage) {
|
||||
NotifyIcon* win_icon = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user