Use a more idiomatic way to convert a HashMap to an Option<HashMap>

This commit is contained in:
Sofía Aritz 2023-03-11 20:51:25 +01:00
parent c92e73328d
commit 482f3f7fb0

View file

@ -235,16 +235,11 @@ impl eframe::App for App {
ui.add_space(10.0); ui.add_space(10.0);
if ui.button("add note").clicked() { if ui.button("add note").clicked() {
// FIXME(sofia@git.sofiaritz.com): Use a more idiomatic way let metadata = self.metadata_buffer.clone()
let metadata = if let Some(metadata) = self.metadata_buffer.clone() { .and_then(|metadata| {
if metadata.is_empty() { (!metadata.is_empty())
None .then_some(metadata)
} else { });
Some(metadata)
}
} else {
None
};
let note = Note::Decrypted { let note = Note::Decrypted {
id: SystemTime::now() id: SystemTime::now()