1
0
This commit is contained in:
Jeff 2023-10-30 15:48:43 -04:00
parent c721164d99
commit b6b427b2f2
9 changed files with 10 additions and 10 deletions

View File

@ -2,7 +2,7 @@ fn main() {
let src_dir = std::path::Path::new("tree-sitter-dust/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")

View File

@ -65,7 +65,7 @@ impl AbstractTree for IfElse {
} else {
let expressions = &self.else_if_expressions;
for (index, expression) in expressions.into_iter().enumerate() {
for (index, expression) in expressions.iter().enumerate() {
let if_boolean = expression.run(source, context)?.as_boolean()?;
if if_boolean {

View File

@ -63,7 +63,7 @@ impl AbstractTree for Index {
Ok(Value::String(item.to_string()))
}
_ => return Err(Error::ExpectedCollection { actual: value }),
_ => Err(Error::ExpectedCollection { actual: value }),
}
}
}

View File

@ -56,7 +56,7 @@ impl AbstractTree for Select {
fn run(&self, source: &str, context: &mut Map) -> Result<Value> {
let value = self.expression.run(source, context)?;
let old_table = value.as_table()?;
let column_names = if self.identifiers.len() > 0 {
let column_names = if !self.identifiers.is_empty() {
self.identifiers
.iter()
.cloned()

View File

@ -604,7 +604,7 @@ impl AbstractTree for Tool {
.headers()
.iter()
.cloned()
.map(|column_name| Value::String(column_name))
.map(Value::String)
.collect();
Ok(Value::List(List::with_items(column_names)))

View File

@ -32,7 +32,7 @@ pub fn language() -> Language {
/// 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!("../tree-sitter-dust/src/node-types.json");
pub const NODE_TYPES: &str = include_str!("../tree-sitter-dust/src/node-types.json");
// Uncomment these to include any queries that this grammar contains

View File

@ -105,12 +105,12 @@ impl PartialOrd for Map {
impl Display for Map {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
write!(f, "{{\n")?;
writeln!(f, "{{")?;
let variables = self.variables.read().unwrap().clone().into_iter();
for (key, value) in variables {
write!(f, " {key} = {value}\n")?;
writeln!(f, " {key} = {value}")?;
}
write!(f, "}}")
}

View File

@ -154,7 +154,7 @@ impl Display for Table {
string.push_str(&value.to_string());
}
string.push_str(")");
string.push(')');
string
}

View File

@ -65,7 +65,7 @@ impl Display for ValueType {
ValueType::Boolean => write!(f, "boolean"),
ValueType::List(list) => {
write!(f, "(")?;
for (index, item) in list.into_iter().enumerate() {
for (index, item) in list.iter().enumerate() {
if index > 0 {
write!(f, ", ")?;
}