Skip to content

Commit

Permalink
clippy, fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Schottkyc137 committed Sep 9, 2023
1 parent 1527b1f commit b77b93b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
14 changes: 10 additions & 4 deletions vhdl_lang/src/analysis/completion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,9 @@ impl DesignRoot {
/// List the name of all primary units for a given library.
/// If the library is non-resolvable, list an empty vector
fn list_primaries_for_lib(&self, lib: &Symbol) -> Vec<String> {
let Some(lib) = self.get_library_units(lib) else { return vec![]; };
let Some(lib) = self.get_library_units(lib) else {
return vec![];
};
lib.keys()
.filter_map(|key| match key {
UnitKey::Primary(prim) => Some(prim.name().to_string()),
Expand All @@ -280,16 +282,20 @@ impl DesignRoot {
/// If the library does not exist or there is no primary unit with the given name for that library,
/// return an empty vector
fn list_available_declarations(&self, lib: &Symbol, primary_unit: &Symbol) -> Vec<String> {
let Some(lib) = self.get_library_units(lib) else { return vec![]; };
let Some(unit) = lib.get(&UnitKey::Primary(primary_unit.clone())) else { return vec![]; };
let Some(lib) = self.get_library_units(lib) else {
return vec![];
};
let Some(unit) = lib.get(&UnitKey::Primary(primary_unit.clone())) else {
return vec![];
};
let unit = unit.unit.get();
match unit.unwrap().to_owned() {
AnyDesignUnit::Primary(AnyPrimaryUnit::Package(pkg)) => pkg
.decl
.iter()
.filter_map(declaration_to_string)
.unique()
.chain(vec!["all".to_string()].into_iter())
.chain(vec!["all".to_string()])
.collect_vec(),
_ => Vec::default(),
}
Expand Down
4 changes: 3 additions & 1 deletion vhdl_ls/src/vhdl_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,9 @@ impl VHDLServer {
// 1) get source position, and source file
let Some(source) = self.project.get_source(file) else {
// Do not enable completions for files that are not part of the project
return CompletionList {..Default::default()};
return CompletionList {
..Default::default()
};
};
let cursor = from_lsp_pos(params.text_document_position.position);
// 2) Optimization chance: go to last recognizable token before the cursor. For example:
Expand Down

0 comments on commit b77b93b

Please sign in to comment.