mirror of
https://github.com/aljazceru/notedeck.git
synced 2025-12-19 01:24:21 +01:00
refactor: ocd unnecessary pass by value
Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
@@ -176,7 +176,10 @@ impl<'a, 'd> ProfileView<'a, 'd> {
|
|||||||
|
|
||||||
ui.add_space(18.0);
|
ui.add_space(18.0);
|
||||||
|
|
||||||
ui.add(display_name_widget(get_display_name(Some(&profile)), false));
|
ui.add(display_name_widget(
|
||||||
|
&get_display_name(Some(&profile)),
|
||||||
|
false,
|
||||||
|
));
|
||||||
|
|
||||||
ui.add_space(8.0);
|
ui.add_space(8.0);
|
||||||
|
|
||||||
@@ -340,7 +343,10 @@ fn edit_profile_button() -> impl egui::Widget + 'static {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn display_name_widget(name: NostrName<'_>, add_placeholder_space: bool) -> impl egui::Widget + '_ {
|
fn display_name_widget<'a>(
|
||||||
|
name: &'a NostrName<'a>,
|
||||||
|
add_placeholder_space: bool,
|
||||||
|
) -> impl egui::Widget + 'a {
|
||||||
move |ui: &mut egui::Ui| -> egui::Response {
|
move |ui: &mut egui::Ui| -> egui::Response {
|
||||||
let disp_resp = name.display_name.map(|disp_name| {
|
let disp_resp = name.display_name.map(|disp_name| {
|
||||||
ui.add(
|
ui.add(
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ impl<'a, 'cache> ProfilePreview<'a, 'cache> {
|
|||||||
.border(ProfilePic::border_stroke(ui)),
|
.border(ProfilePic::border_stroke(ui)),
|
||||||
);
|
);
|
||||||
ui.add(display_name_widget(
|
ui.add(display_name_widget(
|
||||||
get_display_name(Some(self.profile)),
|
&get_display_name(Some(self.profile)),
|
||||||
false,
|
false,
|
||||||
));
|
));
|
||||||
ui.add(about_section_widget(self.profile));
|
ui.add(about_section_widget(self.profile));
|
||||||
@@ -94,7 +94,7 @@ impl egui::Widget for SimpleProfilePreview<'_, '_> {
|
|||||||
.show(ui, |ui| {
|
.show(ui, |ui| {
|
||||||
ui.add(ProfilePic::new(self.cache, get_profile_url(self.profile)).size(48.0));
|
ui.add(ProfilePic::new(self.cache, get_profile_url(self.profile)).size(48.0));
|
||||||
ui.vertical(|ui| {
|
ui.vertical(|ui| {
|
||||||
ui.add(display_name_widget(get_display_name(self.profile), true));
|
ui.add(display_name_widget(&get_display_name(self.profile), true));
|
||||||
if !self.is_nsec {
|
if !self.is_nsec {
|
||||||
ui.add(
|
ui.add(
|
||||||
Label::new(
|
Label::new(
|
||||||
|
|||||||
Reference in New Issue
Block a user