mirror of
https://github.com/aljazceru/notedeck.git
synced 2025-12-19 01:24:21 +01:00
clippy: fix clippy issues
Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
@@ -32,15 +32,11 @@ impl Keypair {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn to_full<'a>(&'a self) -> Option<FilledKeypair<'a>> {
|
pub fn to_full(&self) -> Option<FilledKeypair<'_>> {
|
||||||
if let Some(secret_key) = &self.secret_key {
|
self.secret_key.as_ref().map(|secret_key| FilledKeypair {
|
||||||
Some(FilledKeypair {
|
|
||||||
pubkey: &self.pubkey,
|
pubkey: &self.pubkey,
|
||||||
secret_key: secret_key,
|
secret_key,
|
||||||
})
|
})
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,7 +70,7 @@ impl FullKeypair {
|
|||||||
FullKeypair { pubkey, secret_key }
|
FullKeypair { pubkey, secret_key }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn to_filled<'a>(&'a self) -> FilledKeypair<'a> {
|
pub fn to_filled(&self) -> FilledKeypair<'_> {
|
||||||
FilledKeypair::new(&self.pubkey, &self.secret_key)
|
FilledKeypair::new(&self.pubkey, &self.secret_key)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,7 +122,7 @@ pub struct SerializableKeypair {
|
|||||||
impl SerializableKeypair {
|
impl SerializableKeypair {
|
||||||
pub fn from_keypair(kp: &Keypair, pass: &str, log_n: u8) -> Self {
|
pub fn from_keypair(kp: &Keypair, pass: &str, log_n: u8) -> Self {
|
||||||
Self {
|
Self {
|
||||||
pubkey: kp.pubkey.clone(),
|
pubkey: kp.pubkey,
|
||||||
encrypted_secret_key: kp.secret_key.clone().and_then(|s| {
|
encrypted_secret_key: kp.secret_key.clone().and_then(|s| {
|
||||||
EncryptedSecretKey::new(&s, pass, log_n, nostr::nips::nip49::KeySecurity::Weak).ok()
|
EncryptedSecretKey::new(&s, pass, log_n, nostr::nips::nip49::KeySecurity::Weak).ok()
|
||||||
}),
|
}),
|
||||||
@@ -135,7 +131,7 @@ impl SerializableKeypair {
|
|||||||
|
|
||||||
pub fn to_keypair(&self, pass: &str) -> Keypair {
|
pub fn to_keypair(&self, pass: &str) -> Keypair {
|
||||||
Keypair::new(
|
Keypair::new(
|
||||||
self.pubkey.clone(),
|
self.pubkey,
|
||||||
self.encrypted_secret_key
|
self.encrypted_secret_key
|
||||||
.and_then(|e| e.to_secret_key(pass).ok()),
|
.and_then(|e| e.to_secret_key(pass).ok()),
|
||||||
)
|
)
|
||||||
|
|||||||
11
src/args.rs
11
src/args.rs
@@ -245,12 +245,7 @@ impl ArgColumn {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::{
|
use crate::app::Damus;
|
||||||
app::Damus,
|
|
||||||
result::Result,
|
|
||||||
storage::{delete_file, write_file, Directory},
|
|
||||||
Error,
|
|
||||||
};
|
|
||||||
|
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
@@ -262,7 +257,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn rmrf(path: impl AsRef<Path>) {
|
fn rmrf(path: impl AsRef<Path>) {
|
||||||
std::fs::remove_dir_all(path);
|
let _ = std::fs::remove_dir_all(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Ensure dbpath actually sets the dbpath correctly.
|
/// Ensure dbpath actually sets the dbpath correctly.
|
||||||
@@ -281,7 +276,7 @@ mod tests {
|
|||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let ctx = egui::Context::default();
|
let ctx = egui::Context::default();
|
||||||
let app = Damus::new(&ctx, &datapath, args);
|
let _app = Damus::new(&ctx, &datapath, args);
|
||||||
|
|
||||||
assert!(Path::new(&dbpath.join("data.mdb")).exists());
|
assert!(Path::new(&dbpath.join("data.mdb")).exists());
|
||||||
assert!(Path::new(&dbpath.join("lock.mdb")).exists());
|
assert!(Path::new(&dbpath.join("lock.mdb")).exists());
|
||||||
|
|||||||
Reference in New Issue
Block a user