Skip to content

Commit

Permalink
style: linting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lars-berger committed Aug 2, 2024
1 parent 50a6560 commit 03c3afb
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 46 deletions.
2 changes: 1 addition & 1 deletion packages/wm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ tauri-winres = { workspace = true }
[dependencies]
anyhow = { workspace = true }
clap = { version = "4", features = ["derive"] }
ambassador = "0.4.1"
ambassador = "0.4"
enum-as-inner = "0.6"
futures-util = "0.3"
home = "0.5"
Expand Down
72 changes: 38 additions & 34 deletions packages/wm/src/containers/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use crate::{
};

/// A container of any type.
#[derive(Clone, Debug, EnumAsInner, Delegate)] // <-------
#[derive(Clone, Debug, EnumAsInner, Delegate)]
#[delegate(CommonGetters)]
#[delegate(PositionGetters)]
pub enum Container {
Expand All @@ -35,21 +35,42 @@ pub enum Container {
NonTilingWindow(NonTilingWindow),
}

impl From<SplitContainer> for Container{
fn from(value: SplitContainer) -> Self {
Container::Split(value)
impl From<RootContainer> for Container {
fn from(value: RootContainer) -> Self {
Container::Root(value)
}
}

impl From<Monitor> for Container {
fn from(value: Monitor) -> Self {
Container::Monitor(value)
}
}

impl From<Workspace> for Container {
fn from(value: Workspace) -> Self {
Container::Workspace(value)
}
}
impl From<RootContainer> for Container{
fn from(value: RootContainer) -> Self {
Container::Root(value)

impl From<SplitContainer> for Container {
fn from(value: SplitContainer) -> Self {
Container::Split(value)
}
}

impl From<NonTilingWindow> for Container {
fn from(value: NonTilingWindow) -> Self {
Container::NonTilingWindow(value)
}
}

impl From<TilingWindow> for Container {
fn from(value: TilingWindow) -> Self {
Container::TilingWindow(value)
}
}

impl From<TilingContainer> for Container {
fn from(tiling_container: TilingContainer) -> Self {
match tiling_container {
Expand Down Expand Up @@ -98,13 +119,13 @@ pub enum TilingContainer {
TilingWindow(TilingWindow),
}

impl From<SplitContainer> for TilingContainer{
impl From<SplitContainer> for TilingContainer {
fn from(value: SplitContainer) -> Self {
TilingContainer::Split(value)
}
}

impl From<TilingWindow> for TilingContainer{
impl From<TilingWindow> for TilingContainer {
fn from(value: TilingWindow) -> Self {
TilingContainer::TilingWindow(value)
}
Expand Down Expand Up @@ -143,34 +164,17 @@ pub enum WindowContainer {
NonTilingWindow(NonTilingWindow),
}

impl From<TilingWindow> for WindowContainer{
impl From<TilingWindow> for WindowContainer {
fn from(value: TilingWindow) -> Self {
WindowContainer::TilingWindow(value)
}
}

impl From<NonTilingWindow> for WindowContainer{
impl From<NonTilingWindow> for WindowContainer {
fn from(value: NonTilingWindow) -> Self {
WindowContainer::NonTilingWindow(value)
}
}
impl From<NonTilingWindow> for Container {
fn from(value: NonTilingWindow) -> Self {
Container::NonTilingWindow(value)
}
}

impl From<Monitor> for Container {
fn from(value: Monitor) -> Self {
Container::Monitor(value)
}
}

impl From<TilingWindow> for Container{
fn from(value: TilingWindow) -> Self {
Container::TilingWindow(value)
}
}

impl TryFrom<Container> for WindowContainer {
type Error = &'static str;
Expand Down Expand Up @@ -220,18 +224,18 @@ pub enum DirectionContainer {
Split(SplitContainer),
}

impl From<SplitContainer> for DirectionContainer{
fn from(value: SplitContainer) -> Self {
DirectionContainer::Split(value)
}
}

impl From<Workspace> for DirectionContainer {
fn from(value: Workspace) -> Self {
DirectionContainer::Workspace(value)
}
}

impl From<SplitContainer> for DirectionContainer {
fn from(value: SplitContainer) -> Self {
DirectionContainer::Split(value)
}
}

impl TryFrom<Container> for DirectionContainer {
type Error = &'static str;

Expand Down
6 changes: 3 additions & 3 deletions packages/wm/src/containers/traits/common_getters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ use std::{
cell::{Ref, RefMut},
collections::VecDeque,
};

use ambassador::delegatable_trait;
use uuid::Uuid;

use crate::{
containers::{
Container, ContainerDto, DirectionContainer, RootContainer,
SplitContainer, TilingContainer, WindowContainer,
Container, ContainerDto, DirectionContainer, TilingContainer,
WindowContainer,
},
monitors::Monitor,
windows::{NonTilingWindow, TilingWindow},
workspaces::Workspace,
};

Expand Down
7 changes: 1 addition & 6 deletions packages/wm/src/containers/traits/position_getters.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
use ambassador::delegatable_trait;

use crate::{
common::Rect,
containers::{
Container, DirectionContainer, TilingContainer, WindowContainer,
},
};
use crate::common::Rect;

#[delegatable_trait]
pub trait PositionGetters {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use ambassador::delegatable_trait;

use super::CommonGetters;
use crate::{
common::{Direction, TilingDirection},
containers::{DirectionContainer, TilingContainer},
containers::TilingContainer,
windows::TilingWindow,
};

Expand Down
3 changes: 2 additions & 1 deletion packages/wm/src/windows/traits/window_getters.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use std::cell::Ref;

use ambassador::delegatable_trait;

use crate::{
common::{
platform::NativeWindow, DisplayState, LengthValue, Rect, RectDelta,
},
containers::WindowContainer,
user_config::{UserConfig, WindowRuleConfig},
windows::{active_drag::ActiveDrag, WindowState},
};
Expand Down

0 comments on commit 03c3afb

Please sign in to comment.