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