Skip to content

Commit c5d71b7

Browse files
chore: update cargo version
1 parent fbeb4ea commit c5d71b7

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

Cargo.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ console_error_panic_hook = { version = "0.1.7", optional = true }
2828

2929
once_cell = "1.19.0"
3030
wee_alloc = { version = "0.4.5" }
31-
ast-grep-core = { version = "0.32.1" }
32-
ast-grep-config = { version = "0.32.1" }
33-
ast-grep-language = { version = "0.32.1", default-features = false }
31+
ast-grep-core = { version = "0.33.1" }
32+
ast-grep-config = { version = "0.33.1" }
33+
ast-grep-language = { version = "0.33.1", default-features = false }
3434
web-tree-sitter-sg = "0.24.4"
3535
tree-sitter = { version = "0.24.5", package = "tree-sitter-facade-sg" }
3636
serde-wasm-bindgen = "0.6"

src/lib.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ pub fn find_nodes(src: String, configs: Vec<JsValue>) -> Result<JsValue, JsError
4141
let doc = WasmDoc::new(src.clone(), lang);
4242
let root = AstGrep::doc(doc);
4343
let sets = combined.find(&root);
44-
let ret: HashMap<_, _> = combined.scan(&root, sets, false).matches.into_iter().map(|(id, matches)| {
45-
let rule = combined.get_rule(id);
44+
let ret: HashMap<_, _> = combined.scan(&root, sets, false).matches.into_iter().map(|(rule, matches)| {
4645
let matches: Vec<_> = matches.into_iter().map(|m| {
4746
WasmMatch::from_match(m, rule)
4847
}).collect();
@@ -71,12 +70,11 @@ pub fn fix_errors(src: String, configs: Vec<JsValue>) -> Result<String, JsError>
7170
let mut start = 0;
7271
let src: Vec<_> = src.chars().collect();
7372
let mut new_content = Vec::<char>::new();
74-
for (idx, nm) in diffs {
73+
for (rule, nm) in diffs {
7574
let range = nm.range();
7675
if start > range.start {
7776
continue;
7877
}
79-
let rule = combined.get_rule(idx);
8078
let fixer = rule.get_fixer()?.expect("rule returned by diff must have fixer");
8179
let edit = nm.make_edit(&rule.matcher, &fixer);
8280
new_content.extend(&src[start..edit.position]);

0 commit comments

Comments
 (0)