style: tidying

This commit is contained in:
Amaan Qureshi 2024-02-17 19:34:55 -05:00
parent d95fcc83b9
commit fd91404ab0
7 changed files with 15 additions and 16 deletions

6
Cargo.lock generated
View file

@ -1307,7 +1307,7 @@ dependencies = [
"tree-sitter-tests-proc-macro",
"unindent",
"walkdir",
"wasmparser 0.121.0",
"wasmparser 0.200.0",
"webbrowser",
"which 6.0.0",
]
@ -1519,9 +1519,9 @@ dependencies = [
[[package]]
name = "wasmparser"
version = "0.121.0"
version = "0.200.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "953cf6a7606ab31382cb1caa5ae403e77ba70c7f8e12eeda167e7040d42bfda8"
checksum = "a03f65ac876612140c57ff6c3b8fe4990067cce97c2cfdb07368a3cc3354b062"
dependencies = [
"bitflags 2.4.2",
"indexmap",

View file

@ -71,6 +71,6 @@ tiny_http = "0.12.0"
toml = "0.8.10"
unindent = "0.2.3"
walkdir = "2.4.0"
wasmparser = "0.121.0"
wasmparser = "0.200.0"
webbrowser = "0.8.12"
which = "6.0.0"

View file

@ -405,7 +405,7 @@ impl Loader {
let mut paths_to_check = vec![parser_path.clone()];
if let Some(scanner_path) = scanner_path.as_ref() {
paths_to_check.push(scanner_path.to_path_buf());
paths_to_check.push(scanner_path.clone());
}
paths_to_check.extend(

View file

@ -144,9 +144,7 @@ impl Serialize for Theme {
impl Default for Theme {
fn default() -> Self {
serde_json::from_str(
r#"
{
serde_json::from_value(json!({
"attribute": {"color": 124, "italic": true},
"comment": {"color": 245, "italic": true},
"constant.builtin": {"color": 94, "bold": true},
@ -169,9 +167,7 @@ impl Default for Theme {
"type.builtin": {"color": 23, "bold": true},
"variable.builtin": {"bold": true},
"variable.parameter": {"underline": true}
}
"#,
)
}))
.unwrap()
}
}

View file

@ -308,7 +308,8 @@ pub fn parse_file_at_path(parser: &mut Parser, opts: &ParseFileOptions) -> Resul
if node.is_error() || node.is_missing() {
first_error = Some(node);
break;
} else if !cursor.goto_first_child() {
}
if !cursor.goto_first_child() {
break;
}
} else if !cursor.goto_next_sibling() {
@ -355,7 +356,9 @@ pub fn parse_file_at_path(parser: &mut Parser, opts: &ParseFileOptions) -> Resul
bytes: source_code.len(),
duration: Some(duration),
});
} else if opts.print_time {
}
if opts.print_time {
let duration = time.elapsed();
let duration_ms = duration.as_micros() as f64 / 1e3;
writeln!(

View file

@ -117,9 +117,9 @@ pub fn get_test_language(name: &str, parser_code: &str, path: Option<&Path>) ->
.unwrap();
let paths_to_check = if let Some(scanner_path) = &scanner_path {
vec![parser_path.clone(), scanner_path.to_path_buf()]
vec![parser_path, scanner_path.clone()]
} else {
vec![parser_path.clone()]
vec![parser_path]
};
TEST_LOADER

View file

@ -42,7 +42,7 @@ typedef struct {
* - `depth` - The depth where this node occurs in the pattern. The root node
* of the pattern has depth zero.
* - `negated_field_list_id` - An id representing a set of fields that must
* that must not be present on a node matching this step.
* not be present on a node matching this step.
*
* Steps have some additional fields in order to handle the `.` (or "anchor") operator,
* which forbids additional child nodes: