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 @@ -126,10 +126,17 @@ fn insert(path: &Path, entry: IndexEntry) -> anyhow::Result<()> {
126
126
127
127
let index = index. entry ( path. to_string ( ) ) . or_default ( ) ;
128
128
129
- // Retain the first occurrence in the index. In the future we'll track every occurrences and
130
- // their scopes but for now we only track the first definition of an object (in a way, its
129
+ // We generally retain only the first occurrence in the index. In the
130
+ // future we'll track every occurrences and their scopes but for now we
131
+ // only track the first definition of an object (in a way, its
131
132
// declaration).
132
- if !index. contains_key ( & entry. key ) {
133
+ if let Some ( existing_entry) = index. get ( & entry. key ) {
134
+ // Give priority to non-section entries.
135
+ if matches ! ( existing_entry. data, IndexEntryData :: Section { .. } ) {
136
+ index. insert ( entry. key . clone ( ) , entry) ;
137
+ }
138
+ // Else, ignore.
139
+ } else {
133
140
index. insert ( entry. key . clone ( ) , entry) ;
134
141
}
135
142
You can’t perform that action at this time.
0 commit comments