From f45e66f572e10b993bbec6db4e36519143c07a94 Mon Sep 17 00:00:00 2001 From: Joscha Date: Fri, 21 Feb 2025 12:11:58 +0100 Subject: [PATCH] Fix or ignore 2024 edition migration lints --- Cargo.toml | 6 +++++- cove/src/ui/chat/tree/renderer.rs | 2 +- cove/src/ui/euph/account.rs | 2 +- cove/src/ui/euph/inspect.rs | 4 ++-- cove/src/ui/euph/nick_list.rs | 2 +- cove/src/ui/euph/popup.rs | 4 ++-- cove/src/ui/euph/room.rs | 2 +- cove/src/ui/key_bindings.rs | 2 +- cove/src/ui/rooms.rs | 2 +- 9 files changed, 15 insertions(+), 11 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 10e1968..96c02c1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -68,7 +68,11 @@ rust.unused_lifetimes = "warn" rust.unused_qualifications = "warn" # Clippy clippy.use_self = "warn" - +# Migrating to the 2024 edition +rust.rust_2024_compatibility = "warn" +rust.edition_2024_expr_fragment_specifier = { level = "allow", priority = 1 } +rust.if_let_rescope = { level = "allow", priority = 1 } +rust.tail_expr_drop_order = { level = "allow", priority = 1 } [profile.dev.package."*"] opt-level = 3 diff --git a/cove/src/ui/chat/tree/renderer.rs b/cove/src/ui/chat/tree/renderer.rs index 845e803..3aeadb1 100644 --- a/cove/src/ui/chat/tree/renderer.rs +++ b/cove/src/ui/chat/tree/renderer.rs @@ -437,7 +437,7 @@ where pub fn into_visible_blocks( self, - ) -> impl Iterator, Block>)> { + ) -> impl Iterator, Block>)> + use { let area = renderer::visible_area(&self); self.blocks .into_iter() diff --git a/cove/src/ui/euph/account.rs b/cove/src/ui/euph/account.rs index 359e9d5..b97f014 100644 --- a/cove/src/ui/euph/account.rs +++ b/cove/src/ui/euph/account.rs @@ -66,7 +66,7 @@ impl LoggedOut { pub struct LoggedIn(PersonalAccountView); impl LoggedIn { - fn widget(&self) -> impl Widget { + fn widget(&self) -> impl Widget + use<> { let bold = Style::new().bold(); Join5::vertical( Text::new(("Logged in", bold.green())).segment(), diff --git a/cove/src/ui/euph/inspect.rs b/cove/src/ui/euph/inspect.rs index 25620a2..d1e2380 100644 --- a/cove/src/ui/euph/inspect.rs +++ b/cove/src/ui/euph/inspect.rs @@ -91,7 +91,7 @@ fn message_lines(mut text: Styled, msg: &Message) -> Styled { text } -pub fn session_widget(session: &SessionInfo) -> impl Widget { +pub fn session_widget(session: &SessionInfo) -> impl Widget + use<> { let heading_style = Style::new().bold(); let text = match session { @@ -108,7 +108,7 @@ pub fn session_widget(session: &SessionInfo) -> impl Widget { Popup::new(Text::new(text), "Inspect session") } -pub fn message_widget(msg: &Message) -> impl Widget { +pub fn message_widget(msg: &Message) -> impl Widget + use<> { let heading_style = Style::new().bold(); let mut text = Styled::new("Message", heading_style).then_plain("\n"); diff --git a/cove/src/ui/euph/nick_list.rs b/cove/src/ui/euph/nick_list.rs index 23160bd..47f09c7 100644 --- a/cove/src/ui/euph/nick_list.rs +++ b/cove/src/ui/euph/nick_list.rs @@ -14,7 +14,7 @@ pub fn widget<'a>( list: &'a mut ListState, joined: &Joined, focused: bool, -) -> impl Widget + 'a { +) -> impl Widget + use<'a> { let mut list_builder = ListBuilder::new(); render_rows(&mut list_builder, joined, focused); list_builder.build(list) diff --git a/cove/src/ui/euph/popup.rs b/cove/src/ui/euph/popup.rs index f70e999..61b3ad5 100644 --- a/cove/src/ui/euph/popup.rs +++ b/cove/src/ui/euph/popup.rs @@ -12,7 +12,7 @@ pub enum RoomPopup { } impl RoomPopup { - fn server_error_widget(description: &str, reason: &str) -> impl Widget { + fn server_error_widget(description: &str, reason: &str) -> impl Widget + use<> { let border_style = Style::new().red().bold(); let text = Styled::new_plain(description) .then_plain("\n\n") @@ -23,7 +23,7 @@ impl RoomPopup { Popup::new(Text::new(text), ("Error", border_style)).with_border_style(border_style) } - pub fn widget(&self) -> impl Widget { + pub fn widget(&self) -> impl Widget + use<> { match self { Self::Error { description, diff --git a/cove/src/ui/euph/room.rs b/cove/src/ui/euph/room.rs index 15da008..0b36535 100644 --- a/cove/src/ui/euph/room.rs +++ b/cove/src/ui/euph/room.rs @@ -287,7 +287,7 @@ impl EuphRoom { .boxed_async() } - async fn status_widget(&self, state: Option<&euph::State>) -> impl Widget { + async fn status_widget(&self, state: Option<&euph::State>) -> impl Widget + use<> { let room_style = Style::new().bold().blue(); let mut info = Styled::new(format!("{} ", self.domain()), Style::new().grey()) .then(format!("&{}", self.name()), room_style); diff --git a/cove/src/ui/key_bindings.rs b/cove/src/ui/key_bindings.rs index 8fceda6..f5fa714 100644 --- a/cove/src/ui/key_bindings.rs +++ b/cove/src/ui/key_bindings.rs @@ -69,7 +69,7 @@ fn render_group_info(builder: &mut Builder, group_info: KeyGroupInfo<'_>) { pub fn widget<'a>( list: &'a mut ListState, config: &Config, -) -> impl Widget + 'a { +) -> impl Widget + use<'a> { let mut list_builder = ListBuilder::new(); for group_info in config.keys.groups() { diff --git a/cove/src/ui/rooms.rs b/cove/src/ui/rooms.rs index 0157b01..a7bb6f8 100644 --- a/cove/src/ui/rooms.rs +++ b/cove/src/ui/rooms.rs @@ -423,7 +423,7 @@ impl Rooms { list: &'a mut ListState, order: Order, euph_rooms: &HashMap, - ) -> impl Widget + 'a { + ) -> impl Widget + use<'a> { let version_info = Styled::new_plain("Welcome to ") .then(format!("{NAME} {VERSION}"), Style::new().yellow().bold()) .then_plain("!");