diff options
-rw-r--r-- | Cargo.lock | 90 | ||||
-rw-r--r-- | crates/ra_ide/Cargo.toml | 2 | ||||
-rw-r--r-- | crates/ra_ide/src/syntax_highlighting/html.rs | 10 | ||||
-rw-r--r-- | crates/ra_ide/test_data/rainbow_highlighting.html | 12 | ||||
-rw-r--r-- | crates/rust-analyzer/Cargo.toml | 2 | ||||
-rw-r--r-- | crates/rust-analyzer/src/cli/analysis_stats.rs | 25 | ||||
-rw-r--r-- | xtask/tests/tidy.rs | 1 |
7 files changed, 44 insertions, 98 deletions
diff --git a/Cargo.lock b/Cargo.lock index b7a9516e3..c656f846d 100644 --- a/Cargo.lock +++ b/Cargo.lock | |||
@@ -401,17 +401,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
401 | checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" | 401 | checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" |
402 | 402 | ||
403 | [[package]] | 403 | [[package]] |
404 | name = "getrandom" | ||
405 | version = "0.1.14" | ||
406 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
407 | checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb" | ||
408 | dependencies = [ | ||
409 | "cfg-if", | ||
410 | "libc", | ||
411 | "wasi", | ||
412 | ] | ||
413 | |||
414 | [[package]] | ||
415 | name = "gimli" | 404 | name = "gimli" |
416 | version = "0.22.0" | 405 | version = "0.22.0" |
417 | source = "registry+https://github.com/rust-lang/crates.io-index" | 406 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -811,6 +800,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
811 | checksum = "0b631f7e854af39a1739f401cf34a8a013dfe09eac4fa4dba91e9768bd28168d" | 800 | checksum = "0b631f7e854af39a1739f401cf34a8a013dfe09eac4fa4dba91e9768bd28168d" |
812 | 801 | ||
813 | [[package]] | 802 | [[package]] |
803 | name = "oorandom" | ||
804 | version = "11.1.2" | ||
805 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
806 | checksum = "a170cebd8021a008ea92e4db85a72f80b35df514ec664b296fdcbb654eac0b2c" | ||
807 | |||
808 | [[package]] | ||
814 | name = "parking_lot" | 809 | name = "parking_lot" |
815 | version = "0.11.0" | 810 | version = "0.11.0" |
816 | source = "registry+https://github.com/rust-lang/crates.io-index" | 811 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -869,12 +864,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
869 | checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" | 864 | checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" |
870 | 865 | ||
871 | [[package]] | 866 | [[package]] |
872 | name = "ppv-lite86" | ||
873 | version = "0.2.8" | ||
874 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
875 | checksum = "237a5ed80e274dbc66f86bd59c1e25edc039660be53194b5fe0a482e0f2612ea" | ||
876 | |||
877 | [[package]] | ||
878 | name = "proc-macro2" | 867 | name = "proc-macro2" |
879 | version = "1.0.19" | 868 | version = "1.0.19" |
880 | source = "registry+https://github.com/rust-lang/crates.io-index" | 869 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -1046,6 +1035,7 @@ dependencies = [ | |||
1046 | "indexmap", | 1035 | "indexmap", |
1047 | "itertools", | 1036 | "itertools", |
1048 | "log", | 1037 | "log", |
1038 | "oorandom", | ||
1049 | "ra_assists", | 1039 | "ra_assists", |
1050 | "ra_cfg", | 1040 | "ra_cfg", |
1051 | "ra_db", | 1041 | "ra_db", |
@@ -1056,7 +1046,6 @@ dependencies = [ | |||
1056 | "ra_ssr", | 1046 | "ra_ssr", |
1057 | "ra_syntax", | 1047 | "ra_syntax", |
1058 | "ra_text_edit", | 1048 | "ra_text_edit", |
1059 | "rand", | ||
1060 | "rustc-hash", | 1049 | "rustc-hash", |
1061 | "stdx", | 1050 | "stdx", |
1062 | "test_utils", | 1051 | "test_utils", |
@@ -1218,57 +1207,6 @@ dependencies = [ | |||
1218 | ] | 1207 | ] |
1219 | 1208 | ||
1220 | [[package]] | 1209 | [[package]] |
1221 | name = "rand" | ||
1222 | version = "0.7.3" | ||
1223 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1224 | checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" | ||
1225 | dependencies = [ | ||
1226 | "getrandom", | ||
1227 | "libc", | ||
1228 | "rand_chacha", | ||
1229 | "rand_core", | ||
1230 | "rand_hc", | ||
1231 | "rand_pcg", | ||
1232 | ] | ||
1233 | |||
1234 | [[package]] | ||
1235 | name = "rand_chacha" | ||
1236 | version = "0.2.2" | ||
1237 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1238 | checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" | ||
1239 | dependencies = [ | ||
1240 | "ppv-lite86", | ||
1241 | "rand_core", | ||
1242 | ] | ||
1243 | |||
1244 | [[package]] | ||
1245 | name = "rand_core" | ||
1246 | version = "0.5.1" | ||
1247 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1248 | checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" | ||
1249 | dependencies = [ | ||
1250 | "getrandom", | ||
1251 | ] | ||
1252 | |||
1253 | [[package]] | ||
1254 | name = "rand_hc" | ||
1255 | version = "0.2.0" | ||
1256 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1257 | checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" | ||
1258 | dependencies = [ | ||
1259 | "rand_core", | ||
1260 | ] | ||
1261 | |||
1262 | [[package]] | ||
1263 | name = "rand_pcg" | ||
1264 | version = "0.2.1" | ||
1265 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1266 | checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" | ||
1267 | dependencies = [ | ||
1268 | "rand_core", | ||
1269 | ] | ||
1270 | |||
1271 | [[package]] | ||
1272 | name = "rayon" | 1210 | name = "rayon" |
1273 | version = "1.3.1" | 1211 | version = "1.3.1" |
1274 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1212 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -1354,6 +1292,7 @@ dependencies = [ | |||
1354 | "lsp-server", | 1292 | "lsp-server", |
1355 | "lsp-types", | 1293 | "lsp-types", |
1356 | "mimalloc", | 1294 | "mimalloc", |
1295 | "oorandom", | ||
1357 | "parking_lot", | 1296 | "parking_lot", |
1358 | "pico-args", | 1297 | "pico-args", |
1359 | "ra_cfg", | 1298 | "ra_cfg", |
@@ -1372,7 +1311,6 @@ dependencies = [ | |||
1372 | "ra_text_edit", | 1311 | "ra_text_edit", |
1373 | "ra_toolchain", | 1312 | "ra_toolchain", |
1374 | "ra_tt", | 1313 | "ra_tt", |
1375 | "rand", | ||
1376 | "rayon", | 1314 | "rayon", |
1377 | "rustc-hash", | 1315 | "rustc-hash", |
1378 | "serde", | 1316 | "serde", |
@@ -1414,16 +1352,16 @@ checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" | |||
1414 | 1352 | ||
1415 | [[package]] | 1353 | [[package]] |
1416 | name = "salsa" | 1354 | name = "salsa" |
1417 | version = "0.15.0" | 1355 | version = "0.15.1" |
1418 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1356 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1419 | checksum = "885b4b99dde959decc84e85dd943bd140b4aabd62db2f8206ef5270f77ec20b9" | 1357 | checksum = "d4cdc109fcc9e9450c7ef47fb7474e99bffd51799da03ed0a6c7f0e2cb3848a6" |
1420 | dependencies = [ | 1358 | dependencies = [ |
1421 | "crossbeam-utils", | 1359 | "crossbeam-utils", |
1422 | "indexmap", | 1360 | "indexmap", |
1423 | "lock_api", | 1361 | "lock_api", |
1424 | "log", | 1362 | "log", |
1363 | "oorandom", | ||
1425 | "parking_lot", | 1364 | "parking_lot", |
1426 | "rand", | ||
1427 | "rustc-hash", | 1365 | "rustc-hash", |
1428 | "salsa-macros", | 1366 | "salsa-macros", |
1429 | "smallvec", | 1367 | "smallvec", |
@@ -1832,12 +1770,6 @@ dependencies = [ | |||
1832 | ] | 1770 | ] |
1833 | 1771 | ||
1834 | [[package]] | 1772 | [[package]] |
1835 | name = "wasi" | ||
1836 | version = "0.9.0+wasi-snapshot-preview1" | ||
1837 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1838 | checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" | ||
1839 | |||
1840 | [[package]] | ||
1841 | name = "winapi" | 1773 | name = "winapi" |
1842 | version = "0.2.8" | 1774 | version = "0.2.8" |
1843 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1775 | source = "registry+https://github.com/rust-lang/crates.io-index" |
diff --git a/crates/ra_ide/Cargo.toml b/crates/ra_ide/Cargo.toml index 6f8107491..f4181c4eb 100644 --- a/crates/ra_ide/Cargo.toml +++ b/crates/ra_ide/Cargo.toml | |||
@@ -17,7 +17,7 @@ indexmap = "1.3.2" | |||
17 | itertools = "0.9.0" | 17 | itertools = "0.9.0" |
18 | log = "0.4.8" | 18 | log = "0.4.8" |
19 | rustc-hash = "1.1.0" | 19 | rustc-hash = "1.1.0" |
20 | rand = { version = "0.7.3", features = ["small_rng"] } | 20 | oorandom = "11.1.2" |
21 | 21 | ||
22 | stdx = { path = "../stdx" } | 22 | stdx = { path = "../stdx" } |
23 | 23 | ||
diff --git a/crates/ra_ide/src/syntax_highlighting/html.rs b/crates/ra_ide/src/syntax_highlighting/html.rs index 0be55bca9..a5e7d2867 100644 --- a/crates/ra_ide/src/syntax_highlighting/html.rs +++ b/crates/ra_ide/src/syntax_highlighting/html.rs | |||
@@ -1,5 +1,6 @@ | |||
1 | //! Renders a bit of code as HTML. | 1 | //! Renders a bit of code as HTML. |
2 | 2 | ||
3 | use oorandom::Rand32; | ||
3 | use ra_db::SourceDatabase; | 4 | use ra_db::SourceDatabase; |
4 | use ra_syntax::{AstNode, TextRange, TextSize}; | 5 | use ra_syntax::{AstNode, TextRange, TextSize}; |
5 | 6 | ||
@@ -9,13 +10,12 @@ pub(crate) fn highlight_as_html(db: &RootDatabase, file_id: FileId, rainbow: boo | |||
9 | let parse = db.parse(file_id); | 10 | let parse = db.parse(file_id); |
10 | 11 | ||
11 | fn rainbowify(seed: u64) -> String { | 12 | fn rainbowify(seed: u64) -> String { |
12 | use rand::prelude::*; | 13 | let mut rng = Rand32::new(seed); |
13 | let mut rng = SmallRng::seed_from_u64(seed); | ||
14 | format!( | 14 | format!( |
15 | "hsl({h},{s}%,{l}%)", | 15 | "hsl({h},{s}%,{l}%)", |
16 | h = rng.gen_range::<u16, _, _>(0, 361), | 16 | h = rng.rand_range(0..361), |
17 | s = rng.gen_range::<u16, _, _>(42, 99), | 17 | s = rng.rand_range(42..99), |
18 | l = rng.gen_range::<u16, _, _>(40, 91), | 18 | l = rng.rand_range(40..91), |
19 | ) | 19 | ) |
20 | } | 20 | } |
21 | 21 | ||
diff --git a/crates/ra_ide/test_data/rainbow_highlighting.html b/crates/ra_ide/test_data/rainbow_highlighting.html index 08d83302c..401e87a73 100644 --- a/crates/ra_ide/test_data/rainbow_highlighting.html +++ b/crates/ra_ide/test_data/rainbow_highlighting.html | |||
@@ -36,14 +36,14 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
36 | .unresolved_reference { color: #FC5555; text-decoration: wavy underline; } | 36 | .unresolved_reference { color: #FC5555; text-decoration: wavy underline; } |
37 | </style> | 37 | </style> |
38 | <pre><code><span class="keyword">fn</span> <span class="function declaration">main</span><span class="punctuation">(</span><span class="punctuation">)</span> <span class="punctuation">{</span> | 38 | <pre><code><span class="keyword">fn</span> <span class="function declaration">main</span><span class="punctuation">(</span><span class="punctuation">)</span> <span class="punctuation">{</span> |
39 | <span class="keyword">let</span> <span class="variable declaration" data-binding-hash="8121853618659664005" style="color: hsl(261,57%,61%);">hello</span> <span class="operator">=</span> <span class="string_literal">"hello"</span><span class="punctuation">;</span> | 39 | <span class="keyword">let</span> <span class="variable declaration" data-binding-hash="8121853618659664005" style="color: hsl(273,88%,88%);">hello</span> <span class="operator">=</span> <span class="string_literal">"hello"</span><span class="punctuation">;</span> |
40 | <span class="keyword">let</span> <span class="variable declaration" data-binding-hash="2705725358298919760" style="color: hsl(17,51%,74%);">x</span> <span class="operator">=</span> <span class="variable" data-binding-hash="8121853618659664005" style="color: hsl(261,57%,61%);">hello</span><span class="punctuation">.</span><span class="unresolved_reference">to_string</span><span class="punctuation">(</span><span class="punctuation">)</span><span class="punctuation">;</span> | 40 | <span class="keyword">let</span> <span class="variable declaration" data-binding-hash="2705725358298919760" style="color: hsl(76,47%,83%);">x</span> <span class="operator">=</span> <span class="variable" data-binding-hash="8121853618659664005" style="color: hsl(273,88%,88%);">hello</span><span class="punctuation">.</span><span class="unresolved_reference">to_string</span><span class="punctuation">(</span><span class="punctuation">)</span><span class="punctuation">;</span> |
41 | <span class="keyword">let</span> <span class="variable declaration" data-binding-hash="3365759661443752373" style="color: hsl(127,76%,66%);">y</span> <span class="operator">=</span> <span class="variable" data-binding-hash="8121853618659664005" style="color: hsl(261,57%,61%);">hello</span><span class="punctuation">.</span><span class="unresolved_reference">to_string</span><span class="punctuation">(</span><span class="punctuation">)</span><span class="punctuation">;</span> | 41 | <span class="keyword">let</span> <span class="variable declaration" data-binding-hash="3365759661443752373" style="color: hsl(15,86%,51%);">y</span> <span class="operator">=</span> <span class="variable" data-binding-hash="8121853618659664005" style="color: hsl(273,88%,88%);">hello</span><span class="punctuation">.</span><span class="unresolved_reference">to_string</span><span class="punctuation">(</span><span class="punctuation">)</span><span class="punctuation">;</span> |
42 | 42 | ||
43 | <span class="keyword">let</span> <span class="variable declaration" data-binding-hash="794745962933817518" style="color: hsl(19,74%,76%);">x</span> <span class="operator">=</span> <span class="string_literal">"other color please!"</span><span class="punctuation">;</span> | 43 | <span class="keyword">let</span> <span class="variable declaration" data-binding-hash="794745962933817518" style="color: hsl(127,71%,87%);">x</span> <span class="operator">=</span> <span class="string_literal">"other color please!"</span><span class="punctuation">;</span> |
44 | <span class="keyword">let</span> <span class="variable declaration" data-binding-hash="6717528807933952652" style="color: hsl(85,49%,84%);">y</span> <span class="operator">=</span> <span class="variable" data-binding-hash="794745962933817518" style="color: hsl(19,74%,76%);">x</span><span class="punctuation">.</span><span class="unresolved_reference">to_string</span><span class="punctuation">(</span><span class="punctuation">)</span><span class="punctuation">;</span> | 44 | <span class="keyword">let</span> <span class="variable declaration" data-binding-hash="6717528807933952652" style="color: hsl(90,74%,79%);">y</span> <span class="operator">=</span> <span class="variable" data-binding-hash="794745962933817518" style="color: hsl(127,71%,87%);">x</span><span class="punctuation">.</span><span class="unresolved_reference">to_string</span><span class="punctuation">(</span><span class="punctuation">)</span><span class="punctuation">;</span> |
45 | <span class="punctuation">}</span> | 45 | <span class="punctuation">}</span> |
46 | 46 | ||
47 | <span class="keyword">fn</span> <span class="function declaration">bar</span><span class="punctuation">(</span><span class="punctuation">)</span> <span class="punctuation">{</span> | 47 | <span class="keyword">fn</span> <span class="function declaration">bar</span><span class="punctuation">(</span><span class="punctuation">)</span> <span class="punctuation">{</span> |
48 | <span class="keyword">let</span> <span class="keyword">mut</span> <span class="variable declaration mutable" data-binding-hash="8121853618659664005" style="color: hsl(261,57%,61%);">hello</span> <span class="operator">=</span> <span class="string_literal">"hello"</span><span class="punctuation">;</span> | 48 | <span class="keyword">let</span> <span class="keyword">mut</span> <span class="variable declaration mutable" data-binding-hash="8121853618659664005" style="color: hsl(273,88%,88%);">hello</span> <span class="operator">=</span> <span class="string_literal">"hello"</span><span class="punctuation">;</span> |
49 | <span class="punctuation">}</span></code></pre> \ No newline at end of file | 49 | <span class="punctuation">}</span></code></pre> \ No newline at end of file |
diff --git a/crates/rust-analyzer/Cargo.toml b/crates/rust-analyzer/Cargo.toml index 3f9c820c5..931fc61ed 100644 --- a/crates/rust-analyzer/Cargo.toml +++ b/crates/rust-analyzer/Cargo.toml | |||
@@ -23,7 +23,7 @@ log = "0.4.8" | |||
23 | lsp-types = { version = "0.78.0", features = ["proposed"] } | 23 | lsp-types = { version = "0.78.0", features = ["proposed"] } |
24 | parking_lot = "0.11.0" | 24 | parking_lot = "0.11.0" |
25 | pico-args = "0.3.1" | 25 | pico-args = "0.3.1" |
26 | rand = { version = "0.7.3", features = ["small_rng"] } | 26 | oorandom = "11.1.2" |
27 | rustc-hash = "1.1.0" | 27 | rustc-hash = "1.1.0" |
28 | serde = { version = "1.0.106", features = ["derive"] } | 28 | serde = { version = "1.0.106", features = ["derive"] } |
29 | serde_json = "1.0.48" | 29 | serde_json = "1.0.48" |
diff --git a/crates/rust-analyzer/src/cli/analysis_stats.rs b/crates/rust-analyzer/src/cli/analysis_stats.rs index ccc058682..6b7c08971 100644 --- a/crates/rust-analyzer/src/cli/analysis_stats.rs +++ b/crates/rust-analyzer/src/cli/analysis_stats.rs | |||
@@ -1,7 +1,10 @@ | |||
1 | //! Fully type-check project and print various stats, like the number of type | 1 | //! Fully type-check project and print various stats, like the number of type |
2 | //! errors. | 2 | //! errors. |
3 | 3 | ||
4 | use std::{path::Path, time::Instant}; | 4 | use std::{ |
5 | path::Path, | ||
6 | time::{Instant, SystemTime, UNIX_EPOCH}, | ||
7 | }; | ||
5 | 8 | ||
6 | use hir::{ | 9 | use hir::{ |
7 | db::{AstDatabase, DefDatabase, HirDatabase}, | 10 | db::{AstDatabase, DefDatabase, HirDatabase}, |
@@ -10,12 +13,12 @@ use hir::{ | |||
10 | use hir_def::FunctionId; | 13 | use hir_def::FunctionId; |
11 | use hir_ty::{Ty, TypeWalk}; | 14 | use hir_ty::{Ty, TypeWalk}; |
12 | use itertools::Itertools; | 15 | use itertools::Itertools; |
16 | use oorandom::Rand32; | ||
13 | use ra_db::{ | 17 | use ra_db::{ |
14 | salsa::{self, ParallelDatabase}, | 18 | salsa::{self, ParallelDatabase}, |
15 | SourceDatabaseExt, | 19 | SourceDatabaseExt, |
16 | }; | 20 | }; |
17 | use ra_syntax::AstNode; | 21 | use ra_syntax::AstNode; |
18 | use rand::{seq::SliceRandom, thread_rng}; | ||
19 | use rayon::prelude::*; | 22 | use rayon::prelude::*; |
20 | use rustc_hash::FxHashSet; | 23 | use rustc_hash::FxHashSet; |
21 | use stdx::format_to; | 24 | use stdx::format_to; |
@@ -46,6 +49,11 @@ pub fn analysis_stats( | |||
46 | load_output_dirs: bool, | 49 | load_output_dirs: bool, |
47 | with_proc_macro: bool, | 50 | with_proc_macro: bool, |
48 | ) -> Result<()> { | 51 | ) -> Result<()> { |
52 | let mut rng = { | ||
53 | let seed = SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis() as u64; | ||
54 | Rand32::new(seed) | ||
55 | }; | ||
56 | |||
49 | let db_load_time = Instant::now(); | 57 | let db_load_time = Instant::now(); |
50 | let (host, vfs) = load_cargo(path, load_output_dirs, with_proc_macro)?; | 58 | let (host, vfs) = load_cargo(path, load_output_dirs, with_proc_macro)?; |
51 | let db = host.raw_database(); | 59 | let db = host.raw_database(); |
@@ -57,7 +65,7 @@ pub fn analysis_stats( | |||
57 | 65 | ||
58 | let mut krates = Crate::all(db); | 66 | let mut krates = Crate::all(db); |
59 | if randomize { | 67 | if randomize { |
60 | krates.shuffle(&mut thread_rng()); | 68 | shuffle(&mut rng, &mut krates); |
61 | } | 69 | } |
62 | for krate in krates { | 70 | for krate in krates { |
63 | let module = krate.root_module(db).expect("crate without root module"); | 71 | let module = krate.root_module(db).expect("crate without root module"); |
@@ -72,7 +80,7 @@ pub fn analysis_stats( | |||
72 | } | 80 | } |
73 | 81 | ||
74 | if randomize { | 82 | if randomize { |
75 | visit_queue.shuffle(&mut thread_rng()); | 83 | shuffle(&mut rng, &mut visit_queue); |
76 | } | 84 | } |
77 | 85 | ||
78 | eprintln!("Crates in this dir: {}", num_crates); | 86 | eprintln!("Crates in this dir: {}", num_crates); |
@@ -110,7 +118,7 @@ pub fn analysis_stats( | |||
110 | ); | 118 | ); |
111 | 119 | ||
112 | if randomize { | 120 | if randomize { |
113 | funcs.shuffle(&mut thread_rng()); | 121 | shuffle(&mut rng, &mut funcs); |
114 | } | 122 | } |
115 | 123 | ||
116 | let mut bar = match verbosity { | 124 | let mut bar = match verbosity { |
@@ -306,3 +314,10 @@ pub fn analysis_stats( | |||
306 | 314 | ||
307 | Ok(()) | 315 | Ok(()) |
308 | } | 316 | } |
317 | |||
318 | fn shuffle<T>(rng: &mut Rand32, slice: &mut [T]) { | ||
319 | for i in (1..slice.len()).rev() { | ||
320 | let idx = rng.rand_range(0..i as u32) as usize; | ||
321 | slice.swap(idx, i - 1) | ||
322 | } | ||
323 | } | ||
diff --git a/xtask/tests/tidy.rs b/xtask/tests/tidy.rs index adadffc53..d65a2acbc 100644 --- a/xtask/tests/tidy.rs +++ b/xtask/tests/tidy.rs | |||
@@ -55,7 +55,6 @@ fn check_licenses() { | |||
55 | 0BSD OR MIT OR Apache-2.0 | 55 | 0BSD OR MIT OR Apache-2.0 |
56 | Apache-2.0 OR BSL-1.0 | 56 | Apache-2.0 OR BSL-1.0 |
57 | Apache-2.0 OR MIT | 57 | Apache-2.0 OR MIT |
58 | Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT | ||
59 | Apache-2.0/MIT | 58 | Apache-2.0/MIT |
60 | BSD-2-Clause | 59 | BSD-2-Clause |
61 | BSD-3-Clause | 60 | BSD-3-Clause |