Skip to content

Commit 99d41a2

Browse files
committed
remove lock
1 parent 554586f commit 99d41a2

File tree

4 files changed

+8
-11
lines changed

4 files changed

+8
-11
lines changed

cli/lsp/config.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1653,7 +1653,7 @@ impl ConfigData {
16531653
.await;
16541654
match plugin_load_result {
16551655
Ok(runner) => {
1656-
plugin_runner = Some(Arc::new(Mutex::new(runner)));
1656+
plugin_runner = Some(Arc::new(runner));
16571657
}
16581658
Err(err) => {
16591659
lsp_warn!("Failed to load lint plugins: {}", err);

cli/tools/lint/linter.rs

+5-8
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub struct CliLinterOptions {
3939
pub configured_rules: ConfiguredRules,
4040
pub fix: bool,
4141
pub deno_lint_config: DenoLintConfig,
42-
pub maybe_plugin_runner: Option<Arc<Mutex<PluginHostProxy>>>,
42+
pub maybe_plugin_runner: Option<Arc<PluginHostProxy>>,
4343
}
4444

4545
#[derive(Debug)]
@@ -48,7 +48,7 @@ pub struct CliLinter {
4848
package_rules: Vec<Box<dyn PackageLintRule>>,
4949
linter: DenoLintLinter,
5050
deno_lint_config: DenoLintConfig,
51-
maybe_plugin_runner: Option<Arc<Mutex<PluginHostProxy>>>,
51+
maybe_plugin_runner: Option<Arc<PluginHostProxy>>,
5252
}
5353

5454
impl CliLinter {
@@ -368,28 +368,25 @@ fn apply_lint_fixes(
368368
}
369369

370370
fn run_plugins(
371-
plugin_runner: Arc<Mutex<PluginHostProxy>>,
371+
plugin_runner: Arc<PluginHostProxy>,
372372
parsed_source: ParsedSource,
373373
file_path: PathBuf,
374374
maybe_token: Option<CancellationToken>,
375375
) -> Result<ExternalLinterResult, AnyError> {
376376
let source_text_info = parsed_source.text_info_lazy().clone();
377377
let plugin_info = plugin_runner
378-
.lock()
379378
.get_plugin_rules()
380379
.into_iter()
381380
.map(Cow::from)
382381
.collect();
383382

384-
#[allow(clippy::await_holding_lock)]
385383
let fut = async move {
386-
let mut plugin_runner = plugin_runner.lock();
387384
let utf16_map = Utf16Map::new(parsed_source.text().as_ref());
388385
let serialized_ast =
389386
plugin_runner.serialize_ast(&parsed_source, &utf16_map)?;
390387

391388
plugins::run_rules_for_ast(
392-
&mut plugin_runner,
389+
&plugin_runner,
393390
&file_path,
394391
serialized_ast,
395392
source_text_info,
@@ -415,7 +412,7 @@ struct ExternalLinterContainer {
415412

416413
impl ExternalLinterContainer {
417414
pub fn new(
418-
maybe_plugin_runner: Option<Arc<Mutex<PluginHostProxy>>>,
415+
maybe_plugin_runner: Option<Arc<PluginHostProxy>>,
419416
maybe_token: Option<CancellationToken>,
420417
) -> Self {
421418
let mut s = Self {

cli/tools/lint/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ impl WorkspaceLinter {
330330
exclude,
331331
)
332332
.await?;
333-
plugin_runner = Some(Arc::new(Mutex::new(runner)));
333+
plugin_runner = Some(Arc::new(runner));
334334
}
335335

336336
let linter = Arc::new(CliLinter::new(CliLinterOptions {

cli/tools/lint/plugins.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ pub async fn create_runner_and_load_plugins(
523523
}
524524

525525
pub async fn run_rules_for_ast(
526-
host_proxy: &mut PluginHostProxy,
526+
host_proxy: &PluginHostProxy,
527527
specifier: &Path,
528528
serialized_ast: Vec<u8>,
529529
source_text_info: SourceTextInfo,

0 commit comments

Comments
 (0)