Remove IntoDefIdTree
This commit is contained in:
@@ -194,11 +194,6 @@ impl EffectiveVisibilities {
|
||||
}
|
||||
}
|
||||
|
||||
pub trait IntoDefIdTree {
|
||||
type Tree: DefIdTree;
|
||||
fn tree(self) -> Self::Tree;
|
||||
}
|
||||
|
||||
impl<Id: Eq + Hash> EffectiveVisibilities<Id> {
|
||||
pub fn iter(&self) -> impl Iterator<Item = (&Id, &EffectiveVisibility)> {
|
||||
self.map.iter()
|
||||
@@ -217,25 +212,21 @@ impl<Id: Eq + Hash> EffectiveVisibilities<Id> {
|
||||
self.map.entry(id).or_insert_with(|| EffectiveVisibility::from_vis(lazy_private_vis()))
|
||||
}
|
||||
|
||||
pub fn update<T: IntoDefIdTree>(
|
||||
pub fn update(
|
||||
&mut self,
|
||||
id: Id,
|
||||
nominal_vis: Visibility,
|
||||
lazy_private_vis: impl FnOnce(T) -> (Visibility, T),
|
||||
lazy_private_vis: impl FnOnce() -> Visibility,
|
||||
inherited_effective_vis: EffectiveVisibility,
|
||||
level: Level,
|
||||
mut into_tree: T,
|
||||
tree: impl DefIdTree,
|
||||
) -> bool {
|
||||
let mut changed = false;
|
||||
let mut current_effective_vis = match self.map.get(&id).copied() {
|
||||
Some(eff_vis) => eff_vis,
|
||||
None => {
|
||||
let private_vis;
|
||||
(private_vis, into_tree) = lazy_private_vis(into_tree);
|
||||
EffectiveVisibility::from_vis(private_vis)
|
||||
}
|
||||
};
|
||||
let tree = into_tree.tree();
|
||||
let mut current_effective_vis = self
|
||||
.map
|
||||
.get(&id)
|
||||
.copied()
|
||||
.unwrap_or_else(|| EffectiveVisibility::from_vis(lazy_private_vis()));
|
||||
|
||||
let mut inherited_effective_vis_at_prev_level = *inherited_effective_vis.at_level(level);
|
||||
let mut calculated_effective_vis = inherited_effective_vis_at_prev_level;
|
||||
|
||||
Reference in New Issue
Block a user