Skip to content

Commit 456f560

Browse files
committed
Rust: Remove ResolvePaths enum and resolve_paths arguments up to Translator::new (hardcode to false).
1 parent d6d0645 commit 456f560

File tree

3 files changed

+9
-23
lines changed

3 files changed

+9
-23
lines changed

rust/extractor/src/main.rs

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::diagnostics::{ExtractionStep, emit_extraction_diagnostics};
22
use crate::rust_analyzer::path_to_file_id;
3-
use crate::translate::{ResolvePaths, SourceKind};
3+
use crate::translate::SourceKind;
44
use crate::trap::TrapId;
55
use anyhow::Context;
66
use archive::Archiver;
@@ -54,7 +54,6 @@ impl<'a> Extractor<'a> {
5454
&mut self,
5555
rust_analyzer: &RustAnalyzer,
5656
file: &Path,
57-
resolve_paths: ResolvePaths,
5857
source_kind: SourceKind,
5958
) {
6059
self.archiver.archive(file);
@@ -79,7 +78,6 @@ impl<'a> Extractor<'a> {
7978
label,
8079
line_index,
8180
semantics_info.as_ref().ok(),
82-
resolve_paths,
8381
source_kind,
8482
);
8583

@@ -120,13 +118,11 @@ impl<'a> Extractor<'a> {
120118
file: &Path,
121119
semantics: &Semantics<'_, RootDatabase>,
122120
vfs: &Vfs,
123-
resolve_paths: ResolvePaths,
124121
source_kind: SourceKind,
125122
) {
126123
self.extract(
127124
&RustAnalyzer::new(vfs, semantics),
128125
file,
129-
resolve_paths,
130126
source_kind,
131127
);
132128
}
@@ -140,7 +136,6 @@ impl<'a> Extractor<'a> {
140136
self.extract(
141137
&RustAnalyzer::WithoutSemantics { reason },
142138
file,
143-
ResolvePaths::No,
144139
source_kind,
145140
);
146141
}
@@ -283,16 +278,15 @@ fn main() -> anyhow::Result<()> {
283278
}
284279
let cwd = cwd()?;
285280
let (cargo_config, load_cargo_config) = cfg.to_cargo_config(&cwd);
286-
let resolve_paths = ResolvePaths::No;
287-
let (library_mode, library_resolve_paths) = if cfg.extract_dependencies_as_source {
288-
(SourceKind::Source, resolve_paths)
281+
let library_mode = if cfg.extract_dependencies_as_source {
282+
SourceKind::Source
289283
} else {
290-
(SourceKind::Library, ResolvePaths::No)
284+
SourceKind::Library
291285
};
292-
let (source_mode, source_resolve_paths) = if cfg.force_library_mode {
293-
(library_mode, library_resolve_paths)
286+
let source_mode = if cfg.force_library_mode {
287+
library_mode
294288
} else {
295-
(SourceKind::Source, resolve_paths)
289+
SourceKind::Source
296290
};
297291
let mut processed_files: HashSet<PathBuf, RandomState> =
298292
HashSet::from_iter(files.iter().cloned());
@@ -312,7 +306,6 @@ fn main() -> anyhow::Result<()> {
312306
file,
313307
&semantics,
314308
vfs,
315-
source_resolve_paths,
316309
source_mode,
317310
),
318311
Err(reason) => extractor.extract_without_semantics(file, source_mode, &reason),
@@ -331,7 +324,6 @@ fn main() -> anyhow::Result<()> {
331324
file,
332325
&semantics,
333326
vfs,
334-
library_resolve_paths,
335327
library_mode,
336328
);
337329
extractor.archiver.archive(file);

rust/extractor/src/translate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ mod base;
22
mod generated;
33
mod mappings;
44

5-
pub use base::{ResolvePaths, SourceKind, Translator};
5+
pub use base::{SourceKind, Translator};

rust/extractor/src/translate/base.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,6 @@ macro_rules! dispatch_to_tracing {
175175
};
176176
}
177177

178-
#[derive(Copy, Clone, PartialEq, Eq)]
179-
pub enum ResolvePaths {
180-
Yes,
181-
No,
182-
}
183178
#[derive(Copy, Clone, PartialEq, Eq)]
184179
pub enum SourceKind {
185180
Source,
@@ -211,7 +206,6 @@ impl<'a> Translator<'a> {
211206
label: Label<generated::File>,
212207
line_index: LineIndex,
213208
semantic_info: Option<&FileSemanticInformation<'a>>,
214-
resolve_paths: ResolvePaths,
215209
source_kind: SourceKind,
216210
) -> Translator<'a> {
217211
Translator {
@@ -221,7 +215,7 @@ impl<'a> Translator<'a> {
221215
line_index,
222216
file_id: semantic_info.map(|i| i.file_id),
223217
semantics: semantic_info.map(|i| i.semantics),
224-
resolve_paths: resolve_paths == ResolvePaths::Yes,
218+
resolve_paths: false,
225219
source_kind,
226220
macro_context_depth: 0,
227221
diagnostic_count: 0,

0 commit comments

Comments
 (0)