summaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-09-02 02:28:40 +0000
committerBlaž Hrastnik2021-09-06 06:25:46 +0000
commitdc7799b980826ffe33ed635968def79daf20bd10 (patch)
tree2011ba44c63b981a5cad3aebacc0aa467337c70c /helix-term
parent63e191ea3b2ce116c39a446b8fab10a360fd8a33 (diff)
lsp: Refactor code that could use document_by_path_mut
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/application.rs11
1 files changed, 3 insertions, 8 deletions
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs
index 8241ce3a..d3b65a4f 100644
--- a/helix-term/src/application.rs
+++ b/helix-term/src/application.rs
@@ -276,15 +276,10 @@ impl Application {
match notification {
Notification::PublishDiagnostics(params) => {
- let path = Some(params.uri.to_file_path().unwrap());
+ let path = params.uri.to_file_path().unwrap();
+ let doc = self.editor.document_by_path_mut(&path);
- let doc = self
- .editor
- .documents
- .iter_mut()
- .find(|(_, doc)| doc.path() == path.as_ref());
-
- if let Some((_, doc)) = doc {
+ if let Some(doc) = doc {
let text = doc.text();
let diagnostics = params