Skip to content

Commit c69aa22

Browse files
aibaarshvitved
authored andcommitted
Rust: restrict to library files
1 parent 9ee0d2e commit c69aa22

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

rust/extractor/src/main.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use crate::translate::{ResolvePaths, SourceKind};
44
use crate::trap::TrapId;
55
use anyhow::Context;
66
use archive::Archiver;
7+
use ra_ap_base_db::SourceDatabase;
78
use ra_ap_hir::Semantics;
89
use ra_ap_ide_db::RootDatabase;
910
use ra_ap_ide_db::line_index::{LineCol, LineIndex};
@@ -301,10 +302,14 @@ fn main() -> anyhow::Result<()> {
301302
}
302303
};
303304
}
304-
for (_, file) in vfs.iter() {
305+
for (file_id, file) in vfs.iter() {
305306
if let Some(file) = file.as_path().map(<_ as AsRef<Path>>::as_ref) {
306307
if file.extension().is_some_and(|ext| ext == "rs")
307308
&& processed_files.insert(file.to_owned())
309+
&& db
310+
.source_root(db.file_source_root(file_id).source_root_id(db))
311+
.source_root(db)
312+
.is_library
308313
{
309314
extractor.extract_with_semantics(
310315
file,

0 commit comments

Comments
 (0)