clippy: fix lint errors

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2025-08-19 09:45:36 -07:00
parent 9ef72ec7de
commit 3aa4d00053
18 changed files with 25 additions and 24 deletions

View File

@@ -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 {

View File

@@ -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)

View File

@@ -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)

View File

@@ -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}");
}
}

View File

@@ -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()

View File

@@ -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))

View File

@@ -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(),