Small cleanup

This commit is contained in:
daa84 2017-03-09 16:18:13 +03:00
parent 35d2dd1868
commit 75e28ceedb
2 changed files with 5 additions and 7 deletions

View File

@ -67,7 +67,6 @@ macro_rules! try_uint {
pub fn initialize(ui: &mut Ui, nvim_bin_path: Option<&String>) -> Result<()> {
let session = if let Some(path) = nvim_bin_path {
println!("{}", path);
Session::new_child_path(path)?
} else {
Session::new_child()?
@ -193,14 +192,13 @@ fn safe_call<F>(cb: F)
}
pub trait ErrorReport {
fn report_err(&self, nvim: &mut NeovimApi, ctx_msg: &str);
fn report_err(&self, nvim: &mut NeovimApi);
}
impl<T> ErrorReport for result::Result<T, String> {
fn report_err(&self, _: &mut NeovimApi, ctx_msg: &str) {
fn report_err(&self, _: &mut NeovimApi) {
if let &Err(ref msg) = self {
let err_msg = format!("{} {}", ctx_msg, msg);
println!("{}", err_msg);
println!("{}", msg);
//nvim.report_error(&err_msg).expect("Error report error :)");
}
}

View File

@ -204,7 +204,7 @@ fn edit_paste() {
};
let mut nvim = ui.nvim();
nvim.input(paste_command).report_err(nvim, "Error paste from clipboard");
nvim.input(paste_command).report_err(nvim);
});
}
@ -213,7 +213,7 @@ fn edit_save_all() {
let mut ui = ui_cell.borrow_mut();
let mut nvim = ui.nvim();
nvim.command(":wa").report_err(nvim, "Error save all files");
nvim.command(":wa").report_err(nvim);
});
}