Find all IDs with colliding (unqualified) humanizations.
(&self, humanizer: &dyn ExprHumanizer)
| 803 | |
| 804 | /// Find all IDs with colliding (unqualified) humanizations. |
| 805 | pub fn ambiguous_ids(&self, humanizer: &dyn ExprHumanizer) -> BTreeSet<GlobalId> { |
| 806 | let humanized = self |
| 807 | .0 |
| 808 | .iter() |
| 809 | .flat_map(|(id, _)| humanizer.humanize_id_unqualified(*id).map(|hum| (hum, *id))); |
| 810 | |
| 811 | let mut by_humanization = BTreeMap::<String, BTreeSet<GlobalId>>::new(); |
| 812 | for (hum, id) in humanized { |
| 813 | by_humanization.entry(hum).or_default().insert(id); |
| 814 | } |
| 815 | |
| 816 | by_humanization |
| 817 | .values() |
| 818 | .filter(|ids| ids.len() > 1) |
| 819 | .flatten() |
| 820 | .cloned() |
| 821 | .collect() |
| 822 | } |
| 823 | } |
| 824 | |
| 825 | #[derive( |