Skip to content

Commit 5e172b0

Browse files
committed
fix: resolve lint issues at ast-grep/native.rs
1 parent 91d5185 commit 5e172b0

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
@@ -643,7 +643,7 @@ impl Engine {
643643
async fn execute_workflow(
644644
&self,
645645
workflow_run_id: Uuid,
646-
progress_callback: Option<Arc<Box<dyn Fn(u64, u64) + Send + Sync>>>,
646+
progress_callback: Option<ProgressCallback>,
647647
) -> Result<()> {
648648
// Get the workflow run
649649
let workflow_run = self
@@ -939,7 +939,7 @@ impl Engine {
939939
async fn execute_task(
940940
&self,
941941
task_id: Uuid,
942-
progress_callback: Option<Arc<Box<dyn Fn(u64, u64) + Send + Sync>>>,
942+
progress_callback: Option<ProgressCallback>,
943943
) -> Result<()> {
944944
let task = self.state_adapter.lock().await.get_task(task_id).await?;
945945

@@ -1157,7 +1157,7 @@ impl Engine {
11571157
state: &HashMap<String, serde_json::Value>,
11581158
workflow: &Workflow,
11591159
bundle_path: &Option<PathBuf>,
1160-
progress_callback: Option<Arc<Box<dyn Fn(u64, u64) + Send + Sync>>>,
1160+
progress_callback: Option<ProgressCallback>,
11611161
) -> Result<()> {
11621162
self.execute_step_action_with_chain(
11631163
runner,
@@ -1189,7 +1189,7 @@ impl Engine {
11891189
workflow: &Workflow,
11901190
bundle_path: &Option<PathBuf>,
11911191
dependency_chain: &[CodemodDependency],
1192-
progress_callback: Option<Arc<Box<dyn Fn(u64, u64) + Send + Sync>>>,
1192+
progress_callback: Option<ProgressCallback>,
11931193
) -> Result<()> {
11941194
match action {
11951195
StepAction::RunScript(run) => {
@@ -1274,7 +1274,7 @@ impl Engine {
12741274
&self,
12751275
ast_grep: &UseAstGrep,
12761276
bundle_path: Option<&std::path::Path>,
1277-
progress_callback: Option<Arc<Box<dyn Fn(u64, u64) + Send + Sync>>>,
1277+
progress_callback: Option<ProgressCallback>,
12781278
) -> Result<()> {
12791279
// Use bundle path as working directory, falling back to current directory
12801280
let working_dir = bundle_path
@@ -1366,7 +1366,7 @@ impl Engine {
13661366
&self,
13671367
js_ast_grep: &UseJSAstGrep,
13681368
bundle_path: Option<&std::path::Path>,
1369-
progress_callback: Option<Arc<Box<dyn Fn(u64, u64) + Send + Sync>>>,
1369+
progress_callback: Option<ProgressCallback>,
13701370
) -> Result<()> {
13711371
// Use bundle path as working directory, falling back to current directory
13721372
let working_dir = bundle_path
@@ -1502,7 +1502,7 @@ impl Engine {
15021502
state: &HashMap<String, serde_json::Value>,
15031503
bundle_path: &Option<PathBuf>,
15041504
dependency_chain: &[CodemodDependency],
1505-
progress_callback: Option<Arc<Box<dyn Fn(u64, u64) + Send + Sync>>>,
1505+
progress_callback: Option<ProgressCallback>,
15061506
) -> Result<()> {
15071507
info!("Executing codemod step: {}", codemod.source);
15081508

@@ -1594,7 +1594,7 @@ impl Engine {
15941594
state: &HashMap<String, serde_json::Value>,
15951595
bundle_path: &Option<PathBuf>,
15961596
dependency_chain: &[CodemodDependency],
1597-
progress_callback: Option<Arc<Box<dyn Fn(u64, u64) + Send + Sync>>>,
1597+
progress_callback: Option<ProgressCallback>,
15981598
) -> Result<()> {
15991599
let workflow_path = resolved_package.package_dir.join("workflow.yaml");
16001600

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