File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -2111,10 +2111,12 @@ fn get_all_import_attributes<'hir>(
2111
2111
) {
2112
2112
let hir_map = tcx. hir ( ) ;
2113
2113
let mut visitor = OneLevelVisitor :: new ( hir_map, target_hir_id) ;
2114
+ let mut visited = FxHashSet :: default ( ) ;
2114
2115
// If the item is an import and has at least a path with two parts, we go into it.
2115
2116
while let hir:: ItemKind :: Use ( path, _) = item. kind &&
2116
2117
path. segments . len ( ) > 1 &&
2117
- let hir:: def:: Res :: Def ( _, def_id) = path. segments [ path. segments . len ( ) - 2 ] . res
2118
+ let hir:: def:: Res :: Def ( _, def_id) = path. segments [ path. segments . len ( ) - 2 ] . res &&
2119
+ visited. insert ( def_id)
2118
2120
{
2119
2121
if let Some ( hir:: Node :: Item ( parent_item) ) = hir_map. get_if_local ( def_id) {
2120
2122
// We add the attributes from this import into the list.
You can’t perform that action at this time.
0 commit comments