diff --git a/shared/tree-sitter-extractor/src/autobuilder.rs b/shared/tree-sitter-extractor/src/autobuilder.rs index a6d4a6852e25..97ea5a9b32cc 100644 --- a/shared/tree-sitter-extractor/src/autobuilder.rs +++ b/shared/tree-sitter-extractor/src/autobuilder.rs @@ -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![], @@ -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 } diff --git a/shared/tree-sitter-extractor/src/generator/mod.rs b/shared/tree-sitter-extractor/src/generator/mod.rs index d8737f789cca..0d01deae57fa 100644 --- a/shared/tree-sitter-extractor/src/generator/mod.rs +++ b/shared/tree-sitter-extractor/src/generator/mod.rs @@ -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( @@ -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( diff --git a/shared/tree-sitter-extractor/src/generator/prefix.dbscheme b/shared/tree-sitter-extractor/src/generator/prefix.dbscheme index 4bbfc8a09318..fbfee0725245 100644 --- a/shared/tree-sitter-extractor/src/generator/prefix.dbscheme +++ b/shared/tree-sitter-extractor/src/generator/prefix.dbscheme @@ -98,4 +98,3 @@ yaml_locations(unique int locatable: @yaml_locatable ref, int location: @location_default ref); @yaml_locatable = @yaml_node | @yaml_error; -