aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock178
-rw-r--r--crates/ra_editor/Cargo.toml12
-rw-r--r--crates/ra_editor/benches/translate_offset_with_edit_benchmark.rs87
-rw-r--r--crates/ra_editor/src/line_index.rs23
-rw-r--r--crates/ra_editor/src/line_index_utils.rs63
-rw-r--r--crates/ra_text_edit/src/test_utils.rs72
-rw-r--r--crates/ra_text_edit/src/text_edit.rs15
7 files changed, 69 insertions, 381 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 1ee2df8dd..127d7772a 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -123,11 +123,6 @@ dependencies = [
123] 123]
124 124
125[[package]] 125[[package]]
126name = "cast"
127version = "0.2.2"
128source = "registry+https://github.com/rust-lang/crates.io-index"
129
130[[package]]
131name = "cc" 126name = "cc"
132version = "1.0.27" 127version = "1.0.27"
133source = "registry+https://github.com/rust-lang/crates.io-index" 128source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -170,51 +165,6 @@ dependencies = [
170] 165]
171 166
172[[package]] 167[[package]]
173name = "criterion"
174version = "0.2.5"
175source = "registry+https://github.com/rust-lang/crates.io-index"
176dependencies = [
177 "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
178 "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
179 "criterion-plot 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
180 "criterion-stats 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
181 "csv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
182 "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
183 "failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
184 "handlebars 0.32.4 (registry+https://github.com/rust-lang/crates.io-index)",
185 "itertools 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)",
186 "itertools-num 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
187 "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
188 "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
189 "serde_derive 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
190 "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
191 "simplelog 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
192 "walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
193]
194
195[[package]]
196name = "criterion-plot"
197version = "0.2.5"
198source = "registry+https://github.com/rust-lang/crates.io-index"
199dependencies = [
200 "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
201 "cast 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
202 "itertools 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)",
203]
204
205[[package]]
206name = "criterion-stats"
207version = "0.2.5"
208source = "registry+https://github.com/rust-lang/crates.io-index"
209dependencies = [
210 "cast 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
211 "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
212 "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
213 "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
214 "thread-scoped 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
215]
216
217[[package]]
218name = "crossbeam-channel" 168name = "crossbeam-channel"
219version = "0.2.6" 169version = "0.2.6"
220source = "registry+https://github.com/rust-lang/crates.io-index" 170source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -284,23 +234,6 @@ dependencies = [
284] 234]
285 235
286[[package]] 236[[package]]
287name = "csv"
288version = "1.0.5"
289source = "registry+https://github.com/rust-lang/crates.io-index"
290dependencies = [
291 "csv-core 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
292 "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
293]
294
295[[package]]
296name = "csv-core"
297version = "0.1.5"
298source = "registry+https://github.com/rust-lang/crates.io-index"
299dependencies = [
300 "memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
301]
302
303[[package]]
304name = "derive-new" 237name = "derive-new"
305version = "0.5.6" 238version = "0.5.6"
306source = "registry+https://github.com/rust-lang/crates.io-index" 239source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -436,21 +369,6 @@ version = "0.2.11"
436source = "registry+https://github.com/rust-lang/crates.io-index" 369source = "registry+https://github.com/rust-lang/crates.io-index"
437 370
438[[package]] 371[[package]]
439name = "handlebars"
440version = "0.32.4"
441source = "registry+https://github.com/rust-lang/crates.io-index"
442dependencies = [
443 "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
444 "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
445 "pest 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
446 "pest_derive 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
447 "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
448 "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
449 "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
450 "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
451]
452
453[[package]]
454name = "heck" 372name = "heck"
455version = "0.3.1" 373version = "0.3.1"
456source = "registry+https://github.com/rust-lang/crates.io-index" 374source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -501,14 +419,6 @@ dependencies = [
501] 419]
502 420
503[[package]] 421[[package]]
504name = "itertools-num"
505version = "0.1.3"
506source = "registry+https://github.com/rust-lang/crates.io-index"
507dependencies = [
508 "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
509]
510
511[[package]]
512name = "itoa" 422name = "itoa"
513version = "0.4.3" 423version = "0.4.3"
514source = "registry+https://github.com/rust-lang/crates.io-index" 424source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -688,11 +598,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
688 598
689[[package]] 599[[package]]
690name = "pest" 600name = "pest"
691version = "1.0.6"
692source = "registry+https://github.com/rust-lang/crates.io-index"
693
694[[package]]
695name = "pest"
696version = "2.0.2" 601version = "2.0.2"
697source = "registry+https://github.com/rust-lang/crates.io-index" 602source = "registry+https://github.com/rust-lang/crates.io-index"
698dependencies = [ 603dependencies = [
@@ -701,16 +606,6 @@ dependencies = [
701 606
702[[package]] 607[[package]]
703name = "pest_derive" 608name = "pest_derive"
704version = "1.0.8"
705source = "registry+https://github.com/rust-lang/crates.io-index"
706dependencies = [
707 "pest 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
708 "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
709 "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)",
710]
711
712[[package]]
713name = "pest_derive"
714version = "2.0.1" 609version = "2.0.1"
715source = "registry+https://github.com/rust-lang/crates.io-index" 610source = "registry+https://github.com/rust-lang/crates.io-index"
716dependencies = [ 611dependencies = [
@@ -772,11 +667,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
772 667
773[[package]] 668[[package]]
774name = "quote" 669name = "quote"
775version = "0.3.15"
776source = "registry+https://github.com/rust-lang/crates.io-index"
777
778[[package]]
779name = "quote"
780version = "0.6.10" 670version = "0.6.10"
781source = "registry+https://github.com/rust-lang/crates.io-index" 671source = "registry+https://github.com/rust-lang/crates.io-index"
782dependencies = [ 672dependencies = [
@@ -831,15 +721,11 @@ dependencies = [
831name = "ra_editor" 721name = "ra_editor"
832version = "0.1.0" 722version = "0.1.0"
833dependencies = [ 723dependencies = [
834 "criterion 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
835 "itertools 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)", 724 "itertools 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)",
836 "join_to_string 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 725 "join_to_string 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
837 "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
838 "proptest 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)", 726 "proptest 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)",
839 "ra_syntax 0.1.0", 727 "ra_syntax 0.1.0",
840 "ra_text_edit 0.1.0", 728 "ra_text_edit 0.1.0",
841 "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
842 "rand_xorshift 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
843 "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 729 "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
844 "superslice 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 730 "superslice 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
845 "test_utils 0.1.0", 731 "test_utils 0.1.0",
@@ -1241,16 +1127,6 @@ dependencies = [
1241] 1127]
1242 1128
1243[[package]] 1129[[package]]
1244name = "simplelog"
1245version = "0.5.3"
1246source = "registry+https://github.com/rust-lang/crates.io-index"
1247dependencies = [
1248 "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
1249 "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
1250 "term 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
1251]
1252
1253[[package]]
1254name = "slug" 1130name = "slug"
1255version = "0.1.4" 1131version = "0.1.4"
1256source = "registry+https://github.com/rust-lang/crates.io-index" 1132source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1291,16 +1167,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1291 1167
1292[[package]] 1168[[package]]
1293name = "syn" 1169name = "syn"
1294version = "0.11.11"
1295source = "registry+https://github.com/rust-lang/crates.io-index"
1296dependencies = [
1297 "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
1298 "synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)",
1299 "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
1300]
1301
1302[[package]]
1303name = "syn"
1304version = "0.14.9" 1170version = "0.14.9"
1305source = "registry+https://github.com/rust-lang/crates.io-index" 1171source = "registry+https://github.com/rust-lang/crates.io-index"
1306dependencies = [ 1172dependencies = [
@@ -1320,14 +1186,6 @@ dependencies = [
1320] 1186]
1321 1187
1322[[package]] 1188[[package]]
1323name = "synom"
1324version = "0.11.3"
1325source = "registry+https://github.com/rust-lang/crates.io-index"
1326dependencies = [
1327 "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
1328]
1329
1330[[package]]
1331name = "synstructure" 1189name = "synstructure"
1332version = "0.10.1" 1190version = "0.10.1"
1333source = "registry+https://github.com/rust-lang/crates.io-index" 1191source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1392,15 +1250,6 @@ dependencies = [
1392] 1250]
1393 1251
1394[[package]] 1252[[package]]
1395name = "term"
1396version = "0.5.1"
1397source = "registry+https://github.com/rust-lang/crates.io-index"
1398dependencies = [
1399 "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
1400 "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
1401]
1402
1403[[package]]
1404name = "termion" 1253name = "termion"
1405version = "1.5.1" 1254version = "1.5.1"
1406source = "registry+https://github.com/rust-lang/crates.io-index" 1255source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1437,11 +1286,6 @@ dependencies = [
1437] 1286]
1438 1287
1439[[package]] 1288[[package]]
1440name = "thread-scoped"
1441version = "1.0.2"
1442source = "registry+https://github.com/rust-lang/crates.io-index"
1443
1444[[package]]
1445name = "thread_local" 1289name = "thread_local"
1446version = "0.3.6" 1290version = "0.3.6"
1447source = "registry+https://github.com/rust-lang/crates.io-index" 1291source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1571,11 +1415,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1571 1415
1572[[package]] 1416[[package]]
1573name = "unicode-xid" 1417name = "unicode-xid"
1574version = "0.0.4"
1575source = "registry+https://github.com/rust-lang/crates.io-index"
1576
1577[[package]]
1578name = "unicode-xid"
1579version = "0.1.0" 1418version = "0.1.0"
1580source = "registry+https://github.com/rust-lang/crates.io-index" 1419source = "registry+https://github.com/rust-lang/crates.io-index"
1581 1420
@@ -1688,15 +1527,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1688"checksum byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" 1527"checksum byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40"
1689"checksum byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94f88df23a25417badc922ab0f5716cc1330e87f71ddd9203b3a3ccd9cedf75d" 1528"checksum byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94f88df23a25417badc922ab0f5716cc1330e87f71ddd9203b3a3ccd9cedf75d"
1690"checksum cargo_metadata 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "e5d1b4d380e1bab994591a24c2bdd1b054f64b60bef483a8c598c7c345bc3bbe" 1529"checksum cargo_metadata 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "e5d1b4d380e1bab994591a24c2bdd1b054f64b60bef483a8c598c7c345bc3bbe"
1691"checksum cast 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "926013f2860c46252efceabb19f4a6b308197505082c609025aa6706c011d427"
1692"checksum cc 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)" = "155ed195f7bd722d1dfeb30365b9d0c1f6a078fa7ca4014497e5935d90993d6f" 1530"checksum cc 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)" = "155ed195f7bd722d1dfeb30365b9d0c1f6a078fa7ca4014497e5935d90993d6f"
1693"checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" 1531"checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4"
1694"checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878" 1532"checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878"
1695"checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e" 1533"checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e"
1696"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" 1534"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
1697"checksum criterion 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c47d2b548c5647e1a436dc0cb78d4ebf51b6bf7ab101ed76662828bdd4d3a24a"
1698"checksum criterion-plot 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6e649d6aacdbbdb94ec659561a309a71336fc5655ed408f3afd28df2fc0c4f4f"
1699"checksum criterion-stats 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ff43cac80562f91ead0b617c1be74edf350adfaa195809d355de98dfc8f9237d"
1700"checksum crossbeam-channel 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7b85741761b7f160bc5e7e0c14986ef685b7f8bf9b7ad081c60c604bb4649827" 1535"checksum crossbeam-channel 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7b85741761b7f160bc5e7e0c14986ef685b7f8bf9b7ad081c60c604bb4649827"
1701"checksum crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f739f8c5363aca78cfb059edf753d8f0d36908c348f3d8d1503f03d8b75d9cf3" 1536"checksum crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f739f8c5363aca78cfb059edf753d8f0d36908c348f3d8d1503f03d8b75d9cf3"
1702"checksum crossbeam-epoch 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "927121f5407de9956180ff5e936fe3cf4324279280001cd56b669d28ee7e9150" 1537"checksum crossbeam-epoch 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "927121f5407de9956180ff5e936fe3cf4324279280001cd56b669d28ee7e9150"
@@ -1704,8 +1539,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1704"checksum crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2760899e32a1d58d5abb31129f8fae5de75220bc2176e77ff7c627ae45c918d9" 1539"checksum crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2760899e32a1d58d5abb31129f8fae5de75220bc2176e77ff7c627ae45c918d9"
1705"checksum crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "677d453a17e8bd2b913fa38e8b9cf04bcdbb5be790aa294f2389661d72036015" 1540"checksum crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "677d453a17e8bd2b913fa38e8b9cf04bcdbb5be790aa294f2389661d72036015"
1706"checksum crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "41ee4864f4797060e52044376f7d107429ce1fb43460021b126424b7180ee21a" 1541"checksum crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "41ee4864f4797060e52044376f7d107429ce1fb43460021b126424b7180ee21a"
1707"checksum csv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "9fd1c44c58078cfbeaf11fbb3eac9ae5534c23004ed770cc4bfb48e658ae4f04"
1708"checksum csv-core 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "fa5cdef62f37e6ffe7d1f07a381bc0db32b7a3ff1cac0de56cb0d81e71f53d65"
1709"checksum derive-new 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "6ca414e896ae072546f4d789f452daaecf60ddee4c9df5dc6d5936d769e3d87c" 1542"checksum derive-new 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "6ca414e896ae072546f4d789f452daaecf60ddee4c9df5dc6d5936d769e3d87c"
1710"checksum deunicode 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "850878694b7933ca4c9569d30a34b55031b9b139ee1fc7b94a527c4ef960d690" 1543"checksum deunicode 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "850878694b7933ca4c9569d30a34b55031b9b139ee1fc7b94a527c4ef960d690"
1711"checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" 1544"checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198"
@@ -1723,7 +1556,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1723"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" 1556"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
1724"checksum generic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ef25c5683767570c2bbd7deba372926a55eaae9982d7726ee2a1050239d45b9d" 1557"checksum generic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ef25c5683767570c2bbd7deba372926a55eaae9982d7726ee2a1050239d45b9d"
1725"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" 1558"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb"
1726"checksum handlebars 0.32.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d89ec99d1594f285d4590fc32bac5f75cdab383f1123d504d27862c644a807dd"
1727"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" 1559"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205"
1728"checksum humansize 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b6cab2627acfc432780848602f3f558f7e9dd427352224b0d9324025796d2a5e" 1560"checksum humansize 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b6cab2627acfc432780848602f3f558f7e9dd427352224b0d9324025796d2a5e"
1729"checksum id-arena 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3a7250033feafee46a1cecd2c2616a64aec1d064f38c9ae2bdd297728542843e" 1561"checksum id-arena 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3a7250033feafee46a1cecd2c2616a64aec1d064f38c9ae2bdd297728542843e"
@@ -1731,7 +1563,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1731"checksum im 12.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ae9c7f9bb8aee47fc16d535a705f7867a9fc83bb822e5e1043bb98e77ffeed3c" 1563"checksum im 12.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ae9c7f9bb8aee47fc16d535a705f7867a9fc83bb822e5e1043bb98e77ffeed3c"
1732"checksum indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7e81a7c05f79578dbc15793d8b619db9ba32b4577003ef3af1a91c416798c58d" 1564"checksum indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7e81a7c05f79578dbc15793d8b619db9ba32b4577003ef3af1a91c416798c58d"
1733"checksum itertools 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0d47946d458e94a1b7bcabbf6521ea7c037062c81f534615abcad76e84d4970d" 1565"checksum itertools 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0d47946d458e94a1b7bcabbf6521ea7c037062c81f534615abcad76e84d4970d"
1734"checksum itertools-num 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a872a22f9e6f7521ca557660adb96dd830e54f0f490fa115bb55dd69d38b27e7"
1735"checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" 1566"checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b"
1736"checksum join_to_string 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7bddc885f3fd69dd4b5d747c2efe6dd2c36d795ea9938281ed50910e32c95e31" 1567"checksum join_to_string 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7bddc885f3fd69dd4b5d747c2efe6dd2c36d795ea9938281ed50910e32c95e31"
1737"checksum languageserver-types 0.53.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a0be4f8f783832a308975035043c0e8ad18e11c3f3d395aa6f1a9f3a30b8e654" 1568"checksum languageserver-types 0.53.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a0be4f8f783832a308975035043c0e8ad18e11c3f3d395aa6f1a9f3a30b8e654"
@@ -1755,16 +1586,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1755"checksum parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad7f7e6ebdc79edff6fdcb87a55b620174f7a989e3eb31b65231f4af57f00b8c" 1586"checksum parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad7f7e6ebdc79edff6fdcb87a55b620174f7a989e3eb31b65231f4af57f00b8c"
1756"checksum parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9" 1587"checksum parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9"
1757"checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" 1588"checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831"
1758"checksum pest 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0fce5d8b5cc33983fc74f78ad552b5522ab41442c4ca91606e4236eb4b5ceefc"
1759"checksum pest 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a677051ad923732bb5c70f2d45f8985a96e3eee2e2bff86697e3b11b0c3fcfde" 1589"checksum pest 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a677051ad923732bb5c70f2d45f8985a96e3eee2e2bff86697e3b11b0c3fcfde"
1760"checksum pest_derive 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3294f437119209b084c797604295f40227cffa35c57220b1e99a6ff3bf8ee4"
1761"checksum pest_derive 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b76f477146419bc539a63f4ef40e902166cb43b3e51cecc71d9136fd12c567e7" 1590"checksum pest_derive 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b76f477146419bc539a63f4ef40e902166cb43b3e51cecc71d9136fd12c567e7"
1762"checksum pest_generator 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ebee4e9680be4fd162e6f3394ae4192a6b60b1e4d17d845e631f0c68d1a3386" 1591"checksum pest_generator 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ebee4e9680be4fd162e6f3394ae4192a6b60b1e4d17d845e631f0c68d1a3386"
1763"checksum pest_meta 2.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1f6d5f6f0e6082578c86af197d780dc38328e3f768cec06aac9bc46d714e8221" 1592"checksum pest_meta 2.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1f6d5f6f0e6082578c86af197d780dc38328e3f768cec06aac9bc46d714e8221"
1764"checksum proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)" = "77619697826f31a02ae974457af0b29b723e5619e113e9397b8b82c6bd253f09" 1593"checksum proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)" = "77619697826f31a02ae974457af0b29b723e5619e113e9397b8b82c6bd253f09"
1765"checksum proptest 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)" = "926d0604475349f463fe44130aae73f2294b5309ab2ca0310b998bd334ef191f" 1594"checksum proptest 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)" = "926d0604475349f463fe44130aae73f2294b5309ab2ca0310b998bd334ef191f"
1766"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" 1595"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0"
1767"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a"
1768"checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c" 1596"checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c"
1769"checksum rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8356f47b32624fef5b3301c1be97e5944ecdd595409cc5da11d05f211db6cfbd" 1597"checksum rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8356f47b32624fef5b3301c1be97e5944ecdd595409cc5da11d05f211db6cfbd"
1770"checksum rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c" 1598"checksum rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c"
@@ -1801,27 +1629,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1801"checksum serde_derive 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)" = "96a7f9496ac65a2db5929afa087b54f8fc5008dcfbe48a8874ed20049b0d6154" 1629"checksum serde_derive 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)" = "96a7f9496ac65a2db5929afa087b54f8fc5008dcfbe48a8874ed20049b0d6154"
1802"checksum serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)" = "c37ccd6be3ed1fdf419ee848f7c758eb31b054d7cd3ae3600e3bae0adf569811" 1630"checksum serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)" = "c37ccd6be3ed1fdf419ee848f7c758eb31b054d7cd3ae3600e3bae0adf569811"
1803"checksum sha-1 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "51b9d1f3b5de8a167ab06834a7c883bd197f2191e1dda1a22d9ccfeedbf9aded" 1631"checksum sha-1 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "51b9d1f3b5de8a167ab06834a7c883bd197f2191e1dda1a22d9ccfeedbf9aded"
1804"checksum simplelog 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e95345f185d5adeb8ec93459d2dc99654e294cc6ccf5b75414d8ea262de9a13"
1805"checksum slug 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b3bc762e6a4b6c6fcaade73e77f9ebc6991b676f88bb2358bddb56560f073373" 1632"checksum slug 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b3bc762e6a4b6c6fcaade73e77f9ebc6991b676f88bb2358bddb56560f073373"
1806"checksum smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "b73ea3738b47563803ef814925e69be00799a8c07420be8b996f8e98fb2336db" 1633"checksum smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "b73ea3738b47563803ef814925e69be00799a8c07420be8b996f8e98fb2336db"
1807"checksum smol_str 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "486a74e9b9fc53373808f7a17e10fc728adcb1fbe272292271d8bea61175e181" 1634"checksum smol_str 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "486a74e9b9fc53373808f7a17e10fc728adcb1fbe272292271d8bea61175e181"
1808"checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" 1635"checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8"
1809"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" 1636"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550"
1810"checksum superslice 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b50b13d42370e0f5fc62eafdd5c2d20065eaf5458dab215ff3e20e63eea96b30" 1637"checksum superslice 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b50b13d42370e0f5fc62eafdd5c2d20065eaf5458dab215ff3e20e63eea96b30"
1811"checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad"
1812"checksum syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)" = "261ae9ecaa397c42b960649561949d69311f08eeaea86a65696e6e46517cf741" 1638"checksum syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)" = "261ae9ecaa397c42b960649561949d69311f08eeaea86a65696e6e46517cf741"
1813"checksum syn 0.15.23 (registry+https://github.com/rust-lang/crates.io-index)" = "9545a6a093a3f0bd59adb472700acc08cad3776f860f16a897dfce8c88721cbc" 1639"checksum syn 0.15.23 (registry+https://github.com/rust-lang/crates.io-index)" = "9545a6a093a3f0bd59adb472700acc08cad3776f860f16a897dfce8c88721cbc"
1814"checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6"
1815"checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" 1640"checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015"
1816"checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" 1641"checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8"
1817"checksum tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "7e91405c14320e5c79b3d148e1c86f40749a36e490642202a31689cb1a3452b2" 1642"checksum tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "7e91405c14320e5c79b3d148e1c86f40749a36e490642202a31689cb1a3452b2"
1818"checksum tera 0.11.20 (registry+https://github.com/rust-lang/crates.io-index)" = "4b505279e19d8f7d24b1a9dc58327c9c36174b1a2c7ebdeac70792d017cb64f3" 1643"checksum tera 0.11.20 (registry+https://github.com/rust-lang/crates.io-index)" = "4b505279e19d8f7d24b1a9dc58327c9c36174b1a2c7ebdeac70792d017cb64f3"
1819"checksum teraron 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0d89ad4617d1dec55331067fadaa041e813479e1779616f3d3ce9308bf46184e" 1644"checksum teraron 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0d89ad4617d1dec55331067fadaa041e813479e1779616f3d3ce9308bf46184e"
1820"checksum term 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5e6b677dd1e8214ea1ef4297f85dbcbed8e8cdddb561040cc998ca2551c37561"
1821"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" 1645"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096"
1822"checksum text_unit 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "8009d7bdbd896a7e09b595f8f9325a19047fc708653e60d0895202b82135048f" 1646"checksum text_unit 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "8009d7bdbd896a7e09b595f8f9325a19047fc708653e60d0895202b82135048f"
1823"checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6" 1647"checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6"
1824"checksum thread-scoped 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bcbb6aa301e5d3b0b5ef639c9a9c7e2f1c944f177b460c04dc24c69b1fa2bd99"
1825"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" 1648"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
1826"checksum threadpool 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e2f0c90a5f3459330ac8bc0d2f879c693bb7a2f59689c1083fc4ef83834da865" 1649"checksum threadpool 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e2f0c90a5f3459330ac8bc0d2f879c693bb7a2f59689c1083fc4ef83834da865"
1827"checksum time 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "847da467bf0db05882a9e2375934a8a55cffdc9db0d128af1518200260ba1f6c" 1650"checksum time 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "847da467bf0db05882a9e2375934a8a55cffdc9db0d128af1518200260ba1f6c"
@@ -1838,7 +1661,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1838"checksum unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6a0180bc61fc5a987082bfa111f4cc95c4caff7f9799f3e46df09163a937aa25" 1661"checksum unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6a0180bc61fc5a987082bfa111f4cc95c4caff7f9799f3e46df09163a937aa25"
1839"checksum unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "aa6024fc12ddfd1c6dbc14a80fa2324d4568849869b779f6bd37e5e4c03344d1" 1662"checksum unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "aa6024fc12ddfd1c6dbc14a80fa2324d4568849869b779f6bd37e5e4c03344d1"
1840"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" 1663"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526"
1841"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc"
1842"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" 1664"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
1843"checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" 1665"checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56"
1844"checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" 1666"checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a"
diff --git a/crates/ra_editor/Cargo.toml b/crates/ra_editor/Cargo.toml
index 7ed7526ec..1ad99af28 100644
--- a/crates/ra_editor/Cargo.toml
+++ b/crates/ra_editor/Cargo.toml
@@ -18,15 +18,3 @@ proptest = "0.8.7"
18 18
19[dev-dependencies] 19[dev-dependencies]
20test_utils = { path = "../test_utils" } 20test_utils = { path = "../test_utils" }
21criterion = "0.2"
22rand = "*"
23rand_xorshift = "*"
24lazy_static = "*"
25
26[lib]
27# so that criterion arguments work, see: https://bheisler.github.io/criterion.rs/book/faq.html#cargo-bench-gives-unrecognized-option-errors-for-valid-command-line-options
28bench = false
29
30[[bench]]
31name = "translate_offset_with_edit_benchmark"
32harness = false \ No newline at end of file
diff --git a/crates/ra_editor/benches/translate_offset_with_edit_benchmark.rs b/crates/ra_editor/benches/translate_offset_with_edit_benchmark.rs
deleted file mode 100644
index 0f550fd39..000000000
--- a/crates/ra_editor/benches/translate_offset_with_edit_benchmark.rs
+++ /dev/null
@@ -1,87 +0,0 @@
1use criterion::{criterion_group, criterion_main};
2use criterion::Criterion;
3use criterion::Fun;
4use ra_text_edit::AtomTextEdit;
5use ra_text_edit::test_utils::{arb_edits_custom, arb_offset};
6use ra_editor::line_index_utils;
7use ra_editor::LineIndex;
8use ra_syntax::TextUnit;
9use proptest::test_runner;
10use proptest::string::string_regex;
11use proptest::strategy::{Strategy, ValueTree};
12use rand_xorshift::XorShiftRng;
13use rand::SeedableRng;
14use lazy_static::lazy_static;
15
16#[derive(Debug)]
17struct Data {
18 text: String,
19 line_index: LineIndex,
20 edits: Vec<AtomTextEdit>,
21 offset: TextUnit,
22}
23
24fn setup_data() -> Data {
25 let mut runner = test_runner::TestRunner::default();
26 {
27 struct TestRng {
28 rng: XorShiftRng,
29 }
30 // HACK to be able to manually seed the TestRunner
31 let rng: &mut TestRng = unsafe { std::mem::transmute(runner.rng()) };
32 rng.rng = XorShiftRng::seed_from_u64(0);
33 }
34
35 let text = {
36 let arb = string_regex("([a-zA-Z_0-9]{10,50}.{1,5}\n){100,500}").unwrap();
37 let tree = arb.new_tree(&mut runner).unwrap();
38 tree.current()
39 };
40
41 let edits = {
42 let arb = arb_edits_custom(&text, 99, 100);
43 let tree = arb.new_tree(&mut runner).unwrap();
44 tree.current()
45 };
46
47 let offset = {
48 let arb = arb_offset(&text);
49 let tree = arb.new_tree(&mut runner).unwrap();
50 tree.current()
51 };
52
53 let line_index = LineIndex::new(&text);
54
55 Data {
56 text,
57 line_index,
58 edits,
59 offset,
60 }
61}
62
63lazy_static! {
64 static ref DATA: Data = setup_data();
65}
66
67fn compare_translates(c: &mut Criterion) {
68 let functions = vec![
69 Fun::new("translate_after_edit", |b, _| {
70 b.iter(|| {
71 let d = &*DATA;
72 line_index_utils::translate_after_edit(&d.text, d.offset, d.edits.clone());
73 })
74 }),
75 Fun::new("translate_offset_with_edit", |b, _| {
76 b.iter(|| {
77 let d = &*DATA;
78 line_index_utils::translate_offset_with_edit(&d.line_index, d.offset, &d.edits);
79 })
80 }),
81 ];
82
83 c.bench_functions("translate", functions, ());
84}
85
86criterion_group!(benches, compare_translates);
87criterion_main!(benches);
diff --git a/crates/ra_editor/src/line_index.rs b/crates/ra_editor/src/line_index.rs
index 5304fbcf6..898fee7e0 100644
--- a/crates/ra_editor/src/line_index.rs
+++ b/crates/ra_editor/src/line_index.rs
@@ -128,8 +128,8 @@ impl LineIndex {
128 } 128 }
129} 129}
130 130
131#[cfg(test)]
131/// Simple reference implementation to use in proptests 132/// Simple reference implementation to use in proptests
132/// and benchmarks as baseline
133pub fn to_line_col(text: &str, offset: TextUnit) -> LineCol { 133pub fn to_line_col(text: &str, offset: TextUnit) -> LineCol {
134 let mut res = LineCol { 134 let mut res = LineCol {
135 line: 0, 135 line: 0,
@@ -270,6 +270,27 @@ mod test_line_index {
270 .boxed() 270 .boxed()
271 } 271 }
272 272
273 fn to_line_col(text: &str, offset: TextUnit) -> LineCol {
274 let mut res = LineCol {
275 line: 0,
276 col_utf16: 0,
277 };
278 for (i, c) in text.char_indices() {
279 if i + c.len_utf8() > offset.to_usize() {
280 // if it's an invalid offset, inside a multibyte char
281 // return as if it was at the start of the char
282 break;
283 }
284 if c == '\n' {
285 res.line += 1;
286 res.col_utf16 = 0;
287 } else {
288 res.col_utf16 += 1;
289 }
290 }
291 res
292 }
293
273 proptest! { 294 proptest! {
274 #[test] 295 #[test]
275 fn test_line_index_proptest((offset, text) in arb_text_with_offset()) { 296 fn test_line_index_proptest((offset, text) in arb_text_with_offset()) {
diff --git a/crates/ra_editor/src/line_index_utils.rs b/crates/ra_editor/src/line_index_utils.rs
index ba3ac8aeb..b8b149442 100644
--- a/crates/ra_editor/src/line_index_utils.rs
+++ b/crates/ra_editor/src/line_index_utils.rs
@@ -1,6 +1,6 @@
1use ra_text_edit::AtomTextEdit; 1use ra_text_edit::AtomTextEdit;
2use ra_syntax::{TextUnit, TextRange}; 2use ra_syntax::{TextUnit, TextRange};
3use crate::{LineIndex, LineCol, line_index::{self, Utf16Char}}; 3use crate::{LineIndex, LineCol, line_index::Utf16Char};
4use superslice::Ext; 4use superslice::Ext;
5 5
6#[derive(Debug, Clone)] 6#[derive(Debug, Clone)]
@@ -325,59 +325,34 @@ pub fn translate_offset_with_edit(
325 res.to_line_col(offset) 325 res.to_line_col(offset)
326} 326}
327 327
328/// Simplest implementation to use as reference in proptest and benchmarks
329pub fn translate_after_edit(
330 pre_edit_text: &str,
331 offset: TextUnit,
332 edits: Vec<AtomTextEdit>,
333) -> LineCol {
334 let text = edit_text(pre_edit_text, edits);
335 line_index::to_line_col(&text, offset)
336}
337
338fn edit_text(pre_edit_text: &str, mut edits: Vec<AtomTextEdit>) -> String {
339 // apply edits ordered from last to first
340 // since they should not overlap we can just use start()
341 edits.sort_by_key(|x| -(x.delete.start().to_usize() as isize));
342
343 let mut text = pre_edit_text.to_owned();
344
345 for edit in &edits {
346 let range = edit.delete.start().to_usize()..edit.delete.end().to_usize();
347 text.replace_range(range, &edit.insert);
348 }
349
350 text
351}
352
353#[cfg(test)] 328#[cfg(test)]
354mod test { 329mod test {
355 use super::*; 330 use super::*;
356 use proptest::{prelude::*, proptest, proptest_helper}; 331 use proptest::{prelude::*, proptest, proptest_helper};
357 use ra_text_edit::test_utils::{arb_text, arb_offset, arb_edits}; 332 use crate::line_index;
333 use ra_text_edit::test_utils::{arb_offset, arb_text_with_edits};
334 use ra_text_edit::TextEdit;
358 335
359 #[derive(Debug)] 336 #[derive(Debug)]
360 struct ArbTextWithOffsetAndEdits { 337 struct ArbTextWithOffsetAndEdits {
361 text: String, 338 text: String,
339 edits: TextEdit,
362 edited_text: String, 340 edited_text: String,
363 offset: TextUnit, 341 offset: TextUnit,
364 edits: Vec<AtomTextEdit>,
365 } 342 }
366 343
367 fn arb_text_with_offset_and_edits() -> BoxedStrategy<ArbTextWithOffsetAndEdits> { 344 fn arb_text_with_edits_and_offset() -> BoxedStrategy<ArbTextWithOffsetAndEdits> {
368 arb_text() 345 arb_text_with_edits()
369 .prop_flat_map(|text| { 346 .prop_flat_map(|x| {
370 (arb_edits(&text), Just(text)).prop_flat_map(|(edits, text)| { 347 let edited_text = x.edits.apply(&x.text);
371 let edited_text = edit_text(&text, edits.clone()); 348 let arb_offset = arb_offset(&edited_text);
372 let arb_offset = arb_offset(&edited_text); 349 (Just(x), Just(edited_text), arb_offset).prop_map(|(x, edited_text, offset)| {
373 (Just(text), Just(edited_text), Just(edits), arb_offset).prop_map( 350 ArbTextWithOffsetAndEdits {
374 |(text, edited_text, edits, offset)| ArbTextWithOffsetAndEdits { 351 text: x.text,
375 text, 352 edits: x.edits,
376 edits, 353 edited_text,
377 edited_text, 354 offset,
378 offset, 355 }
379 },
380 )
381 }) 356 })
382 }) 357 })
383 .boxed() 358 .boxed()
@@ -385,10 +360,10 @@ mod test {
385 360
386 proptest! { 361 proptest! {
387 #[test] 362 #[test]
388 fn test_translate_offset_with_edit(x in arb_text_with_offset_and_edits()) { 363 fn test_translate_offset_with_edit(x in arb_text_with_edits_and_offset()) {
389 let expected = line_index::to_line_col(&x.edited_text, x.offset); 364 let expected = line_index::to_line_col(&x.edited_text, x.offset);
390 let line_index = LineIndex::new(&x.text); 365 let line_index = LineIndex::new(&x.text);
391 let actual = translate_offset_with_edit(&line_index, x.offset, &x.edits); 366 let actual = translate_offset_with_edit(&line_index, x.offset, x.edits.as_atoms());
392 367
393 assert_eq!(actual, expected); 368 assert_eq!(actual, expected);
394 } 369 }
diff --git a/crates/ra_text_edit/src/test_utils.rs b/crates/ra_text_edit/src/test_utils.rs
index f150288f6..f0b8dfde1 100644
--- a/crates/ra_text_edit/src/test_utils.rs
+++ b/crates/ra_text_edit/src/test_utils.rs
@@ -1,6 +1,6 @@
1use proptest::prelude::*; 1use proptest::prelude::*;
2use text_unit::{TextUnit, TextRange}; 2use text_unit::{TextUnit, TextRange};
3use crate::AtomTextEdit; 3use crate::{AtomTextEdit, TextEdit};
4 4
5pub fn arb_text() -> proptest::string::RegexGeneratorStrategy<String> { 5pub fn arb_text() -> proptest::string::RegexGeneratorStrategy<String> {
6 // generate multiple newlines 6 // generate multiple newlines
@@ -23,11 +23,7 @@ pub fn arb_offset(text: &str) -> BoxedStrategy<TextUnit> {
23 } 23 }
24} 24}
25 25
26pub fn arb_edits(text: &str) -> BoxedStrategy<Vec<AtomTextEdit>> { 26pub fn arb_text_edit(text: &str) -> BoxedStrategy<TextEdit> {
27 arb_edits_custom(&text, 0, 7)
28}
29
30pub fn arb_edits_custom(text: &str, min: usize, max: usize) -> BoxedStrategy<Vec<AtomTextEdit>> {
31 if text.is_empty() { 27 if text.is_empty() {
32 // only valid edits 28 // only valid edits
33 return Just(vec![]) 29 return Just(vec![])
@@ -37,14 +33,14 @@ pub fn arb_edits_custom(text: &str, min: usize, max: usize) -> BoxedStrategy<Vec
37 .prop_map(|text| vec![AtomTextEdit::insert(TextUnit::from(0), text)]) 33 .prop_map(|text| vec![AtomTextEdit::insert(TextUnit::from(0), text)])
38 .boxed(), 34 .boxed(),
39 ) 35 )
36 .prop_map(TextEdit::from_atoms)
40 .boxed(); 37 .boxed();
41 } 38 }
42 39
43 let offsets = text_offsets(text); 40 let offsets = text_offsets(text);
44 let max_cuts = max.min(offsets.len()); 41 let max_cuts = 7.min(offsets.len());
45 let min_cuts = min.min(offsets.len() - 1);
46 42
47 proptest::sample::subsequence(offsets, min_cuts..max_cuts) 43 proptest::sample::subsequence(offsets, 0..max_cuts)
48 .prop_flat_map(|cuts| { 44 .prop_flat_map(|cuts| {
49 let strategies: Vec<_> = cuts 45 let strategies: Vec<_> = cuts
50 .chunks(2) 46 .chunks(2)
@@ -68,52 +64,22 @@ pub fn arb_edits_custom(text: &str, min: usize, max: usize) -> BoxedStrategy<Vec
68 .collect(); 64 .collect();
69 strategies 65 strategies
70 }) 66 })
67 .prop_map(TextEdit::from_atoms)
71 .boxed() 68 .boxed()
72} 69}
73 70
74#[cfg(test)] 71#[derive(Debug, Clone)]
75mod tests { 72pub struct ArbTextWithEdits {
76 use super::*; 73 pub text: String,
77 use proptest::{proptest, proptest_helper}; 74 pub edits: TextEdit,
78 75}
79 fn arb_text_with_edits() -> BoxedStrategy<(String, Vec<AtomTextEdit>)> {
80 let text = arb_text();
81 text.prop_flat_map(|s| {
82 let edits = arb_edits(&s);
83 (Just(s), edits)
84 })
85 .boxed()
86 }
87
88 fn intersect(r1: TextRange, r2: TextRange) -> Option<TextRange> {
89 let start = r1.start().max(r2.start());
90 let end = r1.end().min(r2.end());
91 if start <= end {
92 Some(TextRange::from_to(start, end))
93 } else {
94 None
95 }
96 }
97 proptest! {
98 #[test]
99 fn atom_text_edits_are_valid((text, edits) in arb_text_with_edits()) {
100 proptest_atom_text_edits_are_valid(text, edits)
101 }
102 }
103 76
104 fn proptest_atom_text_edits_are_valid(text: String, edits: Vec<AtomTextEdit>) { 77pub fn arb_text_with_edits() -> BoxedStrategy<ArbTextWithEdits> {
105 // slicing doesn't panic 78 let text = arb_text();
106 for e in &edits { 79 text.prop_flat_map(|s| {
107 let _ = &text[e.delete]; 80 let edits = arb_text_edit(&s);
108 } 81 (Just(s), edits)
109 // ranges do not overlap 82 })
110 for i in 1..edits.len() { 83 .prop_map(|(text, edits)| ArbTextWithEdits { text, edits })
111 let e1 = &edits[i]; 84 .boxed()
112 for e2 in &edits[0..i] {
113 if intersect(e1.delete, e2.delete).is_some() {
114 assert!(false, "Overlapping ranges {} {}", e1.delete, e2.delete);
115 }
116 }
117 }
118 }
119} 85}
diff --git a/crates/ra_text_edit/src/text_edit.rs b/crates/ra_text_edit/src/text_edit.rs
index 392968d63..0881f3e1c 100644
--- a/crates/ra_text_edit/src/text_edit.rs
+++ b/crates/ra_text_edit/src/text_edit.rs
@@ -26,12 +26,7 @@ impl TextEditBuilder {
26 self.atoms.push(AtomTextEdit::insert(offset, text)) 26 self.atoms.push(AtomTextEdit::insert(offset, text))
27 } 27 }
28 pub fn finish(self) -> TextEdit { 28 pub fn finish(self) -> TextEdit {
29 let mut atoms = self.atoms; 29 TextEdit::from_atoms(self.atoms)
30 atoms.sort_by_key(|a| (a.delete.start(), a.delete.end()));
31 for (a1, a2) in atoms.iter().zip(atoms.iter().skip(1)) {
32 assert!(a1.delete.end() <= a2.delete.start())
33 }
34 TextEdit { atoms }
35 } 30 }
36 pub fn invalidates_offset(&self, offset: TextUnit) -> bool { 31 pub fn invalidates_offset(&self, offset: TextUnit) -> bool {
37 self.atoms 32 self.atoms
@@ -41,6 +36,14 @@ impl TextEditBuilder {
41} 36}
42 37
43impl TextEdit { 38impl TextEdit {
39 pub(crate) fn from_atoms(mut atoms: Vec<AtomTextEdit>) -> TextEdit {
40 atoms.sort_by_key(|a| (a.delete.start(), a.delete.end()));
41 for (a1, a2) in atoms.iter().zip(atoms.iter().skip(1)) {
42 assert!(a1.delete.end() <= a2.delete.start())
43 }
44 TextEdit { atoms }
45 }
46
44 pub fn as_atoms(&self) -> &[AtomTextEdit] { 47 pub fn as_atoms(&self) -> &[AtomTextEdit] {
45 &self.atoms 48 &self.atoms
46 } 49 }