Skip to content

Commit 691600a

Browse files
committed
Auto merge of rust-lang#15181 - lowr:patch/import-map-purge-unused, r=Veykril
Clean up `ImportMap` There are several things in `hir_def::import_map` that are never used. This PR removes them and restructures the code. Namely: - Removes `Query::name_only`, because it's *always* true. - Because of this, we never took advantage of storing items' full path. This PR removes `ImportPath` and changes `ImportInfo` to only store items' name, which should reduce the memory consumption to some extent. - Removes `SearchMode::Contains` for `Query` because it's never used. - Merges `Query::assoc_items_only` and `Query::exclude_import_kinds` into `Query::assoc_mode`, because the latter is never used besides filtering associated items out. Best reviewed one commit at a time. I made sure each commit passes full test suite. I can squash the first three commits if needed.
2 parents 6d616a4 + 5db0e1a commit 691600a

File tree

6 files changed

+259
-460
lines changed

6 files changed

+259
-460
lines changed

crates/hir-def/src/find_path.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ fn calculate_best_path(
360360
prefer_no_std,
361361
)?;
362362
cov_mark::hit!(partially_imported);
363-
path.push_segment(info.path.segments.last()?.clone());
363+
path.push_segment(info.name.clone());
364364
Some(path)
365365
})
366366
});

0 commit comments

Comments
 (0)