mirror of
https://github.com/Zedfrigg/ironbar.git
synced 2025-08-16 22:31:03 +02:00
refactor: avoid explicity cast with long type
Aparently Rust doesn't implicitly cast a `Result<Arc<T>>` to `Result<Arc<dyn T>>`, so the `Result` was being mapped with a explicity cast. But unwrapping the `Result` with a `?` and then wrapping it back into `Ok` make the implicit cast work. This avoid typing the entire type, which was breaking the code in multiple lines.
This commit is contained in:
parent
5a5b110c7a
commit
638f2a20d2
1 changed files with 3 additions and 9 deletions
|
@ -74,9 +74,7 @@ impl Compositor {
|
||||||
debug!("Getting keyboard_layout client for: {current}");
|
debug!("Getting keyboard_layout client for: {current}");
|
||||||
match current {
|
match current {
|
||||||
#[cfg(feature = "bindmode+sway")]
|
#[cfg(feature = "bindmode+sway")]
|
||||||
Self::Sway => clients
|
Self::Sway => Ok(clients.sway()?),
|
||||||
.sway()
|
|
||||||
.map(|client| client as Arc<dyn BindModeClient + Send + Sync>),
|
|
||||||
#[cfg(feature = "bindmode+hyprland")]
|
#[cfg(feature = "bindmode+hyprland")]
|
||||||
Self::Hyprland => Ok(clients.hyprland()),
|
Self::Hyprland => Ok(clients.hyprland()),
|
||||||
#[cfg(feature = "niri")]
|
#[cfg(feature = "niri")]
|
||||||
|
@ -98,9 +96,7 @@ impl Compositor {
|
||||||
debug!("Getting keyboard_layout client for: {current}");
|
debug!("Getting keyboard_layout client for: {current}");
|
||||||
match current {
|
match current {
|
||||||
#[cfg(feature = "keyboard+sway")]
|
#[cfg(feature = "keyboard+sway")]
|
||||||
Self::Sway => clients
|
Self::Sway => Ok(clients.sway()?),
|
||||||
.sway()
|
|
||||||
.map(|client| client as Arc<dyn KeyboardLayoutClient + Send + Sync>),
|
|
||||||
#[cfg(feature = "keyboard+hyprland")]
|
#[cfg(feature = "keyboard+hyprland")]
|
||||||
Self::Hyprland => Ok(clients.hyprland()),
|
Self::Hyprland => Ok(clients.hyprland()),
|
||||||
#[cfg(feature = "niri")]
|
#[cfg(feature = "niri")]
|
||||||
|
@ -126,9 +122,7 @@ impl Compositor {
|
||||||
debug!("Getting workspace client for: {current}");
|
debug!("Getting workspace client for: {current}");
|
||||||
match current {
|
match current {
|
||||||
#[cfg(feature = "workspaces+sway")]
|
#[cfg(feature = "workspaces+sway")]
|
||||||
Self::Sway => clients
|
Self::Sway => Ok(clients.sway()?),
|
||||||
.sway()
|
|
||||||
.map(|client| client as Arc<dyn WorkspaceClient + Send + Sync>),
|
|
||||||
#[cfg(feature = "workspaces+hyprland")]
|
#[cfg(feature = "workspaces+hyprland")]
|
||||||
Self::Hyprland => Ok(clients.hyprland()),
|
Self::Hyprland => Ok(clients.hyprland()),
|
||||||
#[cfg(feature = "workspaces+niri")]
|
#[cfg(feature = "workspaces+niri")]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue