about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGriffin Smith <grfn@gws.fyi>2020-07-12T21·49-0400
committerglittershark <grfn@gws.fyi>2020-07-13T23·50+0000
commit785ca363167983b04f3d1f17c2d1d464969a1a50 (patch)
tree7fa90f510676a85f4de31f35decd883e35f81f97
parentd5597b4784e04020b4ef4968a6887d4e22cc3edd (diff)
refactor(3p/nix): Remove unused insert_or_assign r/1286
This function in never called, so let's just remove it

Paired-With: Luke Granger-Brown <git@lukegb.com>
Paired-With: Vincent Ambo <mail@tazj.in>
Change-Id: I79125866254d90dd0842bc86830d2103ac313cb6
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1125
Tested-by: BuildkiteCI
Reviewed-by: lukegb <lukegb@tvl.fyi>
Reviewed-by: isomer <isomer@tvl.fyi>
-rw-r--r--third_party/nix/src/libexpr/attr-set.cc23
-rw-r--r--third_party/nix/src/libexpr/attr-set.hh3
2 files changed, 0 insertions, 26 deletions
diff --git a/third_party/nix/src/libexpr/attr-set.cc b/third_party/nix/src/libexpr/attr-set.cc
index 0c8dc0baa42e..c5cfbf3caf5f 100644
--- a/third_party/nix/src/libexpr/attr-set.cc
+++ b/third_party/nix/src/libexpr/attr-set.cc
@@ -66,7 +66,6 @@ class BTreeBindings : public Bindings {
   size_t size() override;
   bool empty() override;
   void push_back(const Attr& attr) override;
-  void insert_or_assign(Attr& attr) override;
   Bindings::iterator find(const Symbol& name) override;
   Bindings::iterator begin() override;
   Bindings::iterator end() override;
@@ -96,11 +95,6 @@ void BTreeBindings::push_back(const Attr& attr) {
   }
 }
 
-// Insert or assign (i.e. replace) a value in the attribute set.
-void BTreeBindings::insert_or_assign(Attr& attr) {
-  attributes_.insert_or_assign(attr.name, attr);
-}
-
 size_t BTreeBindings::size() { return attributes_.size(); }
 
 bool BTreeBindings::empty() { return attributes_.empty(); }
@@ -144,7 +138,6 @@ class VectorBindings : public Bindings {
   size_t size() override;
   bool empty() override;
   void push_back(const Attr& attr) override;
-  void insert_or_assign(Attr& attr) override;
   Bindings::iterator find(const Symbol& name) override;
   Bindings::iterator begin() override;
   Bindings::iterator end() override;
@@ -159,22 +152,6 @@ size_t VectorBindings::size() { return attributes_.size(); }
 
 bool VectorBindings::empty() { return attributes_.empty(); }
 
-// Insert or assign (i.e. replace) a value in the attribute set.
-void VectorBindings::insert_or_assign(Attr& attr) {
-  for (auto it = attributes_.begin(); it != attributes_.end(); ++it) {
-    if (it->first == attr.name) {
-      it->second = attr;
-      return;
-    } else if (attr.name < it->first) {
-      // TODO convert to BTreeMap if we get big enough
-      attributes_.emplace(it, attr.name, attr);
-      return;
-    }
-  }
-
-  attributes_.emplace_back(attr.name, attr);
-}
-
 void VectorBindings::merge(Bindings& other) {
   AttributeVector new_attributes;
   new_attributes.reserve(size() + other.size());
diff --git a/third_party/nix/src/libexpr/attr-set.hh b/third_party/nix/src/libexpr/attr-set.hh
index 55641a020325..795ee2337fc7 100644
--- a/third_party/nix/src/libexpr/attr-set.hh
+++ b/third_party/nix/src/libexpr/attr-set.hh
@@ -80,9 +80,6 @@ class Bindings {
   // Insert, but do not replace, values in the attribute set.
   virtual void push_back(const Attr& attr) = 0;
 
-  // Insert a value, or replace an existing one.
-  virtual void insert_or_assign(Attr& attr) = 0;
-
   // Look up a specific element of the attribute set.
   virtual iterator find(const Symbol& name) = 0;