File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -121,10 +121,17 @@ fn insert(path: &Path, entry: IndexEntry) -> anyhow::Result<()> {
121
121
122
122
let index = index. entry ( path. to_string ( ) ) . or_default ( ) ;
123
123
124
- // Retain the first occurrence in the index. In the future we'll track every occurrences and
125
- // their scopes but for now we only track the first definition of an object (in a way, its
124
+ // We generally retain only the first occurrence in the index. In the
125
+ // future we'll track every occurrences and their scopes but for now we
126
+ // only track the first definition of an object (in a way, its
126
127
// declaration).
127
- if !index. contains_key ( & entry. key ) {
128
+ if let Some ( existing_entry) = index. get ( & entry. key ) {
129
+ // Give priority to non-section entries.
130
+ if matches ! ( existing_entry. data, IndexEntryData :: Section { .. } ) {
131
+ index. insert ( entry. key . clone ( ) , entry) ;
132
+ }
133
+ // Else, ignore.
134
+ } else {
128
135
index. insert ( entry. key . clone ( ) , entry) ;
129
136
}
130
137
You can’t perform that action at this time.
0 commit comments