From 785ca363167983b04f3d1f17c2d1d464969a1a50 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Sun, 12 Jul 2020 17:49:22 -0400 Subject: refactor(3p/nix): Remove unused insert_or_assign This function in never called, so let's just remove it Paired-With: Luke Granger-Brown Paired-With: Vincent Ambo Change-Id: I79125866254d90dd0842bc86830d2103ac313cb6 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1125 Tested-by: BuildkiteCI Reviewed-by: lukegb Reviewed-by: isomer --- third_party/nix/src/libexpr/attr-set.cc | 23 ----------------------- third_party/nix/src/libexpr/attr-set.hh | 3 --- 2 files changed, 26 deletions(-) (limited to 'third_party/nix') 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; -- cgit 1.4.1