Skip to content

Commit 0a4d7dc

Browse files
committed
Fix minor things
1 parent dc6e6d2 commit 0a4d7dc

File tree

3 files changed

+20
-21
lines changed

3 files changed

+20
-21
lines changed

crates/ide/src/file_structure.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ fn structure_node(node: &SyntaxNode, config: &FileStructureConfig) -> Option<Str
213213
detail: it.ty().map(|ty| ty.to_string()),
214214
deprecated: false,
215215
};
216-
217216
Some(node)
218217
},
219218
ast::ExternBlock(it) => {

crates/rust-analyzer/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3083,7 +3083,7 @@ macro_rules! _config_data {
30833083
}) => {
30843084
/// Default config values for this grouping.
30853085
#[allow(non_snake_case)]
3086-
#[derive(Debug, Clone )]
3086+
#[derive(Debug, Clone)]
30873087
struct $name { $($field: $ty,)* }
30883088

30893089
impl_for_config_data!{

crates/rust-analyzer/src/handlers/request.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ pub(crate) fn handle_document_symbol(
567567
let file_id = try_default!(from_proto::file_id(&snap, &params.text_document.uri)?);
568568
let line_index = snap.file_line_index(file_id)?;
569569

570-
let mut parents: Vec<(lsp_types::DocumentSymbol, Option<usize>)> = Vec::new();
570+
let mut symbols: Vec<(lsp_types::DocumentSymbol, Option<usize>)> = Vec::new();
571571

572572
let config = snap.config.document_symbol(None);
573573

@@ -576,38 +576,38 @@ pub(crate) fn handle_document_symbol(
576576
file_id,
577577
)?;
578578

579-
for symbol in structure_nodes {
579+
for node in structure_nodes {
580580
let mut tags = Vec::new();
581-
if symbol.deprecated {
581+
if node.deprecated {
582582
tags.push(SymbolTag::DEPRECATED)
583583
};
584584

585585
#[allow(deprecated)]
586-
let doc_symbol = lsp_types::DocumentSymbol {
587-
name: symbol.label,
588-
detail: symbol.detail,
589-
kind: to_proto::structure_node_kind(symbol.kind),
586+
let symbol = lsp_types::DocumentSymbol {
587+
name: node.label,
588+
detail: node.detail,
589+
kind: to_proto::structure_node_kind(node.kind),
590590
tags: Some(tags),
591-
deprecated: Some(symbol.deprecated),
592-
range: to_proto::range(&line_index, symbol.node_range),
593-
selection_range: to_proto::range(&line_index, symbol.navigation_range),
591+
deprecated: Some(node.deprecated),
592+
range: to_proto::range(&line_index, node.node_range),
593+
selection_range: to_proto::range(&line_index, node.navigation_range),
594594
children: None,
595595
};
596-
parents.push((doc_symbol, symbol.parent));
596+
symbols.push((symbol, node.parent));
597597
}
598598

599-
// Builds hierarchy from a flat list, in reverse order (so that indices make sense)
599+
// Builds hierarchy from a flat list, in reverse order (so that the indices make sense)
600600
let document_symbols = {
601601
let mut acc = Vec::new();
602-
while let Some((mut node, parent_idx)) = parents.pop() {
603-
if let Some(children) = &mut node.children {
602+
while let Some((mut symbol, parent_idx)) = symbols.pop() {
603+
if let Some(children) = &mut symbol.children {
604604
children.reverse();
605605
}
606606
let parent = match parent_idx {
607607
None => &mut acc,
608-
Some(i) => parents[i].0.children.get_or_insert_with(Vec::new),
608+
Some(i) => symbols[i].0.children.get_or_insert_with(Vec::new),
609609
};
610-
parent.push(node);
610+
parent.push(symbol);
611611
}
612612
acc.reverse();
613613
acc
@@ -617,7 +617,7 @@ pub(crate) fn handle_document_symbol(
617617
document_symbols.into()
618618
} else {
619619
let url = to_proto::url(&snap, file_id);
620-
let mut symbol_information = Vec::<SymbolInformation>::new();
620+
let mut symbol_information = Vec::new();
621621
for symbol in document_symbols {
622622
flatten_document_symbol(&symbol, None, &url, &mut symbol_information);
623623
}
@@ -654,7 +654,7 @@ pub(crate) fn handle_workspace_symbol(
654654
let _p = tracing::info_span!("handle_workspace_symbol").entered();
655655

656656
let config = snap.config.workspace_symbol(None);
657-
let (all_symbols, libs) = decide_search_scope_and_kind(&params, &config);
657+
let (all_symbols, libs) = decide_search_kind_and_scope(&params, &config);
658658

659659
let query = {
660660
let query: String = params.query.chars().filter(|&c| c != '#' && c != '*').collect();
@@ -677,7 +677,7 @@ pub(crate) fn handle_workspace_symbol(
677677

678678
return Ok(Some(lsp_types::WorkspaceSymbolResponse::Nested(res)));
679679

680-
fn decide_search_scope_and_kind(
680+
fn decide_search_kind_and_scope(
681681
params: &WorkspaceSymbolParams,
682682
config: &WorkspaceSymbolConfig,
683683
) -> (bool, bool) {

0 commit comments

Comments
 (0)