mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-30 21:16:27 +03:00
Merge pull request #21788 from Veykril/push-mwqrzolksvxx
Do not re-query source roots per crate in analysis-stats
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//! Defines [`EditionedFileId`], an interned wrapper around [`span::EditionedFileId`] that
|
||||
//! is interned (so queries can take it) and remembers its crate.
|
||||
//! is interned (so queries can take it) and stores only the underlying `span::EditionedFileId`.
|
||||
|
||||
use std::hash::Hash;
|
||||
|
||||
|
||||
@@ -70,12 +70,11 @@ pub(crate) fn on_char_typed(
|
||||
if !TRIGGER_CHARS.contains(&char_typed) {
|
||||
return None;
|
||||
}
|
||||
let krate = db
|
||||
let edition = db
|
||||
.relevant_crates(position.file_id)
|
||||
.first()
|
||||
.copied()
|
||||
.unwrap_or_else(|| *db.all_crates().first().unwrap());
|
||||
let edition = krate.data(db).edition;
|
||||
.map_or(Edition::CURRENT, |krate| krate.data(db).edition);
|
||||
let editioned_file_id_wrapper = EditionedFileId::new(db, position.file_id, edition);
|
||||
let file = &db.parse(editioned_file_id_wrapper);
|
||||
let char_matches_position =
|
||||
|
||||
@@ -127,7 +127,7 @@ pub fn run(self, verbosity: Verbosity) -> anyhow::Result<()> {
|
||||
.iter()
|
||||
.cloned()
|
||||
.map(|krate| (db.file_source_root(krate.root_file(db)).source_root_id(db), krate))
|
||||
.unique();
|
||||
.unique_by(|(source_root_id, _)| *source_root_id);
|
||||
|
||||
let mut dep_loc = 0;
|
||||
let mut workspace_loc = 0;
|
||||
|
||||
Reference in New Issue
Block a user