[Auto] bin/core/notes: Fix Clippy warnings

Signed-off-by: flip1995 <hello@philkrones.com>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
flip1995 2019-08-27 10:43:49 +02:00 committed by Matthias Beyer
parent 419a5ffa77
commit e0e4d4e720

View file

@ -106,17 +106,17 @@ fn create(rt: &Runtime) {
.map_err_trace_exit_unwrap(); .map_err_trace_exit_unwrap();
if rt.cli().subcommand_matches("create").unwrap().is_present("edit") { if rt.cli().subcommand_matches("create").unwrap().is_present("edit") {
let _ = note note
.edit_content(rt) .edit_content(rt)
.map_warn_err_str("Editing failed") .map_warn_err_str("Editing failed")
.map_err_trace_exit_unwrap(); .map_err_trace_exit_unwrap();
} }
let _ = rt.report_touched(note.get_location()).unwrap_or_exit(); rt.report_touched(note.get_location()).unwrap_or_exit();
} }
fn delete(rt: &Runtime) { fn delete(rt: &Runtime) {
let _ = rt.store() rt.store()
.delete_note(name_from_cli(rt, "delete")) .delete_note(name_from_cli(rt, "delete"))
.map_info_str("Ok") .map_info_str("Ok")
.map_err_trace_exit_unwrap(); .map_err_trace_exit_unwrap();
@ -124,17 +124,17 @@ fn delete(rt: &Runtime) {
fn edit(rt: &Runtime) { fn edit(rt: &Runtime) {
let name = name_from_cli(rt, "edit"); let name = name_from_cli(rt, "edit");
let _ = rt rt
.store() .store()
.get_note(name.clone()) .get_note(name.clone())
.map_err_trace_exit_unwrap() .map_err_trace_exit_unwrap()
.map(|mut note| { .map(|mut note| {
let _ = note note
.edit_content(rt) .edit_content(rt)
.map_warn_err_str("Editing failed") .map_warn_err_str("Editing failed")
.map_err_trace_exit_unwrap(); .map_err_trace_exit_unwrap();
let _ = rt.report_touched(note.get_location()).unwrap_or_exit(); rt.report_touched(note.get_location()).unwrap_or_exit();
}) })
.unwrap_or_else(|| { .unwrap_or_else(|| {
error!("Cannot find note with name '{}'", name); error!("Cannot find note with name '{}'", name);
@ -144,7 +144,7 @@ fn edit(rt: &Runtime) {
fn list(rt: &Runtime) { fn list(rt: &Runtime) {
use std::cmp::Ordering; use std::cmp::Ordering;
let _ = rt rt
.store() .store()
.all_notes() .all_notes()
.map_err_trace_exit_unwrap() .map_err_trace_exit_unwrap()
@ -155,17 +155,17 @@ fn list(rt: &Runtime) {
exit(1) exit(1)
})) }))
.sorted_by(|note_a, note_b| if let (Ok(a), Ok(b)) = (note_a.get_name(), note_b.get_name()) { .sorted_by(|note_a, note_b| if let (Ok(a), Ok(b)) = (note_a.get_name(), note_b.get_name()) {
return a.cmp(&b) a.cmp(&b)
} else { } else {
return Ordering::Greater; Ordering::Greater
}) })
.for_each(|note| { .for_each(|note| {
let name = note.get_name().map_err_trace_exit_unwrap(); let name = note.get_name().map_err_trace_exit_unwrap();
let _ = writeln!(rt.stdout(), "{}", name) writeln!(rt.stdout(), "{}", name)
.to_exit_code() .to_exit_code()
.unwrap_or_exit(); .unwrap_or_exit();
let _ = rt.report_touched(note.get_location()).unwrap_or_exit(); rt.report_touched(note.get_location()).unwrap_or_exit();
}); });
} }