diff --git a/rust-code-analysis-cli/src/main.rs b/rust-code-analysis-cli/src/main.rs index c1a236ec8..2c8196ce3 100644 --- a/rust-code-analysis-cli/src/main.rs +++ b/rust-code-analysis-cli/src/main.rs @@ -127,10 +127,11 @@ fn act_on_file(language: Option, path: PathBuf, cfg: &Config) -> std::io:: } else if cfg.preproc_lock.is_some() { if let Some(language) = guess_language(&source, &path).0 { if language == LANG::Cpp { + let mut results = cfg.preproc_lock.as_ref().unwrap().lock().unwrap(); preprocess( &PreprocParser::new(source, &path, None), &path, - cfg.preproc_lock.as_ref().unwrap().clone(), + &mut results, ); } } diff --git a/src/preproc.rs b/src/preproc.rs index 7c9299eca..ff448b32c 100644 --- a/src/preproc.rs +++ b/src/preproc.rs @@ -3,7 +3,6 @@ use petgraph::{ }; use std::collections::{hash_map, HashMap, HashSet}; use std::path::PathBuf; -use std::sync::{Arc, Mutex}; use crate::langs::*; use crate::languages::language_preproc::*; @@ -178,12 +177,11 @@ pub fn fix_includes( } /// Extracts preprocessor data from a `C/C++` file -/// and inserts these data in a [`PreprocResults`] -/// object shared among threads. +/// and inserts these data in a [`PreprocResults`] object. /// /// /// [`PreprocResults`]: struct.PreprocResults.html -pub fn preprocess(parser: &PreprocParser, path: &PathBuf, results: Arc>) { +pub fn preprocess(parser: &PreprocParser, path: &PathBuf, results: &mut PreprocResults) { let node = parser.get_root(); let mut cursor = node.walk(); let mut stack = Vec::new(); @@ -238,6 +236,5 @@ pub fn preprocess(parser: &PreprocParser, path: &PathBuf, results: Arc