@@ -42,25 +42,23 @@ pub enum Type {
4242}
4343
4444impl Type {
45- pub fn implicit_declarations ( & self ) -> Option < impl Iterator < Item = Arc < NamedEntity > > + ' _ > {
46- let implicit = match self {
47- Type :: Array { ref implicit, .. } => implicit,
48- Type :: Enum ( ref implicit) => return Some ( either:: Either :: Left ( implicit. iter ( ) ) ) ,
49- Type :: Integer ( ref implicit) => implicit,
50- Type :: Physical ( ref implicit) => implicit,
51- Type :: File ( ref implicit) => implicit,
52- Type :: Access ( .., ref implicit) => implicit,
45+ pub fn implicit_declarations ( & self ) -> impl Iterator < Item = Arc < NamedEntity > > + ' _ {
46+ match self {
47+ Type :: Array { ref implicit, .. } => Some ( either :: Either :: Right ( implicit. iter ( ) ) ) ,
48+ Type :: Enum ( ref implicit) => Some ( either:: Either :: Left ( implicit. iter ( ) ) ) ,
49+ Type :: Integer ( ref implicit) => Some ( either :: Either :: Right ( implicit. iter ( ) ) ) ,
50+ Type :: Physical ( ref implicit) => Some ( either :: Either :: Right ( implicit. iter ( ) ) ) ,
51+ Type :: File ( ref implicit) => Some ( either :: Either :: Right ( implicit. iter ( ) ) ) ,
52+ Type :: Access ( .., ref implicit) => Some ( either :: Either :: Right ( implicit. iter ( ) ) ) ,
5353 Type :: Incomplete ( ..)
5454 | Type :: Interface
5555 | Type :: Protected ( ..)
5656 | Type :: Record ( ..)
5757 | Type :: Subtype ( ..)
58- | Type :: Alias ( ..) => {
59- return None ;
60- }
61- } ;
62-
63- Some ( either:: Either :: Right ( implicit. iter ( ) ) )
58+ | Type :: Alias ( ..) => None ,
59+ }
60+ . into_iter ( )
61+ . flatten ( )
6462 }
6563
6664 pub fn describe ( & self ) -> & str {
@@ -141,11 +139,13 @@ impl NamedEntityKind {
141139 matches ! ( self , NamedEntityKind :: Type ( ..) )
142140 }
143141
144- pub fn implicit_declarations ( & self ) -> Option < impl Iterator < Item = Arc < NamedEntity > > + ' _ > {
142+ pub fn implicit_declarations ( & self ) -> impl Iterator < Item = Arc < NamedEntity > > + ' _ {
145143 match self {
146- NamedEntityKind :: Type ( typ) => typ. implicit_declarations ( ) ,
144+ NamedEntityKind :: Type ( typ) => Some ( typ. implicit_declarations ( ) ) ,
147145 _ => None ,
148146 }
147+ . into_iter ( )
148+ . flatten ( )
149149 }
150150
151151 pub fn describe ( & self ) -> & str {
0 commit comments