Rust/Ruby/Python: apply clippy lints

This commit is contained in:
Paolo Tranquilli
2025-02-25 13:21:28 +01:00
parent 6089a75262
commit 1bcc6ddb32
11 changed files with 48 additions and 44 deletions

View File

@@ -19,7 +19,7 @@ use tree_sitter_graph::Variables;
use tree_sitter_graph::ast::File;
use tree_sitter_graph::functions::Functions;
const BUILD_VERSION: &'static str = env!("CARGO_PKG_VERSION");
const BUILD_VERSION: &str = env!("CARGO_PKG_VERSION");
pub mod extra_functions {
use tree_sitter_graph::functions::{Function, Parameters};
@@ -331,7 +331,7 @@ pub mod extra_functions {
None => {
return Err(ExecutionError::FunctionFailed(
"unnamed-child-index".into(),
format!("Cannot call child-index on the root node"),
"Cannot call child-index on the root node".to_string(),
));
}
};
@@ -342,7 +342,7 @@ pub mod extra_functions {
.ok_or_else(|| {
ExecutionError::FunctionFailed(
"unnamed-child-index".into(),
format!("Called child-index on a non-named child"),
"Called child-index on a non-named child".to_string(),
)
})?;
Ok(Value::Integer(index as u32))
@@ -400,7 +400,7 @@ pub mod extra_functions {
let parent = node.parent().ok_or_else(|| {
ExecutionError::FunctionFailed(
"get-parent".into(),
format!("Cannot call get-parent on the root node"),
"Cannot call get-parent on the root node".to_string(),
)
})?;
Ok(Value::SyntaxNode(graph.add_syntax_node(parent)))

View File

@@ -5,7 +5,7 @@ fn main() {
let src_dir = Path::new("src");
let mut c_config = cc::Build::new();
c_config.include(&src_dir);
c_config.include(src_dir);
c_config
.flag_if_supported("-Wno-unused-parameter")
.flag_if_supported("-Wno-unused-but-set-variable")
@@ -17,7 +17,7 @@ fn main() {
let mut cpp_config = cc::Build::new();
cpp_config.cpp(true);
cpp_config.include(&src_dir);
cpp_config.include(src_dir);
cpp_config
.flag_if_supported("-Wno-unused-parameter")
.flag_if_supported("-Wno-unused-but-set-variable");

View File

@@ -43,18 +43,18 @@ pub fn language() -> Language {
}
/// The source of the Python tree-sitter grammar description.
pub const GRAMMAR: &'static str = include_str!("../../grammar.js");
pub const GRAMMAR: &str = include_str!("../../grammar.js");
/// The syntax highlighting query for this language.
pub const HIGHLIGHT_QUERY: &'static str = include_str!("../../queries/highlights.scm");
pub const HIGHLIGHT_QUERY: &str = include_str!("../../queries/highlights.scm");
/// The content of the [`node-types.json`][] file for this grammar.
///
/// [`node-types.json`]: https://tree-sitter.github.io/tree-sitter/using-parsers#static-node-types
pub const NODE_TYPES: &'static str = include_str!("../../src/node-types.json");
pub const NODE_TYPES: &str = include_str!("../../src/node-types.json");
/// The symbol tagging query for this language.
pub const TAGGING_QUERY: &'static str = include_str!("../../queries/tags.scm");
pub const TAGGING_QUERY: &str = include_str!("../../queries/tags.scm");
#[cfg(test)]
mod tests {