mirror of
https://github.com/astral-sh/ruff
synced 2026-01-09 15:44:22 -05:00
[ty] Make Module a Salsa ingredient
We want to write queries that depend on `Module` for caching. While it seems it can be done without making `Module` an ingredient, it seems it is best practice to do so. [best practice to do so]: https://github.com/astral-sh/ruff/pull/19408#discussion_r2215867301
This commit is contained in:
committed by
Andrew Gallant
parent
905b9d7f51
commit
4573a0f6a0
@@ -163,7 +163,7 @@ fn stem(path: &str) -> &str {
|
||||
}
|
||||
|
||||
/// Infer the [`Visibility`] of a module from its path.
|
||||
pub(crate) fn module_visibility(module: &Module) -> Visibility {
|
||||
pub(crate) fn module_visibility(module: Module) -> Visibility {
|
||||
match &module.source {
|
||||
ModuleSource::Path(path) => {
|
||||
if path.iter().any(|m| is_private_module(m)) {
|
||||
|
||||
@@ -223,7 +223,7 @@ impl<'a> Definitions<'a> {
|
||||
// visibility.
|
||||
let visibility = {
|
||||
match &definition {
|
||||
Definition::Module(module) => module_visibility(module),
|
||||
Definition::Module(module) => module_visibility(*module),
|
||||
Definition::Member(member) => match member.kind {
|
||||
MemberKind::Class(class) => {
|
||||
let parent = &definitions[member.parent];
|
||||
|
||||
Reference in New Issue
Block a user