remove needless borrows

This commit is contained in:
daniel.eades 2023-11-16 17:27:47 +00:00 committed by Ashley Wulber
parent 94f9879a39
commit 41b88532c9
5 changed files with 9 additions and 9 deletions

View file

@ -47,19 +47,19 @@ impl AppListConfig {
pub fn add_favorite(&mut self, id: String, config: &Config) {
if !self.favorites.contains(&id) {
self.favorites.push(id);
let _ = self.write_entry(&config);
let _ = self.write_entry(config);
}
}
pub fn remove_favorite(&mut self, id: String, config: &Config) {
if let Some(pos) = self.favorites.iter().position(|e| e == &id) {
self.favorites.remove(pos);
let _ = self.write_entry(&config);
let _ = self.write_entry(config);
}
}
pub fn update_favorites(&mut self, favorites: Vec<String>, config: &Config) {
self.favorites = favorites;
let _ = self.write_entry(&config);
let _ = self.write_entry(config);
}
}

View file

@ -531,7 +531,7 @@ pub struct NetworkManagerState {
impl NetworkManagerState {
pub async fn new(conn: &Connection) -> anyhow::Result<Self> {
let network_manager = NetworkManager::new(&conn).await?;
let network_manager = NetworkManager::new(conn).await?;
let mut _self = Self::default();
// airplane mode
let airplaine_mode = Command::new("rfkill")
@ -543,7 +543,7 @@ impl NetworkManagerState {
_self.wifi_enabled = network_manager.wireless_enabled().await.unwrap_or_default();
_self.airplane_mode = airplane_mode.contains("Soft blocked: yes") && !_self.wifi_enabled;
let s = NetworkManagerSettings::new(&conn).await?;
let s = NetworkManagerSettings::new(conn).await?;
_ = s.load_connections(&[]).await;
let known_conns = s.list_connections().await.unwrap_or_default();
let mut active_conns = active_connections(

View file

@ -18,7 +18,7 @@ impl StatusNotifierItem {
(name.as_str(), "/StatusNotifierItem")
};
let item_proxy = StatusNotifierItemProxy::builder(&connection)
let item_proxy = StatusNotifierItemProxy::builder(connection)
.destination(dest.to_string())?
.path(path.to_string())?
.build()
@ -27,7 +27,7 @@ impl StatusNotifierItem {
let icon_name = item_proxy.icon_name().await?;
let menu_path = item_proxy.menu().await?;
let menu_proxy = DBusMenuProxy::builder(&connection)
let menu_proxy = DBusMenuProxy::builder(connection)
.destination(dest.to_string())?
.path(menu_path)?
.build()

View file

@ -26,7 +26,7 @@ trait StatusNotifierWatcher {
}
pub async fn watch(connection: &zbus::Connection) -> zbus::Result<EventStream> {
let watcher = StatusNotifierWatcherProxy::new(&connection).await?;
let watcher = StatusNotifierWatcherProxy::new(connection).await?;
let name = connection.unique_name().unwrap().as_str();
if let Err(err) = watcher.register_status_notifier_host(name).await {

View file

@ -86,7 +86,7 @@ pub async fn create_service(connection: &zbus::Connection) -> zbus::Result<()> {
.interface::<_, StatusNotifierWatcher>(OBJECT_PATH)
.await
.unwrap();
let dbus_proxy = DBusProxy::new(&connection).await?;
let dbus_proxy = DBusProxy::new(connection).await?;
let mut name_owner_changed_stream = dbus_proxy.receive_name_owner_changed().await?;
let flags = RequestNameFlags::AllowReplacement.into();