Skip to content

Commit

Permalink
Placate clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
mmarx authored and matzemathics committed Jan 8, 2025
1 parent f98a651 commit f3e6eab
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
14 changes: 7 additions & 7 deletions nemo-language-server/src/language_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ mod token_type;

use nemo::rule_model::translation::ProgramErrorReport;
use std::collections::{BTreeMap, BTreeSet, HashMap};
use std::fmt::Write;
use std::vec;
use strum::IntoEnumIterator;

Expand Down Expand Up @@ -149,11 +150,10 @@ impl Backend {
.note()
.map(|n| format!("\nNote: {n}"))
.unwrap_or("".to_string()),
error
.hints()
.iter()
.map(|h| format!("\nHint: {h}"))
.collect::<String>(),
error.hints().iter().fold(String::new(), |mut acc, h| {
let _ = write!(acc, "\nHint: {h}");
acc
})
);

if let Some(set) = errors_by_posision.get_mut(&range) {
Expand Down Expand Up @@ -607,11 +607,11 @@ fn node_path_deepest_identifier<'a>(
}
}

return info.map(|info| IdentifiedNode {
info.map(|info| IdentifiedNode {
node: info.node,
identifier: info.identifier,
scoping_node: *node_path.first().unwrap(),
});
})
}

/// Finds all children of the given node (potentially the node itself) that match the identifier
Expand Down
15 changes: 7 additions & 8 deletions nemo-language-server/src/language_server/lsp_component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,13 @@ where

kind.map(|kind| LSPSymbolInfo {
kind,
name: format!(
"{}",
self.span()
.fragment()
.split_whitespace()
.collect::<Vec<_>>()
.join(" ")
),
name: self
.span()
.fragment()
.split_whitespace()
.collect::<Vec<_>>()
.join(" ")
.to_string(),
})
}

Expand Down
8 changes: 4 additions & 4 deletions nemo-physical/src/management/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ impl DatabaseInstance {
&self
.table_infos
.get(&id)
.expect("No table with id {id} exists.")
.unwrap_or_else(|| panic!("No table with the id {id} exists."))
.name
}

Expand All @@ -104,7 +104,7 @@ impl DatabaseInstance {
pub fn table_arity(&self, id: PermanentTableId) -> usize {
self.table_infos
.get(&id)
.expect("No table with id {id} exists.")
.unwrap_or_else(|| panic!("No table with the id {id} exists."))
.arity
}

Expand Down Expand Up @@ -146,7 +146,7 @@ impl DatabaseInstance {
let storage_id = self
.reference_manager
.trie_id(&self.dictionary, id, ColumnOrder::default())
.expect("No table with id {id} exists.");
.unwrap_or_else(|err| panic!("No table with the id {id} exists: {err}"));
let trie = self.reference_manager.trie(storage_id);

Ok(trie.row_iterator().map(|values| {
Expand All @@ -168,7 +168,7 @@ impl DatabaseInstance {
let storage_id = self
.reference_manager
.trie_id(&self.dictionary, id, ColumnOrder::default())
.expect("No table with id {id} exists.");
.unwrap_or_else(|err| panic!("No table with the id {id} exists: {err}"));
let trie = self.reference_manager.trie(storage_id);

let dictionary: &Dict = &self.dictionary();
Expand Down
2 changes: 1 addition & 1 deletion nemo-physical/src/management/database/order.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ impl OrderedReferenceManager {
for &storage_id in self
.storage_map
.get(&id)
.expect("No table with the id {id} exists.")
.unwrap_or_else(|| panic!("No table with the id {id} exists."))
.values()
{
result += self.stored_tables[storage_id].size_bytes();
Expand Down
1 change: 1 addition & 0 deletions nemo/src/parser/ast/statement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use super::{
ProgramAST,
};

#[allow(clippy::large_enum_variant)]
/// Types of [Statement]s
#[derive(Debug)]
pub enum StatementKind<'a> {
Expand Down

0 comments on commit f3e6eab

Please sign in to comment.