Use a more idiomatic way to convert a HashMap
to an Option<HashMap>
This commit is contained in:
parent
c92e73328d
commit
482f3f7fb0
1 changed files with 5 additions and 10 deletions
15
src/main.rs
15
src/main.rs
|
@ -235,16 +235,11 @@ impl eframe::App for App {
|
|||
|
||||
ui.add_space(10.0);
|
||||
if ui.button("add note").clicked() {
|
||||
// FIXME(sofia@git.sofiaritz.com): Use a more idiomatic way
|
||||
let metadata = if let Some(metadata) = self.metadata_buffer.clone() {
|
||||
if metadata.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(metadata)
|
||||
}
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let metadata = self.metadata_buffer.clone()
|
||||
.and_then(|metadata| {
|
||||
(!metadata.is_empty())
|
||||
.then_some(metadata)
|
||||
});
|
||||
|
||||
let note = Note::Decrypted {
|
||||
id: SystemTime::now()
|
||||
|
|
Loading…
Reference in a new issue