Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fcf2d4c

Browse files
aibaarsnickrolfe
andauthored
Apply suggestions from code review
Co-authored-by: Nick Rolfe <[email protected]>
1 parent dacd3f3 commit fcf2d4c

3 files changed

Lines changed: 17 additions & 5 deletions

File tree

extractor/src/main.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,15 @@ fn main() -> std::io::Result<()> {
166166
let mut trap_file = BufWriter::new(trap_file);
167167
match trap_compression {
168168
TrapCompression::None => {
169-
if erb_trap.is_some() {
170-
write!(trap_file, "{}", erb_trap.unwrap())?;
169+
if let Some(erb_trap) = erb_trap {
170+
write!(trap_file, "{}", erb_trap)?;
171171
}
172172
write!(trap_file, "{}", trap)
173173
}
174174
TrapCompression::Gzip => {
175175
let mut compressed_writer = GzEncoder::new(trap_file, flate2::Compression::fast());
176-
if erb_trap.is_some() {
177-
write!(compressed_writer, "{}", erb_trap.unwrap())?;
176+
if let Some(erb_trap) = erb_trap {
177+
write!(compressed_writer, "{}", erb_trap)?;
178178
}
179179
write!(compressed_writer, "{}", trap)
180180
}

generator/src/main.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,12 @@ fn add_field_for_column_storage<'a>(
136136
}
137137

138138
/// Converts the given tree-sitter node types into CodeQL dbscheme entries.
139+
/// Returns a tuple containing:
140+
///
141+
/// 1. A vector of dbscheme entries.
142+
/// 2. A set of names of the members of the `<lang>_ast_node` union.
143+
/// 3. A map where the keys are the dbscheme names for token kinds, and the
144+
/// values are their integer representations.
139145
fn convert_nodes<'a>(
140146
nodes: &'a node_types::NodeTypeMap,
141147
) -> (Vec<dbscheme::Entry<'a>>, Set<&'a str>, Map<&'a str, usize>) {
@@ -244,6 +250,12 @@ fn convert_nodes<'a>(
244250

245251
(entries, ast_node_members, token_kinds)
246252
}
253+
254+
/// Creates a dbscheme table entry representing the parent relation for AST nodes.
255+
///
256+
/// # Arguments
257+
/// - `name` - the name of both the table to create and the node parent type.
258+
/// - `ast_node_name` - the name of the node child type.
247259
fn create_ast_node_parent_table<'a>(name: &'a str, ast_node_name: &'a str) -> dbscheme::Table<'a> {
248260
dbscheme::Table {
249261
name,

generator/src/ql.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ impl<'a> fmt::Display for FormalParameter<'a> {
249249
}
250250
}
251251

252-
/// Generates a QL library by writing the given `classes` to the `file`.
252+
/// Generates a QL library by writing the given `elements` to the `file`.
253253
pub fn write<'a>(file: &mut dyn std::io::Write, elements: &'a [TopLevel]) -> std::io::Result<()> {
254254
for element in elements {
255255
write!(file, "{}\n\n", &element)?;

0 commit comments

Comments
 (0)