mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Rust: Remove ResolvePaths enum and resolve_paths arguments up to Translator::new (hardcode to false).
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use crate::diagnostics::{ExtractionStep, emit_extraction_diagnostics};
|
||||
use crate::rust_analyzer::path_to_file_id;
|
||||
use crate::translate::{ResolvePaths, SourceKind};
|
||||
use crate::translate::SourceKind;
|
||||
use crate::trap::TrapId;
|
||||
use anyhow::Context;
|
||||
use archive::Archiver;
|
||||
@@ -54,7 +54,6 @@ impl<'a> Extractor<'a> {
|
||||
&mut self,
|
||||
rust_analyzer: &RustAnalyzer,
|
||||
file: &Path,
|
||||
resolve_paths: ResolvePaths,
|
||||
source_kind: SourceKind,
|
||||
) {
|
||||
self.archiver.archive(file);
|
||||
@@ -79,7 +78,6 @@ impl<'a> Extractor<'a> {
|
||||
label,
|
||||
line_index,
|
||||
semantics_info.as_ref().ok(),
|
||||
resolve_paths,
|
||||
source_kind,
|
||||
);
|
||||
|
||||
@@ -120,13 +118,11 @@ impl<'a> Extractor<'a> {
|
||||
file: &Path,
|
||||
semantics: &Semantics<'_, RootDatabase>,
|
||||
vfs: &Vfs,
|
||||
resolve_paths: ResolvePaths,
|
||||
source_kind: SourceKind,
|
||||
) {
|
||||
self.extract(
|
||||
&RustAnalyzer::new(vfs, semantics),
|
||||
file,
|
||||
resolve_paths,
|
||||
source_kind,
|
||||
);
|
||||
}
|
||||
@@ -140,7 +136,6 @@ impl<'a> Extractor<'a> {
|
||||
self.extract(
|
||||
&RustAnalyzer::WithoutSemantics { reason },
|
||||
file,
|
||||
ResolvePaths::No,
|
||||
source_kind,
|
||||
);
|
||||
}
|
||||
@@ -283,16 +278,15 @@ fn main() -> anyhow::Result<()> {
|
||||
}
|
||||
let cwd = cwd()?;
|
||||
let (cargo_config, load_cargo_config) = cfg.to_cargo_config(&cwd);
|
||||
let resolve_paths = ResolvePaths::No;
|
||||
let (library_mode, library_resolve_paths) = if cfg.extract_dependencies_as_source {
|
||||
(SourceKind::Source, resolve_paths)
|
||||
let library_mode = if cfg.extract_dependencies_as_source {
|
||||
SourceKind::Source
|
||||
} else {
|
||||
(SourceKind::Library, ResolvePaths::No)
|
||||
SourceKind::Library
|
||||
};
|
||||
let (source_mode, source_resolve_paths) = if cfg.force_library_mode {
|
||||
(library_mode, library_resolve_paths)
|
||||
let source_mode = if cfg.force_library_mode {
|
||||
library_mode
|
||||
} else {
|
||||
(SourceKind::Source, resolve_paths)
|
||||
SourceKind::Source
|
||||
};
|
||||
let mut processed_files: HashSet<PathBuf, RandomState> =
|
||||
HashSet::from_iter(files.iter().cloned());
|
||||
@@ -312,7 +306,6 @@ fn main() -> anyhow::Result<()> {
|
||||
file,
|
||||
&semantics,
|
||||
vfs,
|
||||
source_resolve_paths,
|
||||
source_mode,
|
||||
),
|
||||
Err(reason) => extractor.extract_without_semantics(file, source_mode, &reason),
|
||||
@@ -331,7 +324,6 @@ fn main() -> anyhow::Result<()> {
|
||||
file,
|
||||
&semantics,
|
||||
vfs,
|
||||
library_resolve_paths,
|
||||
library_mode,
|
||||
);
|
||||
extractor.archiver.archive(file);
|
||||
|
||||
@@ -2,4 +2,4 @@ mod base;
|
||||
mod generated;
|
||||
mod mappings;
|
||||
|
||||
pub use base::{ResolvePaths, SourceKind, Translator};
|
||||
pub use base::{SourceKind, Translator};
|
||||
|
||||
@@ -175,11 +175,6 @@ macro_rules! dispatch_to_tracing {
|
||||
};
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq)]
|
||||
pub enum ResolvePaths {
|
||||
Yes,
|
||||
No,
|
||||
}
|
||||
#[derive(Copy, Clone, PartialEq, Eq)]
|
||||
pub enum SourceKind {
|
||||
Source,
|
||||
@@ -211,7 +206,6 @@ impl<'a> Translator<'a> {
|
||||
label: Label<generated::File>,
|
||||
line_index: LineIndex,
|
||||
semantic_info: Option<&FileSemanticInformation<'a>>,
|
||||
resolve_paths: ResolvePaths,
|
||||
source_kind: SourceKind,
|
||||
) -> Translator<'a> {
|
||||
Translator {
|
||||
@@ -221,7 +215,7 @@ impl<'a> Translator<'a> {
|
||||
line_index,
|
||||
file_id: semantic_info.map(|i| i.file_id),
|
||||
semantics: semantic_info.map(|i| i.semantics),
|
||||
resolve_paths: resolve_paths == ResolvePaths::Yes,
|
||||
resolve_paths: false,
|
||||
source_kind,
|
||||
macro_context_depth: 0,
|
||||
diagnostic_count: 0,
|
||||
|
||||
Reference in New Issue
Block a user