Skip to content

Commit 3b9df41

Browse files
committed
Fix 1.66 clippy warnings
1 parent 8676356 commit 3b9df41

File tree

5 files changed

+9
-23
lines changed

5 files changed

+9
-23
lines changed

vhdl_lang/src/analysis/analyze.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -225,16 +225,9 @@ impl<'a> AnalyzeContext<'a> {
225225
let units = self.root.get_library_units(self.work_library_name())?;
226226

227227
let name = self.current_unit.primary_name();
228-
229-
if let Some(unit) = units.get(&UnitKey::Secondary(name.clone(), name.clone())) {
230-
if unit.kind() == AnyKind::Secondary(SecondaryKind::PackageBody) {
231-
Some(unit)
232-
} else {
233-
None
234-
}
235-
} else {
236-
None
237-
}
228+
units
229+
.get(&UnitKey::Secondary(name.clone(), name.clone()))
230+
.filter(|&unit| unit.kind() == AnyKind::Secondary(SecondaryKind::PackageBody))
238231
}
239232

240233
pub fn has_package_body(&self) -> bool {

vhdl_lang/src/analysis/visibility.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@ impl<'a> Visible<'a> {
185185
) -> Result<Option<NamedEntities>, Diagnostic> {
186186
let mut named_entities: Vec<_> = self
187187
.visible_entities
188-
.iter()
189-
.map(|(_, ent)| ent.entity.clone())
188+
.values()
189+
.map(|ent| ent.entity.clone())
190190
.collect();
191191

192192
if named_entities.is_empty() {

vhdl_lang/src/data/source.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ impl Source {
178178
}
179179

180180
/// A lexical position (line, column) in a source.
181-
#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash, Debug)]
181+
#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash, Debug, Default)]
182182
pub struct Position {
183183
/// Line (zero-based).
184184
pub line: u32,
@@ -187,13 +187,6 @@ pub struct Position {
187187
}
188188

189189
impl Position {
190-
pub fn default() -> Position {
191-
Position {
192-
line: 0,
193-
character: 0,
194-
}
195-
}
196-
197190
pub fn new(line: u32, character: u32) -> Position {
198191
Position { line, character }
199192
}

vhdl_lang/src/syntax/tokens/tokenstream.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl<'a> TokenStream<'a> {
6868
Err(self
6969
.tokenizer
7070
.eof_error()
71-
.when(&format!("expecting {}", kinds_str(&[kind]))))
71+
.when(format!("expecting {}", kinds_str(&[kind]))))
7272
}
7373
}
7474

vhdl_ls/src/vhdl_server.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,8 +456,8 @@ fn srcpos_to_location(pos: &SrcPos) -> Location {
456456

457457
fn from_lsp_pos(position: lsp_types::Position) -> vhdl_lang::Position {
458458
vhdl_lang::Position {
459-
line: position.line as u32,
460-
character: position.character as u32,
459+
line: position.line,
460+
character: position.character,
461461
}
462462
}
463463

0 commit comments

Comments
 (0)