clippy: fix clippy warnings

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2024-11-28 09:31:34 -08:00
parent 708be85709
commit 0171e6c970
13 changed files with 27 additions and 27 deletions

View File

@@ -9,30 +9,30 @@ impl Profile {
} }
pub fn name(&self) -> Option<&str> { pub fn name(&self) -> Option<&str> {
return self.0["name"].as_str(); self.0["name"].as_str()
} }
pub fn display_name(&self) -> Option<&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> { pub fn lud06(&self) -> Option<&str> {
return self.0["lud06"].as_str(); self.0["lud06"].as_str()
} }
pub fn lud16(&self) -> Option<&str> { pub fn lud16(&self) -> Option<&str> {
return self.0["lud16"].as_str(); self.0["lud16"].as_str()
} }
pub fn about(&self) -> Option<&str> { pub fn about(&self) -> Option<&str> {
return self.0["about"].as_str(); self.0["about"].as_str()
} }
pub fn picture(&self) -> Option<&str> { pub fn picture(&self) -> Option<&str> {
return self.0["picture"].as_str(); self.0["picture"].as_str()
} }
pub fn website(&self) -> Option<&str> { pub fn website(&self) -> Option<&str> {
return self.0["website"].as_str(); self.0["website"].as_str()
} }
} }

View File

@@ -18,7 +18,7 @@ pub struct PoolEvent<'a> {
pub event: ewebsock::WsEvent, pub event: ewebsock::WsEvent,
} }
impl<'a> PoolEvent<'a> { impl PoolEvent<'_> {
pub fn into_owned(self) -> PoolEventBuf { pub fn into_owned(self) -> PoolEventBuf {
PoolEventBuf { PoolEventBuf {
relay: self.relay.to_owned(), relay: self.relay.to_owned(),

View File

@@ -152,7 +152,7 @@ mod preview {
} }
} }
impl<'a> Preview for AccountLoginView<'a> { impl Preview for AccountLoginView<'_> {
type Prev = AccountLoginPreview; type Prev = AccountLoginPreview;
fn preview(cfg: PreviewConfig) -> Self::Prev { fn preview(cfg: PreviewConfig) -> Self::Prev {

View File

@@ -247,7 +247,7 @@ mod preview {
} }
} }
impl<'a> Preview for AccountsView<'a> { impl Preview for AccountsView<'_> {
type Prev = AccountsPreview; type Prev = AccountsPreview;
fn preview(_cfg: PreviewConfig) -> Self::Prev { fn preview(_cfg: PreviewConfig) -> Self::Prev {

View File

@@ -460,7 +460,7 @@ mod preview {
} }
} }
impl<'a> Preview for AddColumnView<'a> { impl Preview for AddColumnView<'_> {
type Prev = AddColumnPreview; type Prev = AddColumnPreview;
fn preview(_cfg: PreviewConfig) -> Self::Prev { fn preview(_cfg: PreviewConfig) -> Self::Prev {

View File

@@ -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 { fn ui(self, ui: &mut egui::Ui) -> egui::Response {
mention_ui( mention_ui(
self.ndb, self.ndb,

View File

@@ -61,7 +61,7 @@ impl NoteResponse {
} }
} }
impl<'a> View for NoteView<'a> { impl View for NoteView<'_> {
fn ui(&mut self, ui: &mut egui::Ui) { fn ui(&mut self, ui: &mut egui::Ui) {
self.show(ui); self.show(ui);
} }

View File

@@ -296,7 +296,7 @@ mod preview {
} }
} }
impl<'a> Preview for PostView<'a> { impl Preview for PostView<'_> {
type Prev = PostPreview; type Prev = PostPreview;
fn preview(_cfg: PreviewConfig) -> Self::Prev { fn preview(_cfg: PreviewConfig) -> Self::Prev {

View File

@@ -9,7 +9,7 @@ pub struct ProfilePic<'cache, 'url> {
size: f32, 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 { fn ui(self, ui: &mut egui::Ui) -> egui::Response {
render_pfp(ui, self.cache, self.url, self.size) 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; type Prev = ProfilePicPreview;
fn preview(_cfg: PreviewConfig) -> Self::Prev { fn preview(_cfg: PreviewConfig) -> Self::Prev {

View File

@@ -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 { fn ui(self, ui: &mut egui::Ui) -> egui::Response {
ui.vertical(|ui| { ui.vertical(|ui| {
ui.add_sized([ui.available_size().x, 80.0], |ui: &mut egui::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 { fn ui(self, ui: &mut egui::Ui) -> egui::Response {
Frame::none() Frame::none()
.show(ui, |ui| { .show(ui, |ui| {
@@ -124,7 +124,7 @@ mod previews {
cache: ImageCache, cache: ImageCache,
} }
impl<'a> ProfilePreviewPreview<'a> { impl ProfilePreviewPreview<'_> {
pub fn new() -> Self { pub fn new() -> Self {
let profile = test_profile_record(); let profile = test_profile_record();
let path = DataPath::new("previews") let path = DataPath::new("previews")
@@ -135,19 +135,19 @@ mod previews {
} }
} }
impl<'a> Default for ProfilePreviewPreview<'a> { impl Default for ProfilePreviewPreview<'_> {
fn default() -> Self { fn default() -> Self {
ProfilePreviewPreview::new() ProfilePreviewPreview::new()
} }
} }
impl<'a> View for ProfilePreviewPreview<'a> { impl View for ProfilePreviewPreview<'_> {
fn ui(&mut self, ui: &mut egui::Ui) { fn ui(&mut self, ui: &mut egui::Ui) {
ProfilePreview::new(&self.profile, &mut self.cache).ui(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 /// A preview of the profile preview :D
type Prev = ProfilePreviewPreview<'a>; type Prev = ProfilePreviewPreview<'a>;

View File

@@ -9,7 +9,7 @@ pub struct RelayView<'a> {
manager: RelayPoolManager<'a>, manager: RelayPoolManager<'a>,
} }
impl<'a> View for RelayView<'a> { impl View for RelayView<'_> {
fn ui(&mut self, ui: &mut egui::Ui) { fn ui(&mut self, ui: &mut egui::Ui) {
ui.add_space(24.0); ui.add_space(24.0);
@@ -200,7 +200,7 @@ mod preview {
} }
} }
impl<'a> Preview for RelayView<'a> { impl Preview for RelayView<'_> {
type Prev = RelayViewPreview; type Prev = RelayViewPreview;
fn preview(_cfg: PreviewConfig) -> Self::Prev { fn preview(_cfg: PreviewConfig) -> Self::Prev {

View File

@@ -27,7 +27,7 @@ pub struct DesktopSidePanel<'a> {
selected_account: Option<&'a UserAccount>, selected_account: Option<&'a UserAccount>,
} }
impl<'a> View for DesktopSidePanel<'a> { impl View for DesktopSidePanel<'_> {
fn ui(&mut self, ui: &mut egui::Ui) { fn ui(&mut self, ui: &mut egui::Ui) {
self.show(ui); self.show(ui);
} }
@@ -461,7 +461,7 @@ mod preview {
} }
} }
impl<'a> Preview for DesktopSidePanel<'a> { impl Preview for DesktopSidePanel<'_> {
type Prev = DesktopSidePanelPreview; type Prev = DesktopSidePanelPreview;
fn preview(_cfg: PreviewConfig) -> Self::Prev { fn preview(_cfg: PreviewConfig) -> Self::Prev {

View File

@@ -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 { fn ui(self, ui: &mut egui::Ui) -> egui::Response {
ui.horizontal(|ui| { ui.horizontal(|ui| {
ui.spacing_mut().item_spacing.x = 0.0; ui.spacing_mut().item_spacing.x = 0.0;