aboutsummaryrefslogtreecommitdiff
path: root/helix-lsp/src/client.rs
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-03-11 04:19:53 +0000
committerBlaž Hrastnik2021-03-16 14:03:29 +0000
commit15f142bc4b79aa0ef60bea3f0faa2dc49b73505b (patch)
treefea00a6b500d317729626f3ce0287938537b762e /helix-lsp/src/client.rs
parent857763c52e69de5c3b5a8ef62b78d5ca8cbe3727 (diff)
lsp: Use into_iter->map->collect instead of manual loop.
Diffstat (limited to 'helix-lsp/src/client.rs')
-rw-r--r--helix-lsp/src/client.rs20
1 files changed, 8 insertions, 12 deletions
diff --git a/helix-lsp/src/client.rs b/helix-lsp/src/client.rs
index 1b67e215..97e5cfad 100644
--- a/helix-lsp/src/client.rs
+++ b/helix-lsp/src/client.rs
@@ -610,18 +610,14 @@ impl Client {
let items = match response {
Some(lsp::GotoDefinitionResponse::Scalar(location)) => vec![location],
- Some(lsp::GotoDefinitionResponse::Array(location_vec)) => location_vec,
- Some(lsp::GotoDefinitionResponse::Link(location_link_vec)) => {
- let mut location_vec: Vec<lsp::Location> = Vec::new();
- location_link_vec.into_iter().for_each(|location_link| {
- let link = lsp::Location {
- uri: location_link.target_uri,
- range: location_link.target_range,
- };
- location_vec.push(link)
- });
- location_vec
- }
+ Some(lsp::GotoDefinitionResponse::Array(locations)) => locations,
+ Some(lsp::GotoDefinitionResponse::Link(locations)) => locations
+ .into_iter()
+ .map(|location_link| lsp::Location {
+ uri: location_link.target_uri,
+ range: location_link.target_range,
+ })
+ .collect(),
None => Vec::new(),
};