Auto-fix clippy::collapsible_if violations (#36428)
Release Notes: - N/A
This commit is contained in:
parent
9e8ec72bd5
commit
8f567383e4
281 changed files with 6628 additions and 7089 deletions
|
@ -1026,18 +1026,18 @@ async fn restore_or_create_workspace(app_state: Arc<AppState>, cx: &mut AsyncApp
|
|||
// Try to find an active workspace to show the toast
|
||||
let toast_shown = cx
|
||||
.update(|cx| {
|
||||
if let Some(window) = cx.active_window() {
|
||||
if let Some(workspace) = window.downcast::<Workspace>() {
|
||||
workspace
|
||||
.update(cx, |workspace, _, cx| {
|
||||
workspace.show_toast(
|
||||
Toast::new(NotificationId::unique::<()>(), message),
|
||||
cx,
|
||||
)
|
||||
})
|
||||
.ok();
|
||||
return true;
|
||||
}
|
||||
if let Some(window) = cx.active_window()
|
||||
&& let Some(workspace) = window.downcast::<Workspace>()
|
||||
{
|
||||
workspace
|
||||
.update(cx, |workspace, _, cx| {
|
||||
workspace.show_toast(
|
||||
Toast::new(NotificationId::unique::<()>(), message),
|
||||
cx,
|
||||
)
|
||||
})
|
||||
.ok();
|
||||
return true;
|
||||
}
|
||||
false
|
||||
})
|
||||
|
@ -1117,10 +1117,8 @@ pub(crate) async fn restorable_workspace_locations(
|
|||
|
||||
// Since last_session_window_order returns the windows ordered front-to-back
|
||||
// we need to open the window that was frontmost last.
|
||||
if ordered {
|
||||
if let Some(locations) = locations.as_mut() {
|
||||
locations.reverse();
|
||||
}
|
||||
if ordered && let Some(locations) = locations.as_mut() {
|
||||
locations.reverse();
|
||||
}
|
||||
|
||||
locations
|
||||
|
@ -1290,21 +1288,21 @@ fn eager_load_active_theme_and_icon_theme(fs: Arc<dyn Fs>, cx: &App) {
|
|||
|
||||
if let Some(theme_selection) = theme_settings.theme_selection.as_ref() {
|
||||
let theme_name = theme_selection.theme(appearance);
|
||||
if matches!(theme_registry.get(theme_name), Err(ThemeNotFoundError(_))) {
|
||||
if let Some(theme_path) = extension_store.read(cx).path_to_extension_theme(theme_name) {
|
||||
cx.spawn({
|
||||
let theme_registry = theme_registry.clone();
|
||||
let fs = fs.clone();
|
||||
async move |cx| {
|
||||
theme_registry.load_user_theme(&theme_path, fs).await?;
|
||||
if matches!(theme_registry.get(theme_name), Err(ThemeNotFoundError(_)))
|
||||
&& let Some(theme_path) = extension_store.read(cx).path_to_extension_theme(theme_name)
|
||||
{
|
||||
cx.spawn({
|
||||
let theme_registry = theme_registry.clone();
|
||||
let fs = fs.clone();
|
||||
async move |cx| {
|
||||
theme_registry.load_user_theme(&theme_path, fs).await?;
|
||||
|
||||
cx.update(|cx| {
|
||||
ThemeSettings::reload_current_theme(cx);
|
||||
})
|
||||
}
|
||||
})
|
||||
.detach_and_log_err(cx);
|
||||
}
|
||||
cx.update(|cx| {
|
||||
ThemeSettings::reload_current_theme(cx);
|
||||
})
|
||||
}
|
||||
})
|
||||
.detach_and_log_err(cx);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1313,26 +1311,24 @@ fn eager_load_active_theme_and_icon_theme(fs: Arc<dyn Fs>, cx: &App) {
|
|||
if matches!(
|
||||
theme_registry.get_icon_theme(icon_theme_name),
|
||||
Err(IconThemeNotFoundError(_))
|
||||
) {
|
||||
if let Some((icon_theme_path, icons_root_path)) = extension_store
|
||||
.read(cx)
|
||||
.path_to_extension_icon_theme(icon_theme_name)
|
||||
{
|
||||
cx.spawn({
|
||||
let theme_registry = theme_registry.clone();
|
||||
let fs = fs.clone();
|
||||
async move |cx| {
|
||||
theme_registry
|
||||
.load_icon_theme(&icon_theme_path, &icons_root_path, fs)
|
||||
.await?;
|
||||
) && let Some((icon_theme_path, icons_root_path)) = extension_store
|
||||
.read(cx)
|
||||
.path_to_extension_icon_theme(icon_theme_name)
|
||||
{
|
||||
cx.spawn({
|
||||
let theme_registry = theme_registry.clone();
|
||||
let fs = fs.clone();
|
||||
async move |cx| {
|
||||
theme_registry
|
||||
.load_icon_theme(&icon_theme_path, &icons_root_path, fs)
|
||||
.await?;
|
||||
|
||||
cx.update(|cx| {
|
||||
ThemeSettings::reload_current_icon_theme(cx);
|
||||
})
|
||||
}
|
||||
})
|
||||
.detach_and_log_err(cx);
|
||||
}
|
||||
cx.update(|cx| {
|
||||
ThemeSettings::reload_current_icon_theme(cx);
|
||||
})
|
||||
}
|
||||
})
|
||||
.detach_and_log_err(cx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1381,18 +1377,15 @@ fn watch_themes(fs: Arc<dyn fs::Fs>, cx: &mut App) {
|
|||
|
||||
while let Some(paths) = events.next().await {
|
||||
for event in paths {
|
||||
if fs.metadata(&event.path).await.ok().flatten().is_some() {
|
||||
if let Some(theme_registry) =
|
||||
if fs.metadata(&event.path).await.ok().flatten().is_some()
|
||||
&& let Some(theme_registry) =
|
||||
cx.update(|cx| ThemeRegistry::global(cx).clone()).log_err()
|
||||
{
|
||||
if let Some(()) = theme_registry
|
||||
.load_user_theme(&event.path, fs.clone())
|
||||
.await
|
||||
.log_err()
|
||||
{
|
||||
cx.update(ThemeSettings::reload_current_theme).log_err();
|
||||
}
|
||||
}
|
||||
&& let Some(()) = theme_registry
|
||||
.load_user_theme(&event.path, fs.clone())
|
||||
.await
|
||||
.log_err()
|
||||
{
|
||||
cx.update(ThemeSettings::reload_current_theme).log_err();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue