From 6c884f3077e9f951c63b58fcbf6864f3065f6036 Mon Sep 17 00:00:00 2001 From: Joscha Date: Fri, 21 Feb 2025 19:15:33 +0100 Subject: [PATCH] Update RPIT lifetime bounds for the 2024 edition When the bound matches the implicit bound, i.e. when you'd just write impl ... + use<'_> then it can be omitted. My gut instinct is to always write the bound explicitly, but maybe that'll harm readability once I'm more used to how bounds work now. Anyways, always try to keep the bound as small as possible, ideally just impl ... + use<> --- cove/src/ui/euph/account.rs | 4 ++-- cove/src/ui/euph/auth.rs | 2 +- cove/src/ui/euph/links.rs | 2 +- cove/src/ui/euph/nick.rs | 2 +- cove/src/ui/rooms/connect.rs | 2 +- cove/src/ui/rooms/delete.rs | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cove/src/ui/euph/account.rs b/cove/src/ui/euph/account.rs index 48731d9..7aa776f 100644 --- a/cove/src/ui/euph/account.rs +++ b/cove/src/ui/euph/account.rs @@ -35,7 +35,7 @@ impl LoggedOut { } } - fn widget(&mut self) -> impl Widget + '_ { + fn widget(&mut self) -> impl Widget { let bold = Style::new().bold(); Join4::vertical( Text::new(("Not logged in", bold.yellow())).segment(), @@ -111,7 +111,7 @@ impl AccountUiState { } } - pub fn widget(&mut self) -> impl Widget + '_ { + pub fn widget(&mut self) -> impl Widget { let inner = match self { Self::LoggedOut(logged_out) => logged_out.widget().first2(), Self::LoggedIn(logged_in) => logged_in.widget().second2(), diff --git a/cove/src/ui/euph/auth.rs b/cove/src/ui/euph/auth.rs index 259e204..15f8fe1 100644 --- a/cove/src/ui/euph/auth.rs +++ b/cove/src/ui/euph/auth.rs @@ -13,7 +13,7 @@ pub fn new() -> EditorState { EditorState::new() } -pub fn widget(editor: &mut EditorState) -> impl Widget + '_ { +pub fn widget(editor: &mut EditorState) -> impl Widget { Popup::new( editor.widget().with_hidden_default_placeholder(), "Enter password", diff --git a/cove/src/ui/euph/links.rs b/cove/src/ui/euph/links.rs index 14496a6..a452669 100644 --- a/cove/src/ui/euph/links.rs +++ b/cove/src/ui/euph/links.rs @@ -38,7 +38,7 @@ impl LinksState { } } - pub fn widget(&mut self) -> impl Widget + '_ { + pub fn widget(&mut self) -> impl Widget { let style_selected = Style::new().black().on_white(); let mut list_builder = ListBuilder::new(); diff --git a/cove/src/ui/euph/nick.rs b/cove/src/ui/euph/nick.rs index 1940fac..707e992 100644 --- a/cove/src/ui/euph/nick.rs +++ b/cove/src/ui/euph/nick.rs @@ -14,7 +14,7 @@ pub fn new(joined: Joined) -> EditorState { EditorState::with_initial_text(joined.session.name) } -pub fn widget(editor: &mut EditorState) -> impl Widget + '_ { +pub fn widget(editor: &mut EditorState) -> impl Widget { let inner = editor .widget() .with_highlight(|s| euph::style_nick_exact(s, Style::new())); diff --git a/cove/src/ui/rooms/connect.rs b/cove/src/ui/rooms/connect.rs index ce53775..83a359e 100644 --- a/cove/src/ui/rooms/connect.rs +++ b/cove/src/ui/rooms/connect.rs @@ -84,7 +84,7 @@ impl ConnectState { ConnectResult::Unhandled } - pub fn widget(&mut self) -> impl Widget + '_ { + pub fn widget(&mut self) -> impl Widget { let room_style = Style::new().bold().blue(); let domain_style = Style::new().grey(); diff --git a/cove/src/ui/rooms/delete.rs b/cove/src/ui/rooms/delete.rs index aafaad8..baa96b1 100644 --- a/cove/src/ui/rooms/delete.rs +++ b/cove/src/ui/rooms/delete.rs @@ -47,7 +47,7 @@ impl DeleteState { DeleteResult::Unhandled } - pub fn widget(&mut self) -> impl Widget + '_ { + pub fn widget(&mut self) -> impl Widget { let warn_style = Style::new().bold().red(); let room_style = Style::new().bold().blue(); let text = Styled::new_plain("Are you sure you want to delete ")