make clippy happy

This commit is contained in:
William Casarin
2025-07-31 11:55:39 -07:00
parent a896a6ecfa
commit a8c6baeacb
5 changed files with 31 additions and 19 deletions

View File

@@ -582,7 +582,7 @@ fn render_nav_body(
.map(RenderNavAction::RelayAction),
Route::Settings => SettingsView::new(
&mut ctx.settings.get_settings_mut(),
ctx.settings.get_settings_mut(),
&mut note_context,
&mut app.note_options,
&mut app.jobs,

View File

@@ -31,12 +31,12 @@ pub enum ShowSourceClientOption {
Bottom,
}
impl Into<String> for ShowSourceClientOption {
fn into(self) -> String {
match self {
Self::Hide => "hide".to_string(),
Self::Top => "top".to_string(),
Self::Bottom => "bottom".to_string(),
impl From<ShowSourceClientOption> for String {
fn from(show_option: ShowSourceClientOption) -> Self {
match show_option {
ShowSourceClientOption::Hide => "hide".to_string(),
ShowSourceClientOption::Top => "top".to_string(),
ShowSourceClientOption::Bottom => "bottom".to_string(),
}
}
}
@@ -82,11 +82,23 @@ impl ShowSourceClientOption {
}
}
fn label<'a>(&self, i18n: &'a mut Localization) -> String {
fn label(&self, i18n: &mut Localization) -> String {
match self {
Self::Hide => tr!(i18n, "Hide", "Option in settings section to hide the source client label in note display"),
Self::Top => tr!(i18n, "Top", "Option in settings section to show the source client label at the top of the note"),
Self::Bottom => tr!(i18n, "Bottom", "Option in settings section to show the source client label at the bottom of the note"),
Self::Hide => tr!(
i18n,
"Hide",
"Option in settings section to hide the source client label in note display"
),
Self::Top => tr!(
i18n,
"Top",
"Option in settings section to show the source client label at the top of the note"
),
Self::Bottom => tr!(
i18n,
"Bottom",
"Option in settings section to show the source client label at the bottom of the note"
),
}
}
}
@@ -260,7 +272,7 @@ impl<'a> SettingsView<'a> {
let txn = Transaction::new(self.note_context.ndb).unwrap();
if let Some(note_id) = NoteId::from_bech(PREVIEW_NOTE_ID) {
if let Ok(preview_note) =
self.note_context.ndb.get_note_by_id(&txn, &note_id.bytes())
self.note_context.ndb.get_note_by_id(&txn, note_id.bytes())
{
notedeck_ui::padding(8.0, ui, |ui| {
if is_narrow(ui.ctx()) {
@@ -270,7 +282,7 @@ impl<'a> SettingsView<'a> {
NoteView::new(
self.note_context,
&preview_note,
self.note_options.clone(),
*self.note_options,
self.jobs,
)
.actionbar(false)

View File

@@ -255,7 +255,7 @@ impl<'a> ThreadNoteBuilder<'a> {
if replies_newer_first {
self.replies
.sort_by(|a, b| b.created_at().cmp(&a.created_at()));
.sort_by_key(|b| std::cmp::Reverse(b.created_at()));
}
for reply in self.replies {