]> git.lizzy.rs Git - rust.git/commitdiff
Use a HashSet instead of Vec
authorMark Rousskov <mark.simulacrum@gmail.com>
Sat, 10 Aug 2019 21:10:13 +0000 (17:10 -0400)
committerMark Rousskov <mark.simulacrum@gmail.com>
Sun, 11 Aug 2019 14:36:46 +0000 (10:36 -0400)
src/librustdoc/clean/inline.rs
src/librustdoc/core.rs

index a8336607f7ae9978d3daecc09dea5a8ae76ebd66..6f93c95edef08713d5a625ac8b3a1a46b576e455 100644 (file)
@@ -581,13 +581,11 @@ pub fn record_extern_trait(cx: &DocContext<'_>, did: DefId) {
         }
     }
 
-    cx.active_extern_traits.borrow_mut().push(did);
+    cx.active_extern_traits.borrow_mut().insert(did);
 
     debug!("record_extern_trait: {:?}", did);
     let trait_ = build_external_trait(cx, did);
 
-    {
-        cx.external_traits.borrow_mut().insert(did, trait_);
-    }
-    cx.active_extern_traits.borrow_mut().remove_item(&did);
+    cx.external_traits.borrow_mut().insert(did, trait_);
+    cx.active_extern_traits.borrow_mut().remove(&did);
 }
index c7695fbd8d2616b607bff484c9a4cb669d97d899..87381f224d0bb424482d1c6f409599da3a84f81b 100644 (file)
@@ -51,7 +51,7 @@ pub struct DocContext<'tcx> {
     pub external_traits: Rc<RefCell<FxHashMap<DefId, clean::Trait>>>,
     /// Used while populating `external_traits` to ensure we don't process the same trait twice at
     /// the same time.
-    pub active_extern_traits: RefCell<Vec<DefId>>,
+    pub active_extern_traits: RefCell<FxHashSet<DefId>>,
     // The current set of type and lifetime substitutions,
     // for expanding type aliases at the HIR level: