diff --git a/src/config.rs b/src/config.rs index d6a03b6..635a295 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1003,7 +1003,7 @@ impl ApplicationSettings { Ok(()) } - pub fn get_user_char_span(&self, user_id: &UserId) -> Span { + pub fn get_user_char_span(&self, user_id: &UserId) -> Span<'_> { let (color, c) = self .tunables .users diff --git a/src/message/mod.rs b/src/message/mod.rs index c3d144b..723a575 100644 --- a/src/message/mod.rs +++ b/src/message/mod.rs @@ -233,13 +233,13 @@ impl MessageTimeStamp { dt1.date_naive() == dt2.date_naive() } - fn show_date(&self) -> Option { + fn show_date(&self) -> Option> { let time = self.as_datetime().format("%A, %B %d %Y").to_string(); Span::styled(time, BOLD_STYLE).into() } - fn show_time(&self) -> Option { + fn show_time(&self) -> Option> { match self { MessageTimeStamp::OriginServer(ms) => { let time = millis_to_datetime(*ms).format("%T"); diff --git a/src/windows/mod.rs b/src/windows/mod.rs index b18e53f..690399b 100644 --- a/src/windows/mod.rs +++ b/src/windows/mod.rs @@ -97,12 +97,12 @@ fn bold_style() -> Style { } #[inline] -fn bold_span(s: &str) -> Span { +fn bold_span(s: &str) -> Span<'_> { Span::styled(s, bold_style()) } #[inline] -fn bold_spans(s: &str) -> Line { +fn bold_spans(s: &str) -> Line<'_> { bold_span(s).into() } @@ -116,12 +116,12 @@ fn selected_style(selected: bool) -> Style { } #[inline] -fn selected_span(s: &str, selected: bool) -> Span { +fn selected_span(s: &str, selected: bool) -> Span<'_> { Span::styled(s, selected_style(selected)) } #[inline] -fn selected_text(s: &str, selected: bool) -> Text { +fn selected_text(s: &str, selected: bool) -> Text<'_> { Text::from(selected_span(s, selected)) } @@ -743,7 +743,7 @@ impl Window for IambWindow { } } - fn get_tab_title(&self, store: &mut ProgramStore) -> Line { + fn get_tab_title(&self, store: &mut ProgramStore) -> Line<'_> { match self { IambWindow::DirectList(_) => bold_spans("Direct Messages"), IambWindow::RoomList(_) => bold_spans("Rooms"), @@ -771,7 +771,7 @@ impl Window for IambWindow { } } - fn get_win_title(&self, store: &mut ProgramStore) -> Line { + fn get_win_title(&self, store: &mut ProgramStore) -> Line<'_> { match self { IambWindow::DirectList(_) => bold_spans("Direct Messages"), IambWindow::RoomList(_) => bold_spans("Rooms"), @@ -959,7 +959,12 @@ impl Display for GenericChatItem { } impl ListItem for GenericChatItem { - fn show(&self, selected: bool, _: &ViewportContext, _: &mut ProgramStore) -> Text { + fn show( + &self, + selected: bool, + _: &ViewportContext, + _: &mut ProgramStore, + ) -> Text<'_> { let unread = self.unread.is_unread(); let style = selected_style(selected); let (name, mut labels) = name_and_labels(&self.name, unread, style); @@ -1073,7 +1078,12 @@ impl Display for RoomItem { } impl ListItem for RoomItem { - fn show(&self, selected: bool, _: &ViewportContext, _: &mut ProgramStore) -> Text { + fn show( + &self, + selected: bool, + _: &ViewportContext, + _: &mut ProgramStore, + ) -> Text<'_> { let unread = self.unread.is_unread(); let style = selected_style(selected); let (name, mut labels) = name_and_labels(&self.name, unread, style); @@ -1177,7 +1187,12 @@ impl Display for DirectItem { } impl ListItem for DirectItem { - fn show(&self, selected: bool, _: &ViewportContext, _: &mut ProgramStore) -> Text { + fn show( + &self, + selected: bool, + _: &ViewportContext, + _: &mut ProgramStore, + ) -> Text<'_> { let unread = self.unread.is_unread(); let style = selected_style(selected); let (name, mut labels) = name_and_labels(&self.name, unread, style); @@ -1280,7 +1295,12 @@ impl Display for SpaceItem { } impl ListItem for SpaceItem { - fn show(&self, selected: bool, _: &ViewportContext, _: &mut ProgramStore) -> Text { + fn show( + &self, + selected: bool, + _: &ViewportContext, + _: &mut ProgramStore, + ) -> Text<'_> { selected_text(self.name.as_str(), selected) } @@ -1411,7 +1431,12 @@ impl Display for VerifyItem { } impl ListItem for VerifyItem { - fn show(&self, selected: bool, _: &ViewportContext, _: &mut ProgramStore) -> Text { + fn show( + &self, + selected: bool, + _: &ViewportContext, + _: &mut ProgramStore, + ) -> Text<'_> { let mut lines = vec![]; let bold = Style::default().add_modifier(StyleModifier::BOLD); @@ -1521,7 +1546,7 @@ impl ListItem for MemberItem { selected: bool, _: &ViewportContext, store: &mut ProgramStore, - ) -> Text { + ) -> Text<'_> { let info = store.application.rooms.get_or_default(self.room_id.clone()); let user_id = self.member.user_id(); diff --git a/src/windows/room/chat.rs b/src/windows/room/chat.rs index c92d410..6cf7424 100644 --- a/src/windows/room/chat.rs +++ b/src/windows/room/chat.rs @@ -610,8 +610,7 @@ impl ChatState { let mut buff = std::io::Cursor::new(bytes); dynimage.write_to(&mut buff, image::ImageFormat::Png)?; Ok(buff.into_inner()) - }) - .map_err(IambError::from)?; + })?; let mime = mime::IMAGE_PNG; let name = "Clipboard.png"; diff --git a/src/windows/room/mod.rs b/src/windows/room/mod.rs index adb3a9c..0946f8e 100644 --- a/src/windows/room/mod.rs +++ b/src/windows/room/mod.rs @@ -658,7 +658,7 @@ impl RoomState { } } - pub fn get_title(&self, store: &mut ProgramStore) -> Line { + pub fn get_title(&self, store: &mut ProgramStore) -> Line<'_> { let title = store.application.get_room_title(self.id()); let style = Style::default().add_modifier(StyleModifier::BOLD); let mut spans = vec![];