Skip to content

Commit dfc6564

Browse files
committed
fix: resolve lint issues at ast-grep/native.rs
1 parent b75231f commit dfc6564

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

crates/codemod-sandbox/src/ast_grep/native.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
use std::fs;
22
use std::path::{Path, PathBuf};
33
use std::str::FromStr;
4-
use std::sync::Arc;
54

6-
use crate::sandbox::engine::language_data::get_extensions_for_language;
5+
use crate::sandbox::engine::{language_data::get_extensions_for_language, ProgressCallback};
76
use crate::tree_sitter::{load_tree_sitter, SupportedLanguage};
87
use ast_grep_codemod_dynamic_lang::DynamicLang;
98
use ast_grep_config::{from_yaml_string, CombinedScan, RuleConfig};
@@ -65,7 +64,7 @@ pub async fn execute_ast_grep_on_globs(
6564
base_path: Option<&str>,
6665
config_file: &str,
6766
working_dir: Option<&Path>,
68-
progress_callback: Option<Arc<Box<dyn Fn(u64, u64) + Send + Sync>>>,
67+
progress_callback: Option<ProgressCallback>,
6968
) -> Result<Vec<AstGrepMatch>, AstGrepError> {
7069
execute_ast_grep_on_globs_with_options(
7170
include_globs,
@@ -86,7 +85,7 @@ pub async fn execute_ast_grep_on_globs_with_fixes(
8685
base_path: Option<&str>,
8786
config_file: &str,
8887
working_dir: Option<&Path>,
89-
progress_callback: Option<Arc<Box<dyn Fn(u64, u64) + Send + Sync>>>,
88+
progress_callback: Option<ProgressCallback>,
9089
) -> Result<Vec<AstGrepMatch>, AstGrepError> {
9190
execute_ast_grep_on_globs_with_options(
9291
include_globs,
@@ -112,7 +111,7 @@ async fn execute_ast_grep_on_globs_with_options(
112111
config_file: &str,
113112
working_dir: Option<&Path>,
114113
apply_fixes: bool,
115-
progress_callback: Option<Arc<Box<dyn Fn(u64, u64) + Send + Sync>>>,
114+
progress_callback: Option<ProgressCallback>,
116115
) -> Result<Vec<AstGrepMatch>, AstGrepError> {
117116
// Resolve config file path
118117
let config_path = if let Some(wd) = working_dir {
@@ -530,7 +529,7 @@ pub async fn execute_ast_grep_on_paths(
530529
paths: &[String],
531530
config_file: &str,
532531
working_dir: Option<&Path>,
533-
progress_callback: Option<Arc<Box<dyn Fn(u64, u64) + Send + Sync>>>,
532+
progress_callback: Option<ProgressCallback>,
534533
) -> Result<Vec<AstGrepMatch>, AstGrepError> {
535534
execute_ast_grep_on_globs(
536535
Some(paths),
@@ -548,7 +547,7 @@ pub async fn execute_ast_grep_on_paths_with_fixes(
548547
paths: &[String],
549548
config_file: &str,
550549
working_dir: Option<&Path>,
551-
progress_callback: Option<Arc<Box<dyn Fn(u64, u64) + Send + Sync>>>,
550+
progress_callback: Option<ProgressCallback>,
552551
) -> Result<Vec<AstGrepMatch>, AstGrepError> {
553552
execute_ast_grep_on_globs_with_fixes(
554553
Some(paths),

crates/core/src/engine.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ impl Engine {
651651
async fn execute_workflow(
652652
&self,
653653
workflow_run_id: Uuid,
654-
progress_callback: Option<Arc<Box<dyn Fn(u64, u64) + Send + Sync>>>,
654+
progress_callback: Option<ProgressCallback>,
655655
) -> Result<()> {
656656
// Get the workflow run
657657
let workflow_run = self
@@ -947,7 +947,7 @@ impl Engine {
947947
async fn execute_task(
948948
&self,
949949
task_id: Uuid,
950-
progress_callback: Option<Arc<Box<dyn Fn(u64, u64) + Send + Sync>>>,
950+
progress_callback: Option<ProgressCallback>,
951951
) -> Result<()> {
952952
let task = self.state_adapter.lock().await.get_task(task_id).await?;
953953

@@ -1165,7 +1165,7 @@ impl Engine {
11651165
state: &HashMap<String, serde_json::Value>,
11661166
workflow: &Workflow,
11671167
bundle_path: &Option<PathBuf>,
1168-
progress_callback: Option<Arc<Box<dyn Fn(u64, u64) + Send + Sync>>>,
1168+
progress_callback: Option<ProgressCallback>,
11691169
) -> Result<()> {
11701170
self.execute_step_action_with_chain(
11711171
runner,
@@ -1197,7 +1197,7 @@ impl Engine {
11971197
workflow: &Workflow,
11981198
bundle_path: &Option<PathBuf>,
11991199
dependency_chain: &[CodemodDependency],
1200-
progress_callback: Option<Arc<Box<dyn Fn(u64, u64) + Send + Sync>>>,
1200+
progress_callback: Option<ProgressCallback>,
12011201
) -> Result<()> {
12021202
match action {
12031203
StepAction::RunScript(run) => {
@@ -1282,7 +1282,7 @@ impl Engine {
12821282
&self,
12831283
ast_grep: &UseAstGrep,
12841284
bundle_path: Option<&std::path::Path>,
1285-
progress_callback: Option<Arc<Box<dyn Fn(u64, u64) + Send + Sync>>>,
1285+
progress_callback: Option<ProgressCallback>,
12861286
) -> Result<()> {
12871287
// Use bundle path as working directory, falling back to current directory
12881288
let working_dir = bundle_path
@@ -1374,7 +1374,7 @@ impl Engine {
13741374
&self,
13751375
js_ast_grep: &UseJSAstGrep,
13761376
bundle_path: Option<&std::path::Path>,
1377-
progress_callback: Option<Arc<Box<dyn Fn(u64, u64) + Send + Sync>>>,
1377+
progress_callback: Option<ProgressCallback>,
13781378
) -> Result<()> {
13791379
// Use bundle path as working directory, falling back to current directory
13801380
let working_dir = bundle_path
@@ -1525,7 +1525,7 @@ impl Engine {
15251525
state: &HashMap<String, serde_json::Value>,
15261526
bundle_path: &Option<PathBuf>,
15271527
dependency_chain: &[CodemodDependency],
1528-
progress_callback: Option<Arc<Box<dyn Fn(u64, u64) + Send + Sync>>>,
1528+
progress_callback: Option<ProgressCallback>,
15291529
) -> Result<()> {
15301530
info!("Executing codemod step: {}", codemod.source);
15311531

@@ -1617,7 +1617,7 @@ impl Engine {
16171617
state: &HashMap<String, serde_json::Value>,
16181618
bundle_path: &Option<PathBuf>,
16191619
dependency_chain: &[CodemodDependency],
1620-
progress_callback: Option<Arc<Box<dyn Fn(u64, u64) + Send + Sync>>>,
1620+
progress_callback: Option<ProgressCallback>,
16211621
) -> Result<()> {
16221622
let workflow_path = resolved_package.package_dir.join("workflow.yaml");
16231623

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy