Skip to content

Commit 81c3a74

Browse files
committed
Fix minor warnings
1 parent 6ee54d8 commit 81c3a74

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

src/widglets/list.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// use crate::message::Message;
22
use iced::widget;
33

4-
use crate::message::Message;
5-
64
use super::PADDING;
75
use super::{HeadingLevel, heading};
86

src/widglets/mod.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,33 +58,37 @@ pub enum HeadingLevel {
5858
H3,
5959
Subheading,
6060
}
61+
6162
/// Does appropriate sizing, weighting and colouring for a given heading level
6263
pub fn heading<'a>(
6364
level: HeadingLevel,
6465
text: String,
6566
font: Option<iced::Font>,
6667
) -> widget::Text<'a> {
68+
use HeadingLevel as HL;
69+
6770
let mut font = font.unwrap_or(iced::Font::DEFAULT);
6871

6972
let font_mult = match level {
70-
HeadingLevel::H1 => 2.0,
71-
HeadingLevel::H2 => 1.5,
72-
HeadingLevel::H3 => 1.0,
73-
HeadingLevel::Subheading => 0.7,
73+
HL::H1 => 2.0,
74+
HL::H2 => 1.5,
75+
HL::H3 => 1.0,
76+
HL::Subheading => 0.7,
7477
};
7578

7679
font.weight = match level {
77-
HeadingLevel::H1 | HeadingLevel::H2 => iced::font::Weight::Bold,
80+
HL::H1 | HL::H2 => iced::font::Weight::Bold,
7881
_ => iced::font::Weight::Normal,
7982
};
8083

8184
widget::text(text)
8285
.size(iced::Settings::default().default_text_size * font_mult)
8386
.style(move |_theme: &iced::Theme| {
8487
let c = match level {
85-
HeadingLevel::Subheading => Some(iced::color!(140, 140, 150)),
88+
HL::Subheading => Some(iced::color!(140, 140, 150)),
8689
_ => None,
8790
};
8891
widget::text::Style { color: c }
8992
})
93+
.font(font)
9094
}

0 commit comments

Comments
 (0)