Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
Redhawk18 committed Sep 9, 2023
1 parent ee1a896 commit 061c453
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions src/native/tab_bar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ where
self
}

#[must_use]
/// Sets the [`Position`] of the Icon next to Text, Only used in [`TabLabel::IconText`]
pub fn set_position(mut self, position: Position) -> Self {
self.position = position;
Expand Down Expand Up @@ -396,7 +397,11 @@ where
Position::Top => {
column = column
.push(layout_icon(icon, self.icon_size, self.icon_font))
.push(layout_text(text, self.icon_size, self.icon_font))
.push(layout_text(
text,
self.icon_size,
self.icon_font,
));
}
Position::Right => {
column = column.push(
Expand All @@ -412,7 +417,7 @@ where
self.icon_size,
self.icon_font,
)),
)
);
}
Position::Left => {
column = column.push(
Expand All @@ -428,12 +433,16 @@ where
self.icon_size,
self.icon_font,
)),
)
);
}
Position::Bottom => {
column = column
.push(layout_text(text, self.icon_size, self.icon_font))
.push(layout_icon(icon, self.icon_size, self.icon_font))
.push(layout_icon(
icon,
self.icon_size,
self.icon_font,
));
}
}

Expand Down Expand Up @@ -621,7 +630,7 @@ fn draw_tab<Renderer>(
}

fn text_bound_rectangle(item: Option<Layout<'_>>) -> Rectangle {
item.expect("Graphics: Layout should have an icons layout for an IconText")
item.expect("Graphics: Layout should have an texts layout for an IconText")
.bounds()
}
let is_mouse_over = layout
Expand Down Expand Up @@ -699,12 +708,18 @@ fn draw_tab<Renderer>(
text_bounds = text_bound_rectangle(label_layout_children.next());
}
Position::Right => {
let mut row_childern = label_layout_children.next().unwrap().children();
let mut row_childern = label_layout_children
.next()
.expect("Graphics: Right Layout should have have a row with one child")
.children();
text_bounds = text_bound_rectangle(row_childern.next());
icon_bounds = icon_bound_rectangle(row_childern.next());
}
Position::Left => {
let mut row_childern = label_layout_children.next().unwrap().children();
let mut row_childern = label_layout_children
.next()
.expect("Graphics: Left Layout should have have a row with one child")
.children();
icon_bounds = icon_bound_rectangle(row_childern.next());
text_bounds = text_bound_rectangle(row_childern.next());
}
Expand Down

0 comments on commit 061c453

Please sign in to comment.