From 45a4a29ea39128b770433f04fc11421fd2b2423d Mon Sep 17 00:00:00 2001 From: rhysd Date: Tue, 17 Oct 2023 00:47:48 +0900 Subject: [PATCH] Remove some redundant clones Signed-off-by: rhysd --- src/platform_impl/linux/window.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/platform_impl/linux/window.rs b/src/platform_impl/linux/window.rs index 51ea4bc1d0..75232ff39f 100644 --- a/src/platform_impl/linux/window.rs +++ b/src/platform_impl/linux/window.rs @@ -189,8 +189,8 @@ impl Window { match preferred_theme { Theme::Dark => settings.set_gtk_application_prefer_dark_theme(true), Theme::Light => { - let theme_name = settings.gtk_theme_name().map(|t| t.as_str().to_owned()); - if let Some(theme) = theme_name { + if let Some(theme) = settings.gtk_theme_name() { + let theme = theme.as_str(); // Remove dark variant. if let Some(theme) = GTK_THEME_SUFFIX_LIST .iter() @@ -780,12 +780,10 @@ impl Window { return theme; } - if let Some(settings) = Settings::default() { - let theme_name = settings.gtk_theme_name().map(|s| s.as_str().to_owned()); - if let Some(theme) = theme_name { - if GTK_THEME_SUFFIX_LIST.iter().any(|t| theme.ends_with(t)) { - return Theme::Dark; - } + if let Some(theme) = Settings::default().and_then(|s| s.gtk_theme_name()) { + let theme = theme.as_str(); + if GTK_THEME_SUFFIX_LIST.iter().any(|t| theme.ends_with(t)) { + return Theme::Dark; } }