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);
|
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()
|
||||||
|
|
Loading…
Reference in a new issue