diff options
author | Skyler Hawthorne | 2022-09-21 22:34:56 +0000 |
---|---|---|
committer | Skyler Hawthorne | 2022-10-19 02:31:39 +0000 |
commit | 31d1bbfddb112a1e38cf974793afc427a3614ecf (patch) | |
tree | 13f95349262b8451ba8684fada0e75c546871c56 /helix-term | |
parent | 9e64974f13e91470be7b411285b7a33c698da3aa (diff) |
review comments
Diffstat (limited to 'helix-term')
-rw-r--r-- | helix-term/src/application.rs | 35 | ||||
-rw-r--r-- | helix-term/src/commands/typed.rs | 2 |
2 files changed, 19 insertions, 18 deletions
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs index 4fde2a66..694c55c0 100644 --- a/helix-term/src/application.rs +++ b/helix-term/src/application.rs @@ -427,24 +427,25 @@ impl Application { } pub fn handle_document_write(&mut self, doc_save_event: DocumentSavedEventResult) { - if let Err(err) = doc_save_event { - self.editor.set_error(err.to_string()); - return; - } - - let doc_save_event = doc_save_event.unwrap(); - let doc = self.editor.document_mut(doc_save_event.doc_id); - - if doc.is_none() { - warn!( - "received document saved event for non-existent doc id: {}", - doc_save_event.doc_id - ); + let doc_save_event = match doc_save_event { + Ok(event) => event, + Err(err) => { + self.editor.set_error(err.to_string()); + return; + } + }; - return; - } + let doc = match self.editor.document_mut(doc_save_event.doc_id) { + None => { + warn!( + "received document saved event for non-existent doc id: {}", + doc_save_event.doc_id + ); - let doc = doc.unwrap(); + return; + } + Some(doc) => doc, + }; debug!( "document {:?} saved with revision {}", @@ -472,7 +473,7 @@ impl Application { let loader = self.editor.syn_loader.clone(); // borrowing the same doc again to get around the borrow checker - let doc = self.editor.document_mut(doc_save_event.doc_id).unwrap(); + let doc = doc_mut!(self.editor, &doc_save_event.doc_id); let id = doc.id(); doc.detect_language(loader); let _ = self.editor.refresh_language_server(id); diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index d312c45f..070215cb 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -21,7 +21,7 @@ pub struct TypableCommand { } fn quit(cx: &mut compositor::Context, args: &[Cow<str>], event: PromptEvent) -> anyhow::Result<()> { - log::info!("quitting..."); + log::debug!("quitting..."); if event != PromptEvent::Validate { return Ok(()); |