chore: apply recommendations from clippy
This commit is contained in:
parent
cec55dafd7
commit
8e0f1c4a09
56 changed files with 720 additions and 824 deletions
|
|
@ -99,7 +99,7 @@ impl cosmic::Application for Power {
|
|||
core,
|
||||
icon_name: "system-shutdown-symbolic".to_string(),
|
||||
subsurface_id: window::Id::unique(),
|
||||
popup: Default::default(),
|
||||
popup: Option::default(),
|
||||
},
|
||||
Task::none(),
|
||||
)
|
||||
|
|
@ -158,12 +158,12 @@ impl cosmic::Application for Power {
|
|||
}
|
||||
}
|
||||
a => return a.perform(),
|
||||
};
|
||||
}
|
||||
Task::none()
|
||||
}
|
||||
Message::Zbus(result) => {
|
||||
if let Err(e) = result {
|
||||
eprintln!("cosmic-applet-power ERROR: '{}'", e);
|
||||
eprintln!("cosmic-applet-power ERROR: '{e}'");
|
||||
}
|
||||
Task::none()
|
||||
}
|
||||
|
|
@ -181,7 +181,7 @@ impl cosmic::Application for Power {
|
|||
}
|
||||
}
|
||||
|
||||
fn view(&self) -> Element<Message> {
|
||||
fn view(&self) -> Element<'_, Message> {
|
||||
self.core
|
||||
.applet
|
||||
.icon_button(&self.icon_name)
|
||||
|
|
@ -189,7 +189,7 @@ impl cosmic::Application for Power {
|
|||
.into()
|
||||
}
|
||||
|
||||
fn view_window(&self, id: window::Id) -> Element<Message> {
|
||||
fn view_window(&self, id: window::Id) -> Element<'_, Message> {
|
||||
let Spacing {
|
||||
space_xxs,
|
||||
space_s,
|
||||
|
|
@ -264,7 +264,7 @@ impl cosmic::Application for Power {
|
|||
}
|
||||
}
|
||||
|
||||
fn power_buttons(name: &str, on_press: Message) -> button::Button<Message> {
|
||||
fn power_buttons(name: &str, on_press: Message) -> button::Button<'_, Message> {
|
||||
button::custom(
|
||||
widget::container(text_icon(name, 40))
|
||||
.width(Length::Fill)
|
||||
|
|
@ -340,16 +340,13 @@ async fn lock() -> zbus::Result<()> {
|
|||
async fn log_out() -> zbus::Result<()> {
|
||||
let session_type = std::env::var("XDG_CURRENT_DESKTOP").ok();
|
||||
let connection = Connection::session().await?;
|
||||
match session_type.as_ref().map(|s| s.trim()) {
|
||||
Some("pop:GNOME") => {
|
||||
let manager_proxy = SessionManagerProxy::new(&connection).await?;
|
||||
manager_proxy.logout(0).await?;
|
||||
}
|
||||
if let Some("pop:GNOME") = session_type.as_ref().map(|s| s.trim()) {
|
||||
let manager_proxy = SessionManagerProxy::new(&connection).await?;
|
||||
manager_proxy.logout(0).await?;
|
||||
} else {
|
||||
// By default assume COSMIC
|
||||
_ => {
|
||||
let cosmic_session = CosmicSessionProxy::new(&connection).await?;
|
||||
cosmic_session.exit().await?;
|
||||
}
|
||||
let cosmic_session = CosmicSessionProxy::new(&connection).await?;
|
||||
cosmic_session.exit().await?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,6 +43,6 @@ pub fn localize() {
|
|||
let requested_languages = i18n_embed::DesktopLanguageRequester::requested_languages();
|
||||
|
||||
if let Err(error) = localizer.select(&requested_languages) {
|
||||
eprintln!("Error while loading language for App List {}", error);
|
||||
eprintln!("Error while loading language for App List {error}");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue