Skip to content

Commit

Permalink
Tree-sitter-xtractor: fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
aibaars committed May 22, 2023
1 parent 5e279f2 commit 2416568
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
8 changes: 4 additions & 4 deletions shared/tree-sitter-extractor/src/autobuilder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ impl Autobuilder {
pub fn new(language: &str, database: PathBuf) -> Self {
Self {
language: language.to_string(),
database: database,
database,
include_extensions: vec![],
include_globs: vec![],
exclude_globs: vec![],
Expand All @@ -24,17 +24,17 @@ impl Autobuilder {
}

pub fn include_extensions(&mut self, exts: &[&str]) -> &mut Self {
self.include_extensions = exts.into_iter().map(|s| String::from(*s)).collect();
self.include_extensions = exts.iter().map(|s| String::from(*s)).collect();
self
}

pub fn include_globs(&mut self, globs: &[&str]) -> &mut Self {
self.include_globs = globs.into_iter().map(|s| String::from(*s)).collect();
self.include_globs = globs.iter().map(|s| String::from(*s)).collect();
self
}

pub fn exclude_globs(&mut self, globs: &[&str]) -> &mut Self {
self.exclude_globs = globs.into_iter().map(|s| String::from(*s)).collect();
self.exclude_globs = globs.iter().map(|s| String::from(*s)).collect();
self
}

Expand Down
12 changes: 6 additions & 6 deletions shared/tree-sitter-extractor/src/generator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,22 @@ pub fn generate(
e
})?;
let mut dbscheme_writer = LineWriter::new(dbscheme_file);
write!(
writeln!(
dbscheme_writer,
"// CodeQL database schema for {}\n\
// Automatically generated from the tree-sitter grammar; do not edit\n\n",
// Automatically generated from the tree-sitter grammar; do not edit\n",
languages[0].name
)?;

write!(dbscheme_writer, include_str!("prefix.dbscheme"))?;
writeln!(dbscheme_writer, include_str!("prefix.dbscheme"))?;

let mut ql_writer = LineWriter::new(File::create(ql_library_path)?);
write!(
writeln!(
ql_writer,
"/**\n\
* CodeQL library for {}
* Automatically generated from the tree-sitter grammar; do not edit\n\
*/\n\n",
*/\n",
languages[0].name
)?;
ql::write(
Expand All @@ -60,7 +60,7 @@ pub fn generate(
let nodes = node_types::read_node_types_str(&prefix, language.node_types)?;
let (dbscheme_entries, mut ast_node_members, token_kinds) = convert_nodes(&nodes);
ast_node_members.insert(&token_name);
write!(&mut dbscheme_writer, "/*- {} dbscheme -*/\n", language.name)?;
writeln!(&mut dbscheme_writer, "/*- {} dbscheme -*/", language.name)?;
dbscheme::write(&mut dbscheme_writer, &dbscheme_entries)?;
let token_case = create_token_case(&token_name, token_kinds);
dbscheme::write(
Expand Down
1 change: 0 additions & 1 deletion shared/tree-sitter-extractor/src/generator/prefix.dbscheme
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,3 @@ yaml_locations(unique int locatable: @yaml_locatable ref,
int location: @location_default ref);

@yaml_locatable = @yaml_node | @yaml_error;

0 comments on commit 2416568

Please sign in to comment.