Commit d5c330ac72

d5c330ac7200f23ec0cac700e7d8a8ca120acfc6

parent: 7b1dc93f3a

Unregistered key

vaw <git@nlih.de> · 2025-09-13 20:32 UTC
committer: <noreply@github.com>

Fix most clippy warnigs (#501)

Layout: unified · split

src/config.rs +1 −1
@@ -1003,7 +1003,7 @@ impl ApplicationSettings {
10031003 Ok(())
10041004 }
10051005
1006 pub fn get_user_char_span(&self, user_id: &UserId) -> Span {
1006 pub fn get_user_char_span(&self, user_id: &UserId) -> Span<'_> {
10071007 let (color, c) = self
10081008 .tunables
10091009 .users
src/message/mod.rs +2 −2
@@ -233,13 +233,13 @@ impl MessageTimeStamp {
233233 dt1.date_naive() == dt2.date_naive()
234234 }
235235
236 fn show_date(&self) -> Option<Span> {
236 fn show_date(&self) -> Option<Span<'_>> {
237237 let time = self.as_datetime().format("%A, %B %d %Y").to_string();
238238
239239 Span::styled(time, BOLD_STYLE).into()
240240 }
241241
242 fn show_time(&self) -> Option<Span> {
242 fn show_time(&self) -> Option<Span<'_>> {
243243 match self {
244244 MessageTimeStamp::OriginServer(ms) => {
245245 let time = millis_to_datetime(*ms).format("%T");
src/windows/mod.rs +37 −12
@@ -97,12 +97,12 @@ fn bold_style() -> Style {
9797}
9898
9999#[inline]
100fn bold_span(s: &str) -> Span {
100fn bold_span(s: &str) -> Span<'_> {
101101 Span::styled(s, bold_style())
102102}
103103
104104#[inline]
105fn bold_spans(s: &str) -> Line {
105fn bold_spans(s: &str) -> Line<'_> {
106106 bold_span(s).into()
107107}
108108
@@ -116,12 +116,12 @@ fn selected_style(selected: bool) -> Style {
116116}
117117
118118#[inline]
119fn selected_span(s: &str, selected: bool) -> Span {
119fn selected_span(s: &str, selected: bool) -> Span<'_> {
120120 Span::styled(s, selected_style(selected))
121121}
122122
123123#[inline]
124fn selected_text(s: &str, selected: bool) -> Text {
124fn selected_text(s: &str, selected: bool) -> Text<'_> {
125125 Text::from(selected_span(s, selected))
126126}
127127
@@ -743,7 +743,7 @@ impl Window<IambInfo> for IambWindow {
743743 }
744744 }
745745
746 fn get_tab_title(&self, store: &mut ProgramStore) -> Line {
746 fn get_tab_title(&self, store: &mut ProgramStore) -> Line<'_> {
747747 match self {
748748 IambWindow::DirectList(_) => bold_spans("Direct Messages"),
749749 IambWindow::RoomList(_) => bold_spans("Rooms"),
@@ -771,7 +771,7 @@ impl Window<IambInfo> for IambWindow {
771771 }
772772 }
773773
774 fn get_win_title(&self, store: &mut ProgramStore) -> Line {
774 fn get_win_title(&self, store: &mut ProgramStore) -> Line<'_> {
775775 match self {
776776 IambWindow::DirectList(_) => bold_spans("Direct Messages"),
777777 IambWindow::RoomList(_) => bold_spans("Rooms"),
@@ -959,7 +959,12 @@ impl Display for GenericChatItem {
959959}
960960
961961impl ListItem<IambInfo> for GenericChatItem {
962 fn show(&self, selected: bool, _: &ViewportContext<ListCursor>, _: &mut ProgramStore) -> Text {
962 fn show(
963 &self,
964 selected: bool,
965 _: &ViewportContext<ListCursor>,
966 _: &mut ProgramStore,
967 ) -> Text<'_> {
963968 let unread = self.unread.is_unread();
964969 let style = selected_style(selected);
965970 let (name, mut labels) = name_and_labels(&self.name, unread, style);
@@ -1073,7 +1078,12 @@ impl Display for RoomItem {
10731078}
10741079
10751080impl ListItem<IambInfo> for RoomItem {
1076 fn show(&self, selected: bool, _: &ViewportContext<ListCursor>, _: &mut ProgramStore) -> Text {
1081 fn show(
1082 &self,
1083 selected: bool,
1084 _: &ViewportContext<ListCursor>,
1085 _: &mut ProgramStore,
1086 ) -> Text<'_> {
10771087 let unread = self.unread.is_unread();
10781088 let style = selected_style(selected);
10791089 let (name, mut labels) = name_and_labels(&self.name, unread, style);
@@ -1177,7 +1187,12 @@ impl Display for DirectItem {
11771187}
11781188
11791189impl ListItem<IambInfo> for DirectItem {
1180 fn show(&self, selected: bool, _: &ViewportContext<ListCursor>, _: &mut ProgramStore) -> Text {
1190 fn show(
1191 &self,
1192 selected: bool,
1193 _: &ViewportContext<ListCursor>,
1194 _: &mut ProgramStore,
1195 ) -> Text<'_> {
11811196 let unread = self.unread.is_unread();
11821197 let style = selected_style(selected);
11831198 let (name, mut labels) = name_and_labels(&self.name, unread, style);
@@ -1280,7 +1295,12 @@ impl Display for SpaceItem {
12801295}
12811296
12821297impl ListItem<IambInfo> for SpaceItem {
1283 fn show(&self, selected: bool, _: &ViewportContext<ListCursor>, _: &mut ProgramStore) -> Text {
1298 fn show(
1299 &self,
1300 selected: bool,
1301 _: &ViewportContext<ListCursor>,
1302 _: &mut ProgramStore,
1303 ) -> Text<'_> {
12841304 selected_text(self.name.as_str(), selected)
12851305 }
12861306
@@ -1411,7 +1431,12 @@ impl Display for VerifyItem {
14111431}
14121432
14131433impl ListItem<IambInfo> for VerifyItem {
1414 fn show(&self, selected: bool, _: &ViewportContext<ListCursor>, _: &mut ProgramStore) -> Text {
1434 fn show(
1435 &self,
1436 selected: bool,
1437 _: &ViewportContext<ListCursor>,
1438 _: &mut ProgramStore,
1439 ) -> Text<'_> {
14151440 let mut lines = vec![];
14161441
14171442 let bold = Style::default().add_modifier(StyleModifier::BOLD);
@@ -1521,7 +1546,7 @@ impl ListItem<IambInfo> for MemberItem {
15211546 selected: bool,
15221547 _: &ViewportContext<ListCursor>,
15231548 store: &mut ProgramStore,
1524 ) -> Text {
1549 ) -> Text<'_> {
15251550 let info = store.application.rooms.get_or_default(self.room_id.clone());
15261551 let user_id = self.member.user_id();
15271552
src/windows/room/chat.rs +1 −2
@@ -610,8 +610,7 @@ impl ChatState {
610610 let mut buff = std::io::Cursor::new(bytes);
611611 dynimage.write_to(&mut buff, image::ImageFormat::Png)?;
612612 Ok(buff.into_inner())
613 })
614 .map_err(IambError::from)?;
613 })?;
615614 let mime = mime::IMAGE_PNG;
616615
617616 let name = "Clipboard.png";
src/windows/room/mod.rs +1 −1
@@ -658,7 +658,7 @@ impl RoomState {
658658 }
659659 }
660660
661 pub fn get_title(&self, store: &mut ProgramStore) -> Line {
661 pub fn get_title(&self, store: &mut ProgramStore) -> Line<'_> {
662662 let title = store.application.get_room_title(self.id());
663663 let style = Style::default().add_modifier(StyleModifier::BOLD);
664664 let mut spans = vec![];