mirror of
https://github.com/helix-editor/helix.git
synced 2025-01-19 21:47:07 +04:00
lsp: Use into_iter->map->collect instead of manual loop.
This commit is contained in:
parent
857763c52e
commit
15f142bc4b
@ -610,18 +610,14 @@ async fn goto_request<
|
|||||||
|
|
||||||
let items = match response {
|
let items = match response {
|
||||||
Some(lsp::GotoDefinitionResponse::Scalar(location)) => vec![location],
|
Some(lsp::GotoDefinitionResponse::Scalar(location)) => vec![location],
|
||||||
Some(lsp::GotoDefinitionResponse::Array(location_vec)) => location_vec,
|
Some(lsp::GotoDefinitionResponse::Array(locations)) => locations,
|
||||||
Some(lsp::GotoDefinitionResponse::Link(location_link_vec)) => {
|
Some(lsp::GotoDefinitionResponse::Link(locations)) => locations
|
||||||
let mut location_vec: Vec<lsp::Location> = Vec::new();
|
.into_iter()
|
||||||
location_link_vec.into_iter().for_each(|location_link| {
|
.map(|location_link| lsp::Location {
|
||||||
let link = lsp::Location {
|
uri: location_link.target_uri,
|
||||||
uri: location_link.target_uri,
|
range: location_link.target_range,
|
||||||
range: location_link.target_range,
|
})
|
||||||
};
|
.collect(),
|
||||||
location_vec.push(link)
|
|
||||||
});
|
|
||||||
location_vec
|
|
||||||
}
|
|
||||||
None => Vec::new(),
|
None => Vec::new(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user