aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/codegen
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-01-11 02:41:42 +0530
committerbors-servo <lbergstrom+bors@mozilla.com>2016-01-11 02:41:42 +0530
commit85792d281964858d3a9ff4fa46e2c7cd8700c03f (patch)
tree06dde21d46a4c92823a21c3f71ccd12d9f29698a /components/script/dom/bindings/codegen
parent4056716ecdf5382eadf5866f7ac08ee49dcda8bb (diff)
parentd63c9d79d382348ca305b17ca5ce156f8152747d (diff)
downloadservo-85792d281964858d3a9ff4fa46e2c7cd8700c03f.tar.gz
servo-85792d281964858d3a9ff4fa46e2c7cd8700c03f.zip
Auto merge of #9200 - frewsxcv:unnecessary-sorting-functions, r=nox
Remove unneeded dict sorting functions in CodegenRust.py <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9200) <!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/bindings/codegen')
-rw-r--r--components/script/dom/bindings/codegen/CodegenRust.py22
1 files changed, 4 insertions, 18 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py
index 3161d3754c9..24b034ad4cb 100644
--- a/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/components/script/dom/bindings/codegen/CodegenRust.py
@@ -1983,23 +1983,6 @@ def getAllTypes(descriptors, dictionaries, callbacks):
yield (t, None, None)
-def SortedTuples(l):
- """
- Sort a list of tuples based on the first item in the tuple
- """
- return sorted(l, key=operator.itemgetter(0))
-
-
-def SortedDictValues(d):
- """
- Returns a list of values from the dict sorted by key.
- """
- # Create a list of tuples containing key and value, sorted on key.
- d = SortedTuples(d.items())
- # We're only interested in the values.
- return (i[1] for i in d)
-
-
def UnionTypes(descriptors, dictionaries, callbacks, config):
"""
Returns a CGList containing CGUnionStructs for every union.
@@ -2038,7 +2021,10 @@ def UnionTypes(descriptors, dictionaries, callbacks, config):
CGUnionConversionStruct(t, provider)
])
- return CGImports(CGList(SortedDictValues(unionStructs), "\n\n"), [], [], imports, ignored_warnings=[])
+ # Sort unionStructs by key, retrieve value
+ unionStructs = (i[1] for i in sorted(unionStructs.items(), key=operator.itemgetter(0)))
+
+ return CGImports(CGList(unionStructs, "\n\n"), [], [], imports, ignored_warnings=[])
class Argument():