Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: correct cargo clippies, formatting #24

Merged
merged 1 commit into from
Feb 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[workspace]
members = ["leftwm-layouts", "demo", "demo-ascii"]
default-members = ["leftwm-layouts"]
default-members = ["leftwm-layouts"]
resolver = "2"
8 changes: 4 additions & 4 deletions leftwm-layouts/src/geometry/direction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub enum Direction {
// Find the north neighbor starting from a given `Rect` with index `current` in an array of
// [`Rect`].
fn find_north(rects: &[Rect], current: usize) -> Option<usize> {
let Some(current_rect) = rects.get(current).or(None) else { return None };
let current_rect = rects.get(current).or(None)?;

// We are all the way up, no neighbor available
if current_rect.top_edge() <= 0 {
Expand Down Expand Up @@ -102,7 +102,7 @@ fn find_north(rects: &[Rect], current: usize) -> Option<usize> {
// Find the east neighbor starting from a given `Rect` with index `current` in an array of
// [`Rect`].
fn find_east(rects: &[Rect], current: usize, display_width: u32) -> Option<usize> {
let Some(current_rect) = rects.get(current).or(None) else { return None };
let current_rect = rects.get(current).or(None)?;

// We are all the way right, no neighbor available
if current_rect.right_edge() >= display_width as i32 {
Expand Down Expand Up @@ -143,7 +143,7 @@ fn find_east(rects: &[Rect], current: usize, display_width: u32) -> Option<usize
// Find the south neighbor starting from a given `Rect` with index `current` in an array of
// [`Rect`].
fn find_south(rects: &[Rect], current: usize, display_height: u32) -> Option<usize> {
let Some(current_rect) = rects.get(current).or(None) else { return None };
let current_rect = rects.get(current).or(None)?;

// We are at the bottom, no neighbor available
if current_rect.y + current_rect.h as i32 >= display_height as i32 {
Expand Down Expand Up @@ -185,7 +185,7 @@ fn find_south(rects: &[Rect], current: usize, display_height: u32) -> Option<usi
// Find the west neighbor starting from a given `Rect` with index `current` in an array of
// [`Rect`].
fn find_west(rects: &[Rect], current: usize) -> Option<usize> {
let Some(current_rect) = rects.get(current).or(None) else { return None };
let current_rect = rects.get(current).or(None)?;

// We are all the way left; no neighbor available
if current_rect.left_edge() <= 0 {
Expand Down
2 changes: 1 addition & 1 deletion leftwm-layouts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ fn stack_main_stack(

// copy rotated/flipped columns into the variables
let non_empty = |rect: &&Rect| rect.surface_area() > 0;
left_column = columns.get(0).filter(non_empty).copied();
left_column = columns.first().filter(non_empty).copied();
main_column = columns.get(1).filter(non_empty).copied();
right_column = columns.get(2).filter(non_empty).copied();

Expand Down
Loading