mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-29 02:52:11 +00:00
Cleanup assoc_type_shorthand_candidates
This commit is contained in:
parent
aa890b49ff
commit
496f5f9e96
3 changed files with 13 additions and 14 deletions
|
|
@ -2288,18 +2288,19 @@ impl<'db> SemanticsScope<'db> {
|
|||
|
||||
/// Iterates over associated types that may be specified after the given path (using
|
||||
/// `Ty::Assoc` syntax).
|
||||
pub fn assoc_type_shorthand_candidates<R>(
|
||||
pub fn assoc_type_shorthand_candidates(
|
||||
&self,
|
||||
resolution: &PathResolution,
|
||||
mut cb: impl FnMut(&Name, TypeAlias) -> Option<R>,
|
||||
) -> Option<R> {
|
||||
let def = self.resolver.generic_def()?;
|
||||
hir_ty::associated_type_shorthand_candidates(
|
||||
self.db,
|
||||
def,
|
||||
resolution.in_type_ns()?,
|
||||
|name, id| cb(name, id.into()),
|
||||
)
|
||||
mut cb: impl FnMut(TypeAlias),
|
||||
) {
|
||||
let (Some(def), Some(resolution)) = (self.resolver.generic_def(), resolution.in_type_ns())
|
||||
else {
|
||||
return;
|
||||
};
|
||||
hir_ty::associated_type_shorthand_candidates(self.db, def, resolution, |_, id| {
|
||||
cb(id.into());
|
||||
None::<()>
|
||||
});
|
||||
}
|
||||
|
||||
pub fn generic_def(&self) -> Option<crate::GenericDef> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue