From 0171e6c9709705018a2662fc3154fc3e0580b192 Mon Sep 17 00:00:00 2001 From: William Casarin Date: Thu, 28 Nov 2024 09:31:34 -0800 Subject: [PATCH] clippy: fix clippy warnings Signed-off-by: William Casarin --- enostr/src/profile.rs | 14 +++++++------- enostr/src/relay/pool.rs | 2 +- src/ui/account_login_view.rs | 2 +- src/ui/accounts.rs | 2 +- src/ui/add_column.rs | 2 +- src/ui/mention.rs | 2 +- src/ui/note/mod.rs | 2 +- src/ui/note/post.rs | 2 +- src/ui/profile/picture.rs | 4 ++-- src/ui/profile/preview.rs | 12 ++++++------ src/ui/relay.rs | 4 ++-- src/ui/side_panel.rs | 4 ++-- src/ui/username.rs | 2 +- 13 files changed, 27 insertions(+), 27 deletions(-) diff --git a/enostr/src/profile.rs b/enostr/src/profile.rs index aa9a768..98144ef 100644 --- a/enostr/src/profile.rs +++ b/enostr/src/profile.rs @@ -9,30 +9,30 @@ impl Profile { } pub fn name(&self) -> Option<&str> { - return self.0["name"].as_str(); + self.0["name"].as_str() } pub fn display_name(&self) -> Option<&str> { - return self.0["display_name"].as_str(); + self.0["display_name"].as_str() } pub fn lud06(&self) -> Option<&str> { - return self.0["lud06"].as_str(); + self.0["lud06"].as_str() } pub fn lud16(&self) -> Option<&str> { - return self.0["lud16"].as_str(); + self.0["lud16"].as_str() } pub fn about(&self) -> Option<&str> { - return self.0["about"].as_str(); + self.0["about"].as_str() } pub fn picture(&self) -> Option<&str> { - return self.0["picture"].as_str(); + self.0["picture"].as_str() } pub fn website(&self) -> Option<&str> { - return self.0["website"].as_str(); + self.0["website"].as_str() } } diff --git a/enostr/src/relay/pool.rs b/enostr/src/relay/pool.rs index ed8d37a..a24fb43 100644 --- a/enostr/src/relay/pool.rs +++ b/enostr/src/relay/pool.rs @@ -18,7 +18,7 @@ pub struct PoolEvent<'a> { pub event: ewebsock::WsEvent, } -impl<'a> PoolEvent<'a> { +impl PoolEvent<'_> { pub fn into_owned(self) -> PoolEventBuf { PoolEventBuf { relay: self.relay.to_owned(), diff --git a/src/ui/account_login_view.rs b/src/ui/account_login_view.rs index cc75c2d..012d0b3 100644 --- a/src/ui/account_login_view.rs +++ b/src/ui/account_login_view.rs @@ -152,7 +152,7 @@ mod preview { } } - impl<'a> Preview for AccountLoginView<'a> { + impl Preview for AccountLoginView<'_> { type Prev = AccountLoginPreview; fn preview(cfg: PreviewConfig) -> Self::Prev { diff --git a/src/ui/accounts.rs b/src/ui/accounts.rs index 0e0d71a..dafbcb9 100644 --- a/src/ui/accounts.rs +++ b/src/ui/accounts.rs @@ -247,7 +247,7 @@ mod preview { } } - impl<'a> Preview for AccountsView<'a> { + impl Preview for AccountsView<'_> { type Prev = AccountsPreview; fn preview(_cfg: PreviewConfig) -> Self::Prev { diff --git a/src/ui/add_column.rs b/src/ui/add_column.rs index a5e5603..395d629 100644 --- a/src/ui/add_column.rs +++ b/src/ui/add_column.rs @@ -460,7 +460,7 @@ mod preview { } } - impl<'a> Preview for AddColumnView<'a> { + impl Preview for AddColumnView<'_> { type Prev = AddColumnPreview; fn preview(_cfg: PreviewConfig) -> Self::Prev { diff --git a/src/ui/mention.rs b/src/ui/mention.rs index e7353fb..f3bb2b2 100644 --- a/src/ui/mention.rs +++ b/src/ui/mention.rs @@ -40,7 +40,7 @@ impl<'a> Mention<'a> { } } -impl<'a> egui::Widget for Mention<'a> { +impl egui::Widget for Mention<'_> { fn ui(self, ui: &mut egui::Ui) -> egui::Response { mention_ui( self.ndb, diff --git a/src/ui/note/mod.rs b/src/ui/note/mod.rs index a1cfed5..0e6e044 100644 --- a/src/ui/note/mod.rs +++ b/src/ui/note/mod.rs @@ -61,7 +61,7 @@ impl NoteResponse { } } -impl<'a> View for NoteView<'a> { +impl View for NoteView<'_> { fn ui(&mut self, ui: &mut egui::Ui) { self.show(ui); } diff --git a/src/ui/note/post.rs b/src/ui/note/post.rs index 3cfbc4c..497c884 100644 --- a/src/ui/note/post.rs +++ b/src/ui/note/post.rs @@ -296,7 +296,7 @@ mod preview { } } - impl<'a> Preview for PostView<'a> { + impl Preview for PostView<'_> { type Prev = PostPreview; fn preview(_cfg: PreviewConfig) -> Self::Prev { diff --git a/src/ui/profile/picture.rs b/src/ui/profile/picture.rs index 379ac63..b6d42cd 100644 --- a/src/ui/profile/picture.rs +++ b/src/ui/profile/picture.rs @@ -9,7 +9,7 @@ pub struct ProfilePic<'cache, 'url> { size: f32, } -impl<'cache, 'url> egui::Widget for ProfilePic<'cache, 'url> { +impl egui::Widget for ProfilePic<'_, '_> { fn ui(self, ui: &mut egui::Ui) -> egui::Response { render_pfp(ui, self.cache, self.url, self.size) } @@ -209,7 +209,7 @@ mod preview { } } - impl<'cache, 'url> Preview for ProfilePic<'cache, 'url> { + impl Preview for ProfilePic<'_, '_> { type Prev = ProfilePicPreview; fn preview(_cfg: PreviewConfig) -> Self::Prev { diff --git a/src/ui/profile/preview.rs b/src/ui/profile/preview.rs index 6327d03..647ad0a 100644 --- a/src/ui/profile/preview.rs +++ b/src/ui/profile/preview.rs @@ -77,7 +77,7 @@ impl<'a, 'cache> ProfilePreview<'a, 'cache> { } } -impl<'a, 'cache> egui::Widget for ProfilePreview<'a, 'cache> { +impl egui::Widget for ProfilePreview<'_, '_> { fn ui(self, ui: &mut egui::Ui) -> egui::Response { ui.vertical(|ui| { ui.add_sized([ui.available_size().x, 80.0], |ui: &mut egui::Ui| { @@ -101,7 +101,7 @@ impl<'a, 'cache> SimpleProfilePreview<'a, 'cache> { } } -impl<'a, 'cache> egui::Widget for SimpleProfilePreview<'a, 'cache> { +impl egui::Widget for SimpleProfilePreview<'_, '_> { fn ui(self, ui: &mut egui::Ui) -> egui::Response { Frame::none() .show(ui, |ui| { @@ -124,7 +124,7 @@ mod previews { cache: ImageCache, } - impl<'a> ProfilePreviewPreview<'a> { + impl ProfilePreviewPreview<'_> { pub fn new() -> Self { let profile = test_profile_record(); let path = DataPath::new("previews") @@ -135,19 +135,19 @@ mod previews { } } - impl<'a> Default for ProfilePreviewPreview<'a> { + impl Default for ProfilePreviewPreview<'_> { fn default() -> Self { ProfilePreviewPreview::new() } } - impl<'a> View for ProfilePreviewPreview<'a> { + impl View for ProfilePreviewPreview<'_> { fn ui(&mut self, ui: &mut egui::Ui) { ProfilePreview::new(&self.profile, &mut self.cache).ui(ui); } } - impl<'a, 'cache> Preview for ProfilePreview<'a, 'cache> { + impl<'a> Preview for ProfilePreview<'a, '_> { /// A preview of the profile preview :D type Prev = ProfilePreviewPreview<'a>; diff --git a/src/ui/relay.rs b/src/ui/relay.rs index fb0db6d..523f3d8 100644 --- a/src/ui/relay.rs +++ b/src/ui/relay.rs @@ -9,7 +9,7 @@ pub struct RelayView<'a> { manager: RelayPoolManager<'a>, } -impl<'a> View for RelayView<'a> { +impl View for RelayView<'_> { fn ui(&mut self, ui: &mut egui::Ui) { ui.add_space(24.0); @@ -200,7 +200,7 @@ mod preview { } } - impl<'a> Preview for RelayView<'a> { + impl Preview for RelayView<'_> { type Prev = RelayViewPreview; fn preview(_cfg: PreviewConfig) -> Self::Prev { diff --git a/src/ui/side_panel.rs b/src/ui/side_panel.rs index 27e5cd2..8e652e2 100644 --- a/src/ui/side_panel.rs +++ b/src/ui/side_panel.rs @@ -27,7 +27,7 @@ pub struct DesktopSidePanel<'a> { selected_account: Option<&'a UserAccount>, } -impl<'a> View for DesktopSidePanel<'a> { +impl View for DesktopSidePanel<'_> { fn ui(&mut self, ui: &mut egui::Ui) { self.show(ui); } @@ -461,7 +461,7 @@ mod preview { } } - impl<'a> Preview for DesktopSidePanel<'a> { + impl Preview for DesktopSidePanel<'_> { type Prev = DesktopSidePanelPreview; fn preview(_cfg: PreviewConfig) -> Self::Prev { diff --git a/src/ui/username.rs b/src/ui/username.rs index 71db4fe..325f336 100644 --- a/src/ui/username.rs +++ b/src/ui/username.rs @@ -32,7 +32,7 @@ impl<'a> Username<'a> { } } -impl<'a> Widget for Username<'a> { +impl Widget for Username<'_> { fn ui(self, ui: &mut egui::Ui) -> egui::Response { ui.horizontal(|ui| { ui.spacing_mut().item_spacing.x = 0.0;