commit 3aa4d000531d1d276829536ebaad0b63c681ffa2 parent 9ef72ec7de1776193c89fb8118bf3c22dfa8984b Author: William Casarin <jb55@jb55.com> Date: Tue, 19 Aug 2025 09:45:36 -0700 clippy: fix lint errors Signed-off-by: William Casarin <jb55@jb55.com> Diffstat:
18 files changed, 25 insertions(+), 24 deletions(-)
diff --git a/crates/enostr/src/relay/subs_debug.rs b/crates/enostr/src/relay/subs_debug.rs @@ -68,7 +68,7 @@ impl From<RelayEvent<'_>> for OwnedRelayEvent { } #[derive(PartialEq, Eq, Hash, Clone)] -pub struct RelaySub { +pub struct _RelaySub { pub(crate) subid: String, pub(crate) filter: String, } diff --git a/crates/notedeck/src/account/contacts.rs b/crates/notedeck/src/account/contacts.rs @@ -42,7 +42,7 @@ impl Contacts { pub(super) fn query(&mut self, ndb: &Ndb, txn: &Transaction) { let binding = ndb - .query(txn, &[self.filter.clone()], 1) + .query(txn, std::slice::from_ref(&self.filter), 1) .expect("query user relays results"); let Some(res) = binding.first() else { diff --git a/crates/notedeck/src/account/mute.rs b/crates/notedeck/src/account/mute.rs @@ -33,7 +33,7 @@ impl AccountMutedData { .limit() .unwrap_or(crate::filter::default_limit()) as i32; let nks = ndb - .query(txn, &[self.filter.clone()], lim) + .query(txn, std::slice::from_ref(&self.filter), lim) .expect("query user muted results") .iter() .map(|qr| qr.note_key) diff --git a/crates/notedeck/src/account/relay.rs b/crates/notedeck/src/account/relay.rs @@ -36,7 +36,7 @@ impl AccountRelayData { .limit() .unwrap_or(crate::filter::default_limit()) as i32; let nks = ndb - .query(txn, &[self.filter.clone()], lim) + .query(txn, std::slice::from_ref(&self.filter), lim) .expect("query user relays results") .iter() .map(|qr| qr.note_key) diff --git a/crates/notedeck/src/app.rs b/crates/notedeck/src/app.rs @@ -241,8 +241,8 @@ impl Notedeck { let setting_locale: Result<LanguageIdentifier, LanguageIdentifierError> = settings.locale().parse(); - if setting_locale.is_ok() { - if let Err(err) = i18n.set_locale(setting_locale.unwrap()) { + if let Ok(setting_locale) = setting_locale { + if let Err(err) = i18n.set_locale(setting_locale) { error!("{err}"); } } diff --git a/crates/notedeck/src/imgcache.rs b/crates/notedeck/src/imgcache.rs @@ -35,7 +35,7 @@ impl TexturesCache { &mut self, url: &str, closure: impl FnOnce() -> Promise<Option<Result<TexturedImage>>>, - ) -> LoadableTextureState { + ) -> LoadableTextureState<'_> { let internal = self.handle_and_get_state_internal(url, true, closure); internal.into() @@ -45,7 +45,7 @@ impl TexturesCache { &mut self, url: &str, closure: impl FnOnce() -> Promise<Option<Result<TexturedImage>>>, - ) -> TextureState { + ) -> TextureState<'_> { let internal = self.handle_and_get_state_internal(url, false, closure); internal.into() @@ -96,7 +96,7 @@ impl TexturesCache { }); } - pub fn get_and_handle(&mut self, url: &str) -> Option<LoadableTextureState> { + pub fn get_and_handle(&mut self, url: &str) -> Option<LoadableTextureState<'_>> { self.cache.get_mut(url).map(|state| { handle_occupied(state, true); state.into() diff --git a/crates/notedeck/src/relayspec.rs b/crates/notedeck/src/relayspec.rs @@ -77,6 +77,7 @@ impl PartialEq for RelaySpec { impl Eq for RelaySpec {} +#[allow(clippy::non_canonical_partial_ord_impl)] impl PartialOrd for RelaySpec { fn partial_cmp(&self, other: &Self) -> Option<Ordering> { Some(self.url.cmp(&other.url)) diff --git a/crates/notedeck/src/user_account.rs b/crates/notedeck/src/user_account.rs @@ -22,7 +22,7 @@ impl UserAccount { } } - pub fn keypair(&self) -> KeypairUnowned { + pub fn keypair(&self) -> KeypairUnowned<'_> { KeypairUnowned { pubkey: &self.key.pubkey, secret_key: self.key.secret_key.as_ref(), diff --git a/crates/notedeck_clndash/src/event.rs b/crates/notedeck_clndash/src/event.rs @@ -48,7 +48,7 @@ impl<T, E> LoadingState<T, E> { } #[derive(Serialize, Debug, Clone)] -pub struct WaitRequest { +pub struct _WaitRequest { pub indexname: String, pub subsystem: String, pub nextvalue: u64, diff --git a/crates/notedeck_columns/src/decks.rs b/crates/notedeck_columns/src/decks.rs @@ -190,7 +190,7 @@ impl DecksCache { &self.fallback_pubkey } - pub fn get_all_decks_mut(&mut self) -> ValuesMut<Pubkey, Decks> { + pub fn get_all_decks_mut(&mut self) -> ValuesMut<'_, Pubkey, Decks> { self.account_to_decks.values_mut() } diff --git a/crates/notedeck_columns/src/media_upload.rs b/crates/notedeck_columns/src/media_upload.rs @@ -75,7 +75,7 @@ pub fn get_nostr_build_upload_url() -> Promise<Result<String, Error>> { get_upload_url_from_provider(NOSTR_BUILD_URL()) } -fn create_nip98_note(seckey: &[u8; 32], upload_url: String, payload_hash: String) -> Note { +fn create_nip98_note(seckey: &[u8; 32], upload_url: String, payload_hash: String) -> Note<'_> { NoteBuilder::new() .kind(27235) .start_tag() diff --git a/crates/notedeck_columns/src/nav.rs b/crates/notedeck_columns/src/nav.rs @@ -960,7 +960,7 @@ pub fn render_nav( ctx.ndb, ctx.img_cache, get_active_columns_mut(ctx.i18n, ctx.accounts, &mut app.decks_cache), - &[route.clone()], + std::slice::from_ref(route), col, ctx.i18n, ) diff --git a/crates/notedeck_columns/src/post.rs b/crates/notedeck_columns/src/post.rs @@ -56,7 +56,7 @@ impl NewPost { } } - pub fn to_note(&self, seckey: &[u8; 32]) -> Note { + pub fn to_note(&self, seckey: &[u8; 32]) -> Note<'_> { let mut content = self.content.clone(); append_urls(&mut content, &self.media); @@ -77,7 +77,7 @@ impl NewPost { builder.sign(seckey).build().expect("note should be ok") } - pub fn to_reply(&self, seckey: &[u8; 32], replying_to: &Note) -> Note { + pub fn to_reply(&self, seckey: &[u8; 32], replying_to: &Note) -> Note<'_> { let mut content = self.content.clone(); append_urls(&mut content, &self.media); @@ -157,7 +157,7 @@ impl NewPost { .expect("expected build to work") } - pub fn to_quote(&self, seckey: &[u8; 32], quoting: &Note) -> Note { + pub fn to_quote(&self, seckey: &[u8; 32], quoting: &Note) -> Note<'_> { let mut new_content = format!( "{}\nnostr:{}", self.content, diff --git a/crates/notedeck_columns/src/profile.rs b/crates/notedeck_columns/src/profile.rs @@ -15,7 +15,7 @@ impl SaveProfileChanges { pub fn new(kp: FullKeypair, state: ProfileState) -> Self { Self { kp, state } } - pub fn to_note(&self) -> Note { + pub fn to_note(&self) -> Note<'_> { let sec = &self.kp.secret_key.to_secret_bytes(); add_client_tag(NoteBuilder::new()) .kind(0) diff --git a/crates/notedeck_columns/src/timeline/kind.rs b/crates/notedeck_columns/src/timeline/kind.rs @@ -532,7 +532,7 @@ impl TimelineKind { let contact_filter = contacts_filter(pk.bytes()); let results = ndb - .query(txn, &[contact_filter.clone()], 1) + .query(txn, std::slice::from_ref(&contact_filter), 1) .expect("contact query failed?"); let kind_fn = TimelineKind::last_per_pubkey; @@ -681,7 +681,7 @@ fn contact_filter_state(txn: &Transaction, ndb: &Ndb, pk: &Pubkey) -> FilterStat let contact_filter = contacts_filter(pk); let results = ndb - .query(txn, &[contact_filter.clone()], 1) + .query(txn, std::slice::from_ref(&contact_filter), 1) .expect("contact query failed?"); if results.is_empty() { @@ -706,7 +706,7 @@ fn last_per_pubkey_filter_state(ndb: &Ndb, pk: &Pubkey) -> FilterState { let txn = Transaction::new(ndb).expect("txn"); let results = ndb - .query(&txn, &[contact_filter.clone()], 1) + .query(&txn, std::slice::from_ref(&contact_filter), 1) .expect("contact query failed?"); if results.is_empty() { diff --git a/crates/notedeck_columns/src/ui/relay.rs b/crates/notedeck_columns/src/ui/relay.rs @@ -274,7 +274,7 @@ struct RelayInfo<'a> { pub status: RelayStatus, } -fn get_relay_infos(pool: &RelayPool) -> Vec<RelayInfo> { +fn get_relay_infos(pool: &RelayPool) -> Vec<RelayInfo<'_>> { pool.relays .iter() .map(|relay| RelayInfo { diff --git a/crates/notedeck_columns/src/ui/wallet.rs b/crates/notedeck_columns/src/ui/wallet.rs @@ -30,7 +30,7 @@ pub enum DefaultZapState<'a> { Valid(&'a Msats), // in milisats } -pub fn get_default_zap_state(default_zap: &mut DefaultZapMsats) -> DefaultZapState { +pub fn get_default_zap_state(default_zap: &mut DefaultZapMsats) -> DefaultZapState<'_> { if default_zap.pending.is_rewriting { return DefaultZapState::Pending(&mut default_zap.pending); } diff --git a/crates/notedeck_ui/src/note/media.rs b/crates/notedeck_ui/src/note/media.rs @@ -781,7 +781,7 @@ impl<'a> ScaledTexture<'a> { } } - pub fn get_image(&self) -> Image { + pub fn get_image(&self) -> Image<'_> { texture_to_image(self.tex, self.size).fit_to_exact_size(self.scaled_size) } }