diff --git a/.cargo/config.toml b/.cargo/config.toml index c1f02567c..dd36a554d 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,2 +1,5 @@ [alias] reap-clippy = "reaper cargo clippy" + +[target.x86_64-unknown-linux-gnu] +rustflags = ["-Zlinker-features=-lld"] diff --git a/.github/workflows/rustdoc.yml b/.github/workflows/rustdoc.yml index 8d6b28356..011d2f7ab 100644 --- a/.github/workflows/rustdoc.yml +++ b/.github/workflows/rustdoc.yml @@ -34,7 +34,6 @@ jobs: --enable-index-page \ --extern-html-root-url rustacuda=https://docs.rs/rustacuda/0.1.3/ \ --extern-html-root-url rustacuda_core=https://docs.rs/rustacuda_core/0.1.2/ \ - --extern-html-root-url rustacuda_derive=https://docs.rs/rustacuda_derive/0.1.2/ \ -Zunstable-options \ " cargo doc \ --workspace \ diff --git a/Cargo.lock b/Cargo.lock index 447740505..6cf202aa4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,6 +8,12 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "adler2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" + [[package]] name = "ahash" version = "0.8.11" @@ -38,9 +44,9 @@ checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" [[package]] name = "anstream" -version = "0.6.14" +version = "0.6.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" +checksum = "23a1e53f0f5d86382dafe1cf314783b2044280f406e7e1506368220ad11b1338" dependencies = [ "anstyle", "anstyle-parse", @@ -53,43 +59,43 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.7" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" +checksum = "8365de52b16c035ff4fcafe0092ba9390540e3e352870ac09933bebcaa2c8c56" [[package]] name = "anstyle-parse" -version = "0.2.4" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" +checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.0.3" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a64c907d4e79225ac72e2a354c9ce84d50ebb4586dee56c82b3ee73004f537f5" +checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.3" +version = "3.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" +checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125" dependencies = [ "anstyle", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "c042108f3ed77fd83760a5fd79b53be043192bb3b9dba91d8c574c0ada7850c8" [[package]] name = "array-init-cursor" @@ -131,15 +137,15 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "base32" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1ce0365f4d5fb6646220bb52fe547afd51796d90f914d4063cb0b032ebee088" +checksum = "022dfe9eb35f19ebbcb51e0b40a5ab759f46ad60cadf7297e0bd085afb50e076" [[package]] name = "base64" @@ -158,11 +164,11 @@ dependencies = [ [[package]] name = "bindgen" -version = "0.69.4" +version = "0.69.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" +checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "cexpr", "clang-sys", "itertools", @@ -175,24 +181,24 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.65", + "syn 2.0.85", "which", ] [[package]] name = "bit-set" -version = "0.5.3" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" +checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" dependencies = [ "bit-vec", ] [[package]] name = "bit-vec" -version = "0.6.3" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" +checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" [[package]] name = "bitflags" @@ -202,13 +208,32 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" dependencies = [ "serde", ] +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bstr" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40723b8fb387abc38f4f4a37c09073622e41dd12327033091ef8950659e6dc0c" +dependencies = [ + "memchr", + "serde", +] + [[package]] name = "build-probe-mpi" version = "0.1.4" @@ -236,22 +261,22 @@ checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "bytemuck" -version = "1.16.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78834c15cb5d5efe3452d58b1e8ba890dd62d21907f867f383358198e56ebca5" +checksum = "8334215b81e418a0a7bdb8ef0849474f40bb10c8b71f1c4ed315cff49f32494d" dependencies = [ "bytemuck_derive", ] [[package]] name = "bytemuck_derive" -version = "1.6.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4da9a32f3fed317401fa3c862968128267c3106685286e15d5aaa3d7389c2f60" +checksum = "bcfcc3cd946cb52f0bbfdbbcfa2f4e24f75ebb6c0e1002f7c25904fada18b9ec" dependencies = [ "proc-macro2", "quote", - "syn 2.0.65", + "syn 2.0.85", ] [[package]] @@ -262,9 +287,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "camino" -version = "1.1.7" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0ec6b951b160caa93cc0c7b209e5a3bff7aae9062213451ac99493cd844c239" +checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3" dependencies = [ "serde", ] @@ -278,6 +303,29 @@ dependencies = [ "serde", ] +[[package]] +name = "cargo-util" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6dd67a24439ca5260a08128b6cbf4b0f4453497a2f60508163ab9d5b534b122" +dependencies = [ + "anyhow", + "core-foundation", + "filetime", + "hex", + "ignore", + "jobserver", + "libc", + "miow", + "same-file", + "sha2", + "shell-escape", + "tempfile", + "tracing", + "walkdir", + "windows-sys 0.59.0", +] + [[package]] name = "cargo_metadata" version = "0.18.1" @@ -295,13 +343,13 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.98" +version = "1.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41c270e7540d725e65ac7f1b212ac8ce349719624d7bcff99f8e2e488e8cf03f" +checksum = "c2e7962b54006dcfcc61cb72735f4d89bb97061dd6a7ed882ec6b8ee53714c6f" dependencies = [ "jobserver", "libc", - "once_cell", + "shlex", ] [[package]] @@ -330,9 +378,9 @@ dependencies = [ [[package]] name = "clang-sys" -version = "1.7.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67523a3b4be3ce1989d607a828d036249522dd9c1c8de7f4dd2dae43a37369d1" +checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" dependencies = [ "glob", "libc", @@ -341,9 +389,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.4" +version = "4.5.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" +checksum = "b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8" dependencies = [ "clap_builder", "clap_derive", @@ -351,9 +399,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.2" +version = "4.5.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" +checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54" dependencies = [ "anstream", "anstyle", @@ -363,21 +411,21 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.4" +version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" +checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.65", + "syn 2.0.85", ] [[package]] name = "clap_lex" -version = "0.7.0" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" +checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" [[package]] name = "cobs" @@ -387,9 +435,9 @@ checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" [[package]] name = "colorchoice" -version = "1.0.1" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" +checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" [[package]] name = "colored" @@ -403,20 +451,20 @@ dependencies = [ [[package]] name = "const-type-layout" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5daceeb879dcbf74fb11d2aba295197eccecaae7b65e19698a3540d53d7345da" +checksum = "87452e001096102a5740be0a16be9168031dbd0c37eca34214ce007ae7c24da0" dependencies = [ "const-type-layout-derive", ] [[package]] name = "const-type-layout-derive" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a53e9f496df0f05faf37a44c47df102c09faaa56a1adc31801ec332c7359fc90" +checksum = "7ddad585c1c565aa8b49d4112f0cf87e1eed383362798475150d2292b3a59013" dependencies = [ - "proc-macro-error", + "proc-macro-error2", "proc-macro2", "quote", "syn 1.0.109", @@ -442,21 +490,81 @@ dependencies = [ "custom_derive", ] +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "cpufeatures" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" +dependencies = [ + "libc", +] + [[package]] name = "crc32fast" -version = "1.4.1" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58ebf8d6963185c7625d2c3c3962d99eb8936637b1427536d21dc36ae402ebad" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" dependencies = [ "cfg-if", ] +[[package]] +name = "crossbeam-deque" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" + [[package]] name = "crunchy" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + [[package]] name = "cuda-config" version = "0.1.0" @@ -493,12 +601,12 @@ dependencies = [ [[package]] name = "darling" -version = "0.20.9" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83b2eb4d90d12bdda5ed17de686c2acb4c57914f8f921b8da7e112b5a36f3fe1" +checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" dependencies = [ - "darling_core 0.20.9", - "darling_macro 0.20.9", + "darling_core 0.20.10", + "darling_macro 0.20.10", ] [[package]] @@ -517,16 +625,16 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.9" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622687fe0bac72a04e5599029151f5796111b90f1baaa9b544d807a5e31cd120" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", "strsim 0.11.1", - "syn 2.0.65", + "syn 2.0.85", ] [[package]] @@ -542,13 +650,13 @@ dependencies = [ [[package]] name = "darling_macro" -version = "0.20.9" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "733cabb43482b1a1b53eee8583c2b9e8684d592215ea83efd305dd31bc2f0178" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ - "darling_core 0.20.9", + "darling_core 0.20.10", "quote", - "syn 2.0.65", + "syn 2.0.85", ] [[package]] @@ -559,7 +667,7 @@ checksum = "4e018fccbeeb50ff26562ece792ed06659b9c2dae79ece77c4456bb10d9bf79b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.65", + "syn 2.0.85", ] [[package]] @@ -573,11 +681,11 @@ dependencies = [ [[package]] name = "derive_builder" -version = "0.20.0" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0350b5cb0331628a5916d6c5c0b72e97393b8b6b03b47a9284f4e7f5a405ffd7" +checksum = "507dfb09ea8b7fa618fcf76e953f4f5e192547945816d5358edffe39f6f94947" dependencies = [ - "derive_builder_macro 0.20.0", + "derive_builder_macro 0.20.2", ] [[package]] @@ -594,14 +702,14 @@ dependencies = [ [[package]] name = "derive_builder_core" -version = "0.20.0" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d48cda787f839151732d396ac69e3473923d54312c070ee21e9effcaa8ca0b1d" +checksum = "2d5bcf7b024d6835cfb3d473887cd966994907effbe9227e8c8219824d06c4e8" dependencies = [ - "darling 0.20.9", + "darling 0.20.10", "proc-macro2", "quote", - "syn 2.0.65", + "syn 2.0.85", ] [[package]] @@ -616,23 +724,33 @@ dependencies = [ [[package]] name = "derive_builder_macro" -version = "0.20.0" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "206868b8242f27cecce124c19fd88157fbd0dd334df2587f36417bafbc85097b" +checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c" dependencies = [ - "derive_builder_core 0.20.0", - "syn 2.0.65", + "derive_builder_core 0.20.2", + "syn 2.0.85", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", ] [[package]] name = "displaydoc" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.65", + "syn 2.0.85", ] [[package]] @@ -643,9 +761,9 @@ checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125" [[package]] name = "either" -version = "1.12.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] name = "embedded-io" @@ -654,10 +772,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced" [[package]] -name = "equivalent" -version = "1.0.1" +name = "embedded-io" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" [[package]] name = "erased-serde" @@ -697,6 +815,24 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" +[[package]] +name = "fastrand" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" + +[[package]] +name = "filetime" +version = "0.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35c0522e981e68cbfa8c3f978441a5f34b30b96e146b33cd3359176b50fe8586" +dependencies = [ + "cfg-if", + "libc", + "libredox", + "windows-sys 0.59.0", +] + [[package]] name = "final" version = "0.1.1" @@ -726,9 +862,9 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.30" +version = "1.0.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" +checksum = "a1b589b4dc103969ad3cf85c950899926ec64300a1a46d76c03a6072957036f0" dependencies = [ "crc32fast", "miniz_oxide", @@ -747,16 +883,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee1b05cbd864bcaecbd3455d6d967862d446e4ebfc3c2e5e5b9841e53cba6673" [[package]] -name = "generator" -version = "0.7.5" +name = "generic-array" +version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc16584ff22b460a382b7feec54b23d2908d858152e5739a120b949293bd74e" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ - "cc", - "libc", - "log", - "rustversion", - "windows", + "typenum", + "version_check", ] [[package]] @@ -789,7 +922,7 @@ checksum = "53010ccb100b96a67bc32c0175f0ed1426b31b655d562898e57325f81c023ac0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.65", + "syn 2.0.85", ] [[package]] @@ -798,6 +931,19 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +[[package]] +name = "globset" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15f1ce686646e7f1e19bf7d5533fe443a45dbfb990e00629110797578b42fb19" +dependencies = [ + "aho-corasick", + "bstr", + "log", + "regex-automata", + "regex-syntax", +] + [[package]] name = "hash_hasher" version = "2.0.3" @@ -867,20 +1013,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] -name = "indexmap" -version = "2.2.6" +name = "ignore" +version = "0.4.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +checksum = "6d89fd380afde86567dfba715db065673989d6253f42b88179abd3eae47bda4b" dependencies = [ - "equivalent", - "hashbrown", + "crossbeam-deque", + "globset", + "log", + "memchr", + "regex-automata", + "same-file", + "walkdir", + "winapi-util", ] [[package]] name = "is_terminal_polyfill" -version = "1.70.0" +version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" [[package]] name = "itertools" @@ -899,9 +1051,9 @@ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "jobserver" -version = "0.1.31" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2b099aaa34a9751c5bf0878add70444e1ed2dd73f347be99003d4577277de6e" +checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" dependencies = [ "libc", ] @@ -914,18 +1066,18 @@ checksum = "f5d4a7da358eff58addd2877a45865158f0d78c911d43a5784ceb7bbf52833b0" [[package]] name = "js-sys" -version = "0.3.69" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" dependencies = [ "wasm-bindgen", ] [[package]] name = "lazy_static" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "lazycell" @@ -935,31 +1087,42 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.155" +version = "0.2.161" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" [[package]] name = "libloading" -version = "0.8.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19" +checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", - "windows-targets 0.52.5", + "windows-targets 0.52.6", ] [[package]] name = "libm" -version = "0.2.8" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" +checksum = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa" + +[[package]] +name = "libredox" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" +dependencies = [ + "bitflags 2.6.0", + "libc", + "redox_syscall", +] [[package]] name = "libsqlite3-sys" -version = "0.28.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c10584274047cb335c23d3e61bcef8e323adae7c5c8c760540f73610177fc3f" +checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149" dependencies = [ "pkg-config", "vcpkg", @@ -973,38 +1136,15 @@ checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "log" -version = "0.4.21" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" - -[[package]] -name = "loom" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff50ecb28bb86013e935fb6683ab1f6d3a20016f123c76fd4c27470076ac30f5" -dependencies = [ - "cfg-if", - "generator", - "pin-utils", - "scoped-tls", - "tracing", - "tracing-subscriber", -] - -[[package]] -name = "matchers" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" -dependencies = [ - "regex-automata 0.1.10", -] +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "memchr" -version = "2.7.2" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "memoffset" @@ -1023,11 +1163,20 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.7.3" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87dfd01fe195c66b572b37921ad8803d010623c0aca821bea2302239d155cdae" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" dependencies = [ - "adler", + "adler2", +] + +[[package]] +name = "miow" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "359f76430b20a79f9e20e115b3428614e654f04fab314482fc0fda0ebd3c6044" +dependencies = [ + "windows-sys 0.48.0", ] [[package]] @@ -1052,7 +1201,7 @@ source = "git+https://github.com/juntyr/rsmpi?rev=2988f56#2988f56e350311acc04119 dependencies = [ "proc-macro2", "quote", - "syn 2.0.65", + "syn 2.0.85", ] [[package]] @@ -1135,6 +1284,7 @@ dependencies = [ "necsim-impls-no-std", "pcg_rand", "rand_core", + "rmp-serde", "serde", "thiserror", ] @@ -1297,16 +1447,6 @@ dependencies = [ "minimal-lexical", ] -[[package]] -name = "nu-ansi-term" -version = "0.46.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" -dependencies = [ - "overload", - "winapi", -] - [[package]] name = "num-traits" version = "0.2.19" @@ -1318,24 +1458,21 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.19.0" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "oneshot" -version = "0.1.6" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f6640c6bda7731b1fdbab747981a0f896dd1fedaf9f4a53fa237a04a84431f4" -dependencies = [ - "loom", -] +checksum = "e296cf87e61c9cfc1a61c3c63a0f7f286ed4554e0e22be84e8a38e1d264a2a29" [[package]] -name = "overload" -version = "0.1.1" +name = "paste" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "pcg_rand" @@ -1352,21 +1489,15 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" - -[[package]] -name = "pin-utils" -version = "0.1.0" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" [[package]] name = "pkg-config" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "planus" @@ -1379,60 +1510,62 @@ dependencies = [ [[package]] name = "postcard" -version = "1.0.8" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a55c51ee6c0db07e68448e336cf8ea4131a620edefebf9893e759b2d793420f8" +checksum = "5f7f0a8d620d71c457dd1d47df76bb18960378da56af4527aaa10f515eee732e" dependencies = [ "cobs", - "embedded-io", + "embedded-io 0.4.0", + "embedded-io 0.6.1", "serde", ] [[package]] name = "ppv-lite86" -version = "0.2.17" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] [[package]] name = "prettyplease" -version = "0.2.20" +version = "0.2.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" +checksum = "64d1ec885c64d0457d564db4ec299b2dae3f9c02808b8ad9c3a089c591b18033" dependencies = [ "proc-macro2", - "syn 2.0.65", + "syn 2.0.85", ] [[package]] -name = "proc-macro-error" -version = "1.0.4" +name = "proc-macro-error-attr2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5" dependencies = [ - "proc-macro-error-attr", "proc-macro2", "quote", - "syn 1.0.109", - "version_check", ] [[package]] -name = "proc-macro-error-attr" -version = "1.0.4" +name = "proc-macro-error2" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802" dependencies = [ + "proc-macro-error-attr2", "proc-macro2", "quote", - "version_check", + "syn 2.0.85", ] [[package]] name = "proc-macro2" -version = "1.0.83" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b33eb56c327dec362a9e55b3ad14f9d2f0904fb5a5b03b513ab5465399e9f43" +checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" dependencies = [ "unicode-ident", ] @@ -1447,26 +1580,11 @@ dependencies = [ "winapi", ] -[[package]] -name = "ptx-builder" -version = "0.6.0" -source = "git+https://github.com/juntyr/rust-ptx-builder?rev=aeb3b68#aeb3b68a85e3a5ee10757b357104e554ed44729f" -dependencies = [ - "anyhow", - "colored", - "lazy_static", - "libc", - "regex", - "semver", - "thiserror", - "toml", -] - [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -1502,48 +1620,64 @@ dependencies = [ ] [[package]] -name = "regex" -version = "1.10.4" +name = "redox_syscall" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" +checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" dependencies = [ - "aho-corasick", - "memchr", - "regex-automata 0.4.6", - "regex-syntax 0.8.3", + "bitflags 2.6.0", ] [[package]] -name = "regex-automata" -version = "0.1.10" +name = "regex" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ - "regex-syntax 0.6.29", + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", ] [[package]] name = "regex-automata" -version = "0.4.6" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" +checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.3", + "regex-syntax", ] [[package]] name = "regex-syntax" -version = "0.6.29" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] -name = "regex-syntax" -version = "0.8.3" +name = "rmp" +version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" +checksum = "228ed7c16fa39782c3b3468e974aec2795e9089153cd08ee2e9aefb3613334c4" +dependencies = [ + "byteorder", + "num-traits", + "paste", +] + +[[package]] +name = "rmp-serde" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52e599a477cf9840e92f2cde9a7189e67b42c57532749bf90aea6ec10facd4db" +dependencies = [ + "byteorder", + "rmp", + "serde", +] [[package]] name = "ron" @@ -1552,18 +1686,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b91f7eff05f748767f183df4320a63d6936e9c6107d97c9e6bdd9784f4289c94" dependencies = [ "base64", - "bitflags 2.5.0", + "bitflags 2.6.0", "serde", "serde_derive", ] [[package]] name = "rusqlite" -version = "0.31.0" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b838eba278d213a8beaf485bd313fd580ca4505a00d5871caeb1457c55322cae" +checksum = "7753b721174eb8ff87a9a0e799e2d7bc3749323e773db92e0984debb00019d6e" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "fallible-iterator", "fallible-streaming-iterator", "hashlink", @@ -1574,7 +1708,7 @@ dependencies = [ [[package]] name = "rust-cuda" version = "0.1.0" -source = "git+https://github.com/juntyr/rust-cuda?rev=f2a377d#f2a377d828f361423c411303118b1753864e7ce3" +source = "git+https://github.com/juntyr/rust-cuda?rev=62e96a9#62e96a93b4d109bc893ac2e82df22d2f52ceafa2" dependencies = [ "const-type-layout", "final", @@ -1584,39 +1718,37 @@ dependencies = [ "rust-cuda-kernel", "rustacuda", "rustacuda_core", - "rustacuda_derive", "safer_owning_ref", ] [[package]] name = "rust-cuda-derive" version = "0.1.0" -source = "git+https://github.com/juntyr/rust-cuda?rev=f2a377d#f2a377d828f361423c411303118b1753864e7ce3" +source = "git+https://github.com/juntyr/rust-cuda?rev=62e96a9#62e96a93b4d109bc893ac2e82df22d2f52ceafa2" dependencies = [ - "proc-macro-error", + "proc-macro-error2", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.85", ] [[package]] name = "rust-cuda-kernel" version = "0.1.0" -source = "git+https://github.com/juntyr/rust-cuda?rev=f2a377d#f2a377d828f361423c411303118b1753864e7ce3" +source = "git+https://github.com/juntyr/rust-cuda?rev=62e96a9#62e96a93b4d109bc893ac2e82df22d2f52ceafa2" dependencies = [ + "cargo-util", "cargo_metadata", "colored", "find_cuda_helper", - "lazy_static", - "proc-macro-error", + "proc-macro-error2", "proc-macro2", - "ptx-builder", "quote", - "regex", + "scratch", "seahash", "serde_json", "strip-ansi-escapes", - "syn 1.0.109", + "syn 2.0.85", "thiserror", ] @@ -1654,9 +1786,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustc_version" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ "semver", ] @@ -1671,8 +1803,7 @@ dependencies = [ "bincode", "clap", "colored", - "derive_builder 0.20.0", - "either", + "derive_builder 0.20.2", "fnv", "getrandom", "log", @@ -1794,7 +1925,6 @@ version = "0.1.0" dependencies = [ "anyhow", "displaydoc", - "either", "log", "necsim-core", "necsim-core-bond", @@ -1808,23 +1938,17 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.34" +version = "0.38.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +checksum = "aa260229e6538e52293eeb577aabd09945a09d6d9cc0fc550ed7529056c2e32a" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "errno", "libc", "linux-raw-sys", "windows-sys 0.52.0", ] -[[package]] -name = "rustversion" -version = "1.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" - [[package]] name = "ryu" version = "1.0.18" @@ -1841,10 +1965,19 @@ dependencies = [ ] [[package]] -name = "scoped-tls" -version = "1.0.1" +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "scratch" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" +checksum = "a3cf7c11c38cb994f3d40e8a8cde3bbd1f72a435e4c49e85d6553d8312306152" [[package]] name = "seahash" @@ -1863,22 +1996,22 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.202" +version = "1.0.214" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "226b61a0d411b2ba5ff6d7f73a476ac4f8bb900373459cd00fab8512828ba395" +checksum = "f55c3193aca71c12ad7890f1785d2b73e1b9f63a0bbc353c08ef26fe03fc56b5" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.202" +version = "1.0.214" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6048858004bcff69094cd972ed40a32500f153bd3be9f716b2eed2e8217c4838" +checksum = "de523f781f095e28fa605cdce0f8307e451cc0fd14e2eb4cd2e98a355b147766" dependencies = [ "proc-macro2", "quote", - "syn 2.0.65", + "syn 2.0.85", ] [[package]] @@ -1894,11 +2027,12 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.117" +version = "1.0.132" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" +checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03" dependencies = [ "itoa", + "memchr", "ryu", "serde", ] @@ -1913,15 +2047,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_spanned" -version = "0.6.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0" -dependencies = [ - "serde", -] - [[package]] name = "serde_state" version = "0.4.8" @@ -1932,14 +2057,22 @@ dependencies = [ ] [[package]] -name = "sharded-slab" -version = "0.1.7" +name = "sha2" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ - "lazy_static", + "cfg-if", + "cpufeatures", + "digest", ] +[[package]] +name = "shell-escape" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45bb67a18fa91266cc7807181f62f9178a6873bfad7dc788c42e6430db40184f" + [[package]] name = "shell-words" version = "1.1.0" @@ -1954,9 +2087,9 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "simdutf8" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" +checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" [[package]] name = "slab" @@ -2019,9 +2152,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.65" +version = "2.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2863d96a84c6439701d7a38f9de935ec562c8832cc55d1dde0f513b52fad106" +checksum = "5023162dfcd14ef8f32034d8bcd4cc5ddc61ef7a247c024a33e24e1f24d21b56" dependencies = [ "proc-macro2", "quote", @@ -2029,33 +2162,36 @@ dependencies = [ ] [[package]] -name = "thiserror" -version = "1.0.61" +name = "tempfile" +version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" +checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" dependencies = [ - "thiserror-impl", + "cfg-if", + "fastrand", + "once_cell", + "rustix", + "windows-sys 0.59.0", ] [[package]] -name = "thiserror-impl" -version = "1.0.61" +name = "thiserror" +version = "1.0.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" +checksum = "5d11abd9594d9b38965ef50805c5e469ca9cc6f197f883f717e0269a3057b3d5" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.65", + "thiserror-impl", ] [[package]] -name = "thread_local" -version = "1.1.8" +name = "thiserror-impl" +version = "1.0.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" +checksum = "ae71770322cbd277e69d762a16c444af02aa0575ac0d174f0b9562d3b37f8602" dependencies = [ - "cfg-if", - "once_cell", + "proc-macro2", + "quote", + "syn 2.0.85", ] [[package]] @@ -2078,40 +2214,6 @@ dependencies = [ "crunchy", ] -[[package]] -name = "toml" -version = "0.8.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4e43f8cc456c9704c851ae29c67e17ef65d2c30017c17a9765b89c382dc8bba" -dependencies = [ - "serde", - "serde_spanned", - "toml_datetime", - "toml_edit", -] - -[[package]] -name = "toml_datetime" -version = "0.6.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" -dependencies = [ - "serde", -] - -[[package]] -name = "toml_edit" -version = "0.22.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c127785850e8c20836d49732ae6abfa47616e60bf9d9f57c43c250361a9db96c" -dependencies = [ - "indexmap", - "serde", - "serde_spanned", - "toml_datetime", - "winnow", -] - [[package]] name = "tracing" version = "0.1.40" @@ -2119,21 +2221,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ "pin-project-lite", - "tracing-attributes", "tracing-core", ] -[[package]] -name = "tracing-attributes" -version = "0.1.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.65", -] - [[package]] name = "tracing-core" version = "0.1.32" @@ -2141,36 +2231,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", - "valuable", -] - -[[package]] -name = "tracing-log" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" -dependencies = [ - "log", - "once_cell", - "tracing-core", -] - -[[package]] -name = "tracing-subscriber" -version = "0.3.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" -dependencies = [ - "matchers", - "nu-ansi-term", - "once_cell", - "regex", - "sharded-slab", - "smallvec", - "thread_local", - "tracing", - "tracing-core", - "tracing-log", ] [[package]] @@ -2180,7 +2240,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2f81d88299be08aaed950ee88530a09d6fb33e84d475d6af1233f1a304a6d812" dependencies = [ "bindgen", - "bitflags 2.5.0", + "bitflags 2.6.0", "cc", "delegate", "humantime", @@ -2192,9 +2252,15 @@ dependencies = [ [[package]] name = "typeid" -version = "1.0.0" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e13db2e0ccd5e14a544e8a246ba2312cd25223f616442d7f2cb0e3db614236e" + +[[package]] +name = "typenum" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "059d83cc991e7a42fc37bd50941885db0888e34209f8cfd9aab07ddec03bc9cf" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "uname" @@ -2207,21 +2273,15 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "utf8parse" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" - -[[package]] -name = "valuable" -version = "0.1.0" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "vcpkg" @@ -2231,9 +2291,9 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "version_check" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "vte" @@ -2247,14 +2307,24 @@ dependencies = [ [[package]] name = "vte_generate_state_changes" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d257817081c7dffcdbab24b9e62d2def62e2ff7d00b1c20062551e6cccc145ff" +checksum = "2e369bee1b05d510a7b4ed645f5faa90619e05437111783ea5848f28d97d3c2e" dependencies = [ "proc-macro2", "quote", ] +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -2263,34 +2333,35 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" dependencies = [ "cfg-if", + "once_cell", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.65", + "syn 2.0.85", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2298,22 +2369,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.65", + "syn 2.0.85", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" +checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" [[package]] name = "weezl" @@ -2349,6 +2420,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +[[package]] +name = "winapi-util" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" +dependencies = [ + "windows-sys 0.59.0", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" @@ -2356,30 +2436,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] -name = "windows" +name = "windows-sys" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ "windows-targets 0.48.5", ] [[package]] name = "windows-sys" -version = "0.48.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] name = "windows-sys" -version = "0.52.0" +version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ - "windows-targets 0.52.5", + "windows-targets 0.52.6", ] [[package]] @@ -2399,18 +2479,18 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm 0.52.5", - "windows_aarch64_msvc 0.52.5", - "windows_i686_gnu 0.52.5", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", "windows_i686_gnullvm", - "windows_i686_msvc 0.52.5", - "windows_x86_64_gnu 0.52.5", - "windows_x86_64_gnullvm 0.52.5", - "windows_x86_64_msvc 0.52.5", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -2421,9 +2501,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" @@ -2433,9 +2513,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" @@ -2445,15 +2525,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" [[package]] name = "windows_i686_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" @@ -2463,9 +2543,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" @@ -2475,9 +2555,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" @@ -2487,9 +2567,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" @@ -2499,35 +2579,27 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" - -[[package]] -name = "winnow" -version = "0.6.8" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c52e9c97a68071b23e836c9380edae937f17b9c4667bd021973efc689f618d" -dependencies = [ - "memchr", -] +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "zerocopy" -version = "0.7.34" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ + "byteorder", "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.34" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.65", + "syn 2.0.85", ] diff --git a/docs/simulate.ron b/docs/simulate.ron index d40aae811..6f522b969 100644 --- a/docs/simulate.ron +++ b/docs/simulate.ron @@ -280,6 +280,82 @@ tail_p: (0.0 < f64), ) ), + /* downscale the habitat to consider adjacent locations to be part + * of the same larger deme + * downscaling reduces the accuracy of the simulation but may speed + * up its execution with EventSkipping algorithm + * downscaling may be worth during the tail of the simulation, when + * few lineages remain, the speciation probability is low, and + * waiting for all lineages to speciate or coalesce dominates + * simulation times + * optional, default = None + * requires the `almost-infinite-downscaled-scenario` feature */ + downscale: ( + /* no downscaling is used */ + | None + /* downscale the habitat by separate dx and dy factors + * each of the 1/(dx*dy) habitable locations now has a deme of + * size dx*dy */ + | Downscale( + /* downscale factor along the x-axis of the habitat + * expressed either as a power-of-two integer + * or as a base-two scientific notation string */ + x: (u32 = 2^{0..=16}) or ("1B{0..=16}"), + /* downscale factor along the y-axis of the habitat + * expressed either as a power-of-two integer + * or as a base-two scientific notation string */ + y: (u32 = 2^{0..=16}) or ("1B{0..=16}"), + /* number of random samples used to emperically determine + * the self-dispersal probability (and the non-self- + * dispersal target probability distribution, + * if precomputing is used, see non_self_dispersal below) + * optional, default = 2^22 */ + samples: (0 < u32), + /* strategy for sampling non-self-dispersal iff non-self- + * dispersal must be sampled separately, e.g. for the + * EventSkipping algorithm + * Note: this option has no effect when normal dispersal + * sampling is used + * optional, default = Accurate */ + non_self_dispersal: ( + /* use accurate rejection sampling to sample non-self- + * dispersals + * rejection sampling may be very slow if the + * probability of self-dispersal is very high */ + | Accurate + /* choose between accurate but slow rejection sampling + * and the approximate but fast precomputing based + * on the probability of non-self-dispersal + * refer to the Accurate and PrecomputeApproximation + * strategies above and below for more information on + * their merits and when to choose which */ + | UnlikelyApproximation( + /* threshold for the non-self-dispersal probability + * for which rejection sampling is chosen + * choose rejection sampling if + * P(non-self-dispersal) >= likelihood + * choose precomputing if + * P(non-self-dispersal) < likelihood + * likelihood = 0.0 is equivalent to Accurate + * likelihood = 1.0 is equivalent to + * PrecomputeApproximation */ + likelihood: (0.0 <= f64 <= 1.0), + ) + /* precompute the non-self-dispersal target distribution + * using the number of samples given above + * precomputing the distribution is an approximation + * that only stores a discrete set of dispersal targets + * (which may exclude some valid targets) with + * approximate dispersal probabilities + * precomputing only be chosen when this approximation + * can sufficiently represent the dispersal + * sampling a precomputed dispersal distribution may be + * significantly faster than using rejection sampling + * when the probability of self-dispersal is high */ + | PrecomputeApproximation + ) + ) + ) ) /* (almost) infinite spatially-explicit scenario with (approximate) Gaussian distributed dispersal * each location (x, y) in the landscape has either habitat for exactly one individual, diff --git a/necsim/core/Cargo.toml b/necsim/core/Cargo.toml index cfc66b28b..807965e9e 100644 --- a/necsim/core/Cargo.toml +++ b/necsim/core/Cargo.toml @@ -15,12 +15,12 @@ cuda = ["rust-cuda"] necsim-core-maths = { path = "maths" } necsim-core-bond = { path = "bond" } -const-type-layout = { version = "0.3.1", features = ["derive"] } +const-type-layout = { version = "0.3.2", features = ["derive"] } contracts = "0.6.3" serde = { version = "1.0", default-features = false, features = ["derive"] } [target.'cfg(target_os = "cuda")'.dependencies] -rust-cuda = { git = "https://github.com/juntyr/rust-cuda", rev = "f2a377d", features = ["derive"], optional = true } +rust-cuda = { git = "https://github.com/juntyr/rust-cuda", rev = "62e96a9", features = ["derive"], optional = true } [target.'cfg(not(target_os = "cuda"))'.dependencies] -rust-cuda = { git = "https://github.com/juntyr/rust-cuda", rev = "f2a377d", features = ["derive", "host"], optional = true } +rust-cuda = { git = "https://github.com/juntyr/rust-cuda", rev = "62e96a9", features = ["derive", "host"], optional = true } diff --git a/necsim/core/bond/Cargo.toml b/necsim/core/bond/Cargo.toml index 445bbc9a2..54c31f846 100644 --- a/necsim/core/bond/Cargo.toml +++ b/necsim/core/bond/Cargo.toml @@ -13,5 +13,5 @@ default = [] [dependencies] necsim-core-maths = { path = "../maths" } -const-type-layout = { version = "0.3.1", features = ["derive"] } +const-type-layout = { version = "0.3.2", features = ["derive"] } serde = { version = "1.0", default-features = false, features = ["derive"] } diff --git a/necsim/core/bond/src/closed_open_unit_f64.rs b/necsim/core/bond/src/closed_open_unit_f64.rs index e6424106a..1f37589d1 100644 --- a/necsim/core/bond/src/closed_open_unit_f64.rs +++ b/necsim/core/bond/src/closed_open_unit_f64.rs @@ -10,7 +10,7 @@ use serde::{Deserialize, Serialize}; use crate::ClosedUnitF64; #[derive(Debug)] -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct ClosedOpenUnitF64Error(f64); impl fmt::Display for ClosedOpenUnitF64Error { @@ -19,7 +19,7 @@ impl fmt::Display for ClosedOpenUnitF64Error { } } -#[allow(clippy::unsafe_derive_deserialize)] +#[expect(clippy::unsafe_derive_deserialize)] #[derive(Copy, Clone, Deserialize, Serialize, TypeLayout)] #[repr(transparent)] #[serde(try_from = "f64", into = "f64")] @@ -88,7 +88,6 @@ impl ClosedOpenUnitF64 { } impl PartialEq for ClosedOpenUnitF64 { - #[allow(clippy::unconditional_recursion)] fn eq(&self, other: &Self) -> bool { self.0.eq(&other.0) } diff --git a/necsim/core/bond/src/closed_unit_f64.rs b/necsim/core/bond/src/closed_unit_f64.rs index d5c0bdc02..c35ae9c7b 100644 --- a/necsim/core/bond/src/closed_unit_f64.rs +++ b/necsim/core/bond/src/closed_unit_f64.rs @@ -12,7 +12,7 @@ use serde::{Deserialize, Serialize}; use crate::{ClosedOpenUnitF64, OpenClosedUnitF64}; #[derive(Debug)] -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct ClosedUnitF64Error(f64); impl fmt::Display for ClosedUnitF64Error { @@ -21,7 +21,7 @@ impl fmt::Display for ClosedUnitF64Error { } } -#[allow(clippy::unsafe_derive_deserialize)] +#[expect(clippy::unsafe_derive_deserialize)] #[derive(Copy, Clone, Serialize, Deserialize, TypeLayout)] #[repr(transparent)] #[serde(try_from = "f64", into = "f64")] @@ -122,7 +122,6 @@ impl From for ClosedUnitF64 { } impl PartialEq for ClosedUnitF64 { - #[allow(clippy::unconditional_recursion)] fn eq(&self, other: &Self) -> bool { self.0.eq(&other.0) } diff --git a/necsim/core/bond/src/lib.rs b/necsim/core/bond/src/lib.rs index ff3007150..13cc4ebd1 100644 --- a/necsim/core/bond/src/lib.rs +++ b/necsim/core/bond/src/lib.rs @@ -1,6 +1,5 @@ #![deny(clippy::pedantic)] #![no_std] -#![feature(const_fn_floating_point_arithmetic)] #![feature(const_float_bits_conv)] #![feature(const_float_classify)] #![feature(const_type_name)] diff --git a/necsim/core/bond/src/non_negative_f64.rs b/necsim/core/bond/src/non_negative_f64.rs index 89e3ea295..32a7624bb 100644 --- a/necsim/core/bond/src/non_negative_f64.rs +++ b/necsim/core/bond/src/non_negative_f64.rs @@ -14,7 +14,7 @@ use necsim_core_maths::MathsCore; use crate::{ClosedOpenUnitF64, ClosedUnitF64, NonPositiveF64, OpenClosedUnitF64, PositiveF64}; #[derive(Debug)] -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct NonNegativeF64Error(f64); impl fmt::Display for NonNegativeF64Error { @@ -23,7 +23,7 @@ impl fmt::Display for NonNegativeF64Error { } } -#[allow(clippy::unsafe_derive_deserialize)] +#[expect(clippy::unsafe_derive_deserialize)] #[derive(Copy, Clone, Serialize, Deserialize, TypeLayout)] #[repr(transparent)] #[serde(try_from = "f64", into = "f64")] @@ -123,14 +123,14 @@ impl From for NonNegativeF64 { } impl From for NonNegativeF64 { - #[allow(clippy::cast_precision_loss)] + #[expect(clippy::cast_precision_loss)] fn from(value: u64) -> Self { Self(value as f64) } } impl From for NonNegativeF64 { - #[allow(clippy::cast_precision_loss)] + #[expect(clippy::cast_precision_loss)] fn from(value: usize) -> Self { Self(value as f64) } @@ -161,7 +161,6 @@ impl From for NonNegativeF64 { } impl PartialEq for NonNegativeF64 { - #[allow(clippy::unconditional_recursion)] fn eq(&self, other: &Self) -> bool { self.0.eq(&other.0) } diff --git a/necsim/core/bond/src/non_positive_f64.rs b/necsim/core/bond/src/non_positive_f64.rs index 2e7cce0e8..be91637c9 100644 --- a/necsim/core/bond/src/non_positive_f64.rs +++ b/necsim/core/bond/src/non_positive_f64.rs @@ -11,7 +11,7 @@ use serde::{Deserialize, Serialize}; use crate::NonNegativeF64; #[derive(Debug)] -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct NonPositiveF64Error(f64); impl fmt::Display for NonPositiveF64Error { @@ -20,7 +20,7 @@ impl fmt::Display for NonPositiveF64Error { } } -#[allow(clippy::unsafe_derive_deserialize)] +#[expect(clippy::unsafe_derive_deserialize)] #[derive(Copy, Clone, Serialize, Deserialize, TypeLayout)] #[repr(transparent)] #[serde(try_from = "f64", into = "f64")] @@ -94,7 +94,6 @@ impl NonPositiveF64 { } impl PartialEq for NonPositiveF64 { - #[allow(clippy::unconditional_recursion)] fn eq(&self, other: &Self) -> bool { self.0.eq(&other.0) } diff --git a/necsim/core/bond/src/non_zero_one_u64.rs b/necsim/core/bond/src/non_zero_one_u64.rs index e376d664d..3423341a0 100644 --- a/necsim/core/bond/src/non_zero_one_u64.rs +++ b/necsim/core/bond/src/non_zero_one_u64.rs @@ -3,7 +3,7 @@ use core::{convert::TryFrom, fmt, num::NonZeroU64}; use serde::{Deserialize, Deserializer, Serialize}; #[derive(Debug)] -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct NonZeroOneU64Error(u64); impl fmt::Display for NonZeroOneU64Error { diff --git a/necsim/core/bond/src/off_by_one_u32.rs b/necsim/core/bond/src/off_by_one_u32.rs index 15634939f..4bf0bc09f 100644 --- a/necsim/core/bond/src/off_by_one_u32.rs +++ b/necsim/core/bond/src/off_by_one_u32.rs @@ -1,9 +1,13 @@ -use core::{convert::TryFrom, fmt, num::NonZeroU64}; +use core::{ + convert::TryFrom, + fmt, + num::{NonZeroU32, NonZeroU64}, +}; use serde::{Deserialize, Deserializer, Serialize}; #[derive(Debug)] -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct OffByOneU32Error(u64); impl fmt::Display for OffByOneU32Error { @@ -33,7 +37,7 @@ impl OffByOneU32 { // Err(_) => Err(OffByOneU32Error(value)), // } match value.wrapping_sub(1) { - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_possible_truncation)] value if value <= (u32::MAX as u64) => Ok(Self(value as u32)), _ => Err(OffByOneU32Error(value)), } @@ -46,7 +50,7 @@ impl OffByOneU32 { /// /// The value must be in {1, .., 2^32}. pub const unsafe fn new_unchecked(value: u64) -> Self { - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_possible_truncation)] Self(value.wrapping_sub(1) as u32) } @@ -56,6 +60,11 @@ impl OffByOneU32 { (self.0 as u64) + 1_u64 } + #[must_use] + pub const fn sub_one(self) -> u32 { + self.0 + } + #[must_use] pub const fn add_incl(self, other: u32) -> u32 { other.wrapping_add(self.0) @@ -82,6 +91,12 @@ impl OffByOneU32 { } } +impl From for OffByOneU32 { + fn from(value: NonZeroU32) -> Self { + Self(value.get() - 1) + } +} + impl TryFrom for OffByOneU32 { type Error = OffByOneU32Error; diff --git a/necsim/core/bond/src/off_by_one_u64.rs b/necsim/core/bond/src/off_by_one_u64.rs index 853dc57e1..1f8cccb11 100644 --- a/necsim/core/bond/src/off_by_one_u64.rs +++ b/necsim/core/bond/src/off_by_one_u64.rs @@ -10,7 +10,7 @@ use serde::{Deserialize, Deserializer, Serialize}; use crate::{ClosedUnitF64, OffByOneU32}; #[derive(Debug)] -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct OffByOneU64Error(u128); impl fmt::Display for OffByOneU64Error { @@ -40,7 +40,7 @@ impl OffByOneU64 { // Err(_) => Err(OffByOneU64Error(value)), // } match value.wrapping_sub(1) { - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_possible_truncation)] value if value < (u64::MAX as u128) => Ok(Self(value as u64)), _ => Err(OffByOneU64Error(value)), } @@ -53,7 +53,7 @@ impl OffByOneU64 { /// /// The value must be in {1, .., 2^64}. pub const unsafe fn new_unchecked(value: u128) -> Self { - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_possible_truncation)] Self(value.wrapping_sub(1) as u64) } @@ -63,6 +63,11 @@ impl OffByOneU64 { (self.0 as u128) + 1_u128 } + #[must_use] + pub const fn sub_one(self) -> u64 { + self.0 + } + #[must_use] pub const fn add_incl(self, other: u64) -> u64 { other.wrapping_add(self.0) @@ -123,7 +128,7 @@ impl From for NonZeroU64 { } impl From for f64 { - #[allow(clippy::cast_precision_loss)] + #[expect(clippy::cast_precision_loss)] fn from(val: OffByOneU64) -> Self { (val.0 as f64) + 1.0_f64 } @@ -161,9 +166,9 @@ impl Mul for OffByOneU64 { type Output = Self; fn mul(self, other: ClosedUnitF64) -> Self::Output { - #[allow(clippy::cast_possible_truncation)] - #[allow(clippy::cast_sign_loss)] - #[allow(clippy::cast_precision_loss)] + #[expect(clippy::cast_possible_truncation)] + #[expect(clippy::cast_sign_loss)] + #[expect(clippy::cast_precision_loss)] Self(((((self.get() as f64) * other.get()) as u128) - 1) as u64) } } diff --git a/necsim/core/bond/src/open_closed_unit_f64.rs b/necsim/core/bond/src/open_closed_unit_f64.rs index b4b3441dc..d6cfc8900 100644 --- a/necsim/core/bond/src/open_closed_unit_f64.rs +++ b/necsim/core/bond/src/open_closed_unit_f64.rs @@ -11,7 +11,7 @@ use serde::{Deserialize, Serialize}; use crate::NonPositiveF64; #[derive(Debug)] -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct OpenClosedUnitF64Error(f64); impl fmt::Display for OpenClosedUnitF64Error { @@ -20,7 +20,7 @@ impl fmt::Display for OpenClosedUnitF64Error { } } -#[allow(clippy::unsafe_derive_deserialize)] +#[expect(clippy::unsafe_derive_deserialize)] #[derive(Copy, Clone, Deserialize, Serialize, TypeLayout)] #[repr(transparent)] #[serde(try_from = "f64", into = "f64")] @@ -94,7 +94,6 @@ impl OpenClosedUnitF64 { } impl PartialEq for OpenClosedUnitF64 { - #[allow(clippy::unconditional_recursion)] fn eq(&self, other: &Self) -> bool { self.0.eq(&other.0) } diff --git a/necsim/core/bond/src/positive_f64.rs b/necsim/core/bond/src/positive_f64.rs index de5766741..18616a1d0 100644 --- a/necsim/core/bond/src/positive_f64.rs +++ b/necsim/core/bond/src/positive_f64.rs @@ -12,7 +12,7 @@ use serde::{Deserialize, Serialize}; use crate::NonNegativeF64; #[derive(Debug)] -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct PositiveF64Error(f64); impl fmt::Display for PositiveF64Error { @@ -21,7 +21,7 @@ impl fmt::Display for PositiveF64Error { } } -#[allow(clippy::unsafe_derive_deserialize)] +#[expect(clippy::unsafe_derive_deserialize)] #[derive(Copy, Clone, Serialize, Deserialize, TypeLayout)] #[repr(transparent)] #[serde(try_from = "f64", into = "f64")] @@ -120,14 +120,13 @@ impl From for PositiveF64 { } impl From for PositiveF64 { - #[allow(clippy::cast_precision_loss)] + #[expect(clippy::cast_precision_loss)] fn from(value: NonZeroU64) -> Self { Self(value.get() as f64) } } impl PartialEq for PositiveF64 { - #[allow(clippy::unconditional_recursion)] fn eq(&self, other: &Self) -> bool { self.0.eq(&other.0) } diff --git a/necsim/core/src/cogs/active_lineage_sampler.rs b/necsim/core/src/cogs/active_lineage_sampler.rs index 98df0a19e..0fbf4bbd8 100644 --- a/necsim/core/src/cogs/active_lineage_sampler.rs +++ b/necsim/core/src/cogs/active_lineage_sampler.rs @@ -9,8 +9,6 @@ use super::{ use crate::{lineage::Lineage, simulation::partial::active_lineage_sampler::PartialSimulation}; -#[allow(clippy::inline_always, clippy::inline_fn_without_body)] -#[allow(clippy::no_effect_underscore_binding)] #[contract_trait] pub trait ActiveLineageSampler< M: MathsCore, diff --git a/necsim/core/src/cogs/backup.rs b/necsim/core/src/cogs/backup.rs index 09e8951fc..8bece805d 100644 --- a/necsim/core/src/cogs/backup.rs +++ b/necsim/core/src/cogs/backup.rs @@ -1,6 +1,5 @@ use core::ops::Deref; -#[allow(clippy::inline_always, clippy::inline_fn_without_body)] #[contract_trait] pub trait Backup: Sized { #[must_use] diff --git a/necsim/core/src/cogs/coalescence_sampler.rs b/necsim/core/src/cogs/coalescence_sampler.rs index f4d0aa4da..85fd12cb0 100644 --- a/necsim/core/src/cogs/coalescence_sampler.rs +++ b/necsim/core/src/cogs/coalescence_sampler.rs @@ -12,7 +12,6 @@ use crate::{ use super::{Habitat, LineageStore}; -#[allow(clippy::inline_always, clippy::inline_fn_without_body)] #[contract_trait] pub trait CoalescenceSampler, S: LineageStore>: crate::cogs::Backup + core::fmt::Debug @@ -68,11 +67,7 @@ impl CoalescenceRngSample { pub fn sample_coalescence_index(self, length: u32) -> u32 { // attributes on expressions are experimental // see https://github.com/rust-lang/rust/issues/15701 - #[allow( - clippy::cast_precision_loss, - clippy::cast_possible_truncation, - clippy::cast_sign_loss - )] + #[expect(clippy::cast_possible_truncation, clippy::cast_sign_loss)] let index = M::floor(self.0.get() * f64::from(length)) as u32; index } diff --git a/necsim/core/src/cogs/dispersal_sampler.rs b/necsim/core/src/cogs/dispersal_sampler.rs index 00f7e01ed..20ff14a22 100644 --- a/necsim/core/src/cogs/dispersal_sampler.rs +++ b/necsim/core/src/cogs/dispersal_sampler.rs @@ -7,9 +7,6 @@ use crate::{ use super::Habitat; -#[allow(clippy::inline_always, clippy::inline_fn_without_body)] -#[allow(clippy::no_effect_underscore_binding)] -#[allow(clippy::module_name_repetitions)] #[contract_trait] pub trait DispersalSampler, G: RngCore>: crate::cogs::Backup + core::fmt::Debug @@ -25,9 +22,7 @@ pub trait DispersalSampler, G: RngCore>: ) -> Location; } -#[allow(clippy::inline_always, clippy::inline_fn_without_body)] -#[allow(clippy::no_effect_underscore_binding)] -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[contract_trait] pub trait SeparableDispersalSampler, G: RngCore>: DispersalSampler diff --git a/necsim/core/src/cogs/emigration_exit.rs b/necsim/core/src/cogs/emigration_exit.rs index 45c6d37c3..6c99744ee 100644 --- a/necsim/core/src/cogs/emigration_exit.rs +++ b/necsim/core/src/cogs/emigration_exit.rs @@ -7,12 +7,7 @@ use crate::{ simulation::partial::emigration_exit::PartialSimulation, }; -#[allow( - clippy::inline_always, - clippy::inline_fn_without_body, - clippy::too_many_arguments -)] -#[allow(clippy::no_effect_underscore_binding)] +#[expect(clippy::too_many_arguments)] #[contract_trait] pub trait EmigrationExit, G: RngCore, S: LineageStore>: crate::cogs::Backup + core::fmt::Debug diff --git a/necsim/core/src/cogs/event_sampler.rs b/necsim/core/src/cogs/event_sampler.rs index 1a619935f..61ccb7a02 100644 --- a/necsim/core/src/cogs/event_sampler.rs +++ b/necsim/core/src/cogs/event_sampler.rs @@ -16,7 +16,6 @@ pub struct EventHandler { pub emigration: E, } -#[allow(clippy::inline_always, clippy::inline_fn_without_body)] #[contract_trait] pub trait EventSampler< M: MathsCore, diff --git a/necsim/core/src/cogs/habitat.rs b/necsim/core/src/cogs/habitat.rs index 105ed41b6..ef2170ecf 100644 --- a/necsim/core/src/cogs/habitat.rs +++ b/necsim/core/src/cogs/habitat.rs @@ -4,11 +4,6 @@ use crate::landscape::{IndexedLocation, LandscapeExtent, Location}; use super::{MathsCore, RngCore}; -#[allow( - clippy::inline_always, - clippy::inline_fn_without_body, - clippy::no_effect_underscore_binding -)] #[contract_trait] pub trait Habitat: crate::cogs::Backup + core::fmt::Debug + Sized { type LocationIterator<'a>: Iterator + 'a @@ -60,12 +55,7 @@ pub trait Habitat: crate::cogs::Backup + core::fmt::Debug + Sized fn iter_habitable_locations(&self) -> Self::LocationIterator<'_>; } -#[allow(clippy::module_name_repetitions)] -#[allow( - clippy::inline_always, - clippy::inline_fn_without_body, - clippy::no_effect_underscore_binding -)] +#[expect(clippy::module_name_repetitions)] #[contract_trait] pub trait UniformlySampleableHabitat>: Habitat { #[debug_ensures( diff --git a/necsim/core/src/cogs/immigration_entry.rs b/necsim/core/src/cogs/immigration_entry.rs index 03d4d8fbe..1cbb2500b 100644 --- a/necsim/core/src/cogs/immigration_entry.rs +++ b/necsim/core/src/cogs/immigration_entry.rs @@ -2,7 +2,6 @@ use crate::lineage::MigratingLineage; use super::MathsCore; -#[allow(clippy::inline_always, clippy::inline_fn_without_body)] #[contract_trait] pub trait ImmigrationEntry: crate::cogs::Backup + core::fmt::Debug { #[must_use] diff --git a/necsim/core/src/cogs/lineage_reference.rs b/necsim/core/src/cogs/lineage_reference.rs index 162dfe93c..e468add12 100644 --- a/necsim/core/src/cogs/lineage_reference.rs +++ b/necsim/core/src/cogs/lineage_reference.rs @@ -2,7 +2,6 @@ use core::hash::Hash; use super::{Habitat, MathsCore}; -#[allow(clippy::module_name_repetitions)] pub trait LineageReference>: crate::cogs::Backup + PartialEq + Eq + Hash + core::fmt::Debug { diff --git a/necsim/core/src/cogs/lineage_store.rs b/necsim/core/src/cogs/lineage_store.rs index afc0d319d..4575810e4 100644 --- a/necsim/core/src/cogs/lineage_store.rs +++ b/necsim/core/src/cogs/lineage_store.rs @@ -6,7 +6,6 @@ use crate::{ lineage::{GlobalLineageReference, Lineage}, }; -#[allow(clippy::inline_always, clippy::inline_fn_without_body)] #[contract_trait] pub trait LineageStore>: crate::cogs::Backup + Sized + core::fmt::Debug @@ -23,9 +22,7 @@ pub trait LineageStore>: ) -> Option<&Lineage>; } -#[allow(clippy::inline_always, clippy::inline_fn_without_body)] -#[allow(clippy::no_effect_underscore_binding)] -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[contract_trait] pub trait LocallyCoherentLineageStore>: LineageStore + for<'a> Index<&'a Self::LocalLineageReference, Output = Lineage> @@ -89,9 +86,7 @@ pub trait LocallyCoherentLineageStore>: ) -> Lineage; } -#[allow(clippy::inline_always, clippy::inline_fn_without_body)] -#[allow(clippy::no_effect_underscore_binding)] -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[contract_trait] pub trait GloballyCoherentLineageStore>: LocallyCoherentLineageStore diff --git a/necsim/core/src/cogs/rng.rs b/necsim/core/src/cogs/rng.rs index 01116caa0..77adf8091 100644 --- a/necsim/core/src/cogs/rng.rs +++ b/necsim/core/src/cogs/rng.rs @@ -1,14 +1,15 @@ use core::{ convert::AsMut, default::Default, - num::{NonZeroU128, NonZeroU32, NonZeroU64, NonZeroUsize}, + num::{NonZeroU128, NonZeroUsize}, ptr::copy_nonoverlapping, }; use serde::{de::DeserializeOwned, Serialize}; use necsim_core_bond::{ - ClosedOpenUnitF64, ClosedUnitF64, NonNegativeF64, OpenClosedUnitF64, PositiveF64, + ClosedOpenUnitF64, ClosedUnitF64, NonNegativeF64, OffByOneU32, OffByOneU64, OpenClosedUnitF64, + PositiveF64, }; use crate::{ @@ -16,7 +17,7 @@ use crate::{ landscape::IndexedLocation, }; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub trait RngCore: crate::cogs::Backup + Sized + Send + Clone + core::fmt::Debug + Serialize + DeserializeOwned { @@ -29,7 +30,7 @@ pub trait RngCore: fn sample_u64(&mut self) -> u64; } -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub trait SeedableRng: RngCore { #[must_use] fn seed_from_u64(mut state: u64) -> Self { @@ -47,9 +48,8 @@ pub trait SeedableRng: RngCore { state = state.wrapping_mul(MUL).wrapping_add(INC); // Use PCG output function with to_le to generate x: - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_possible_truncation)] let xorshifted = (((state >> 18) ^ state) >> 27) as u32; - #[allow(clippy::cast_possible_truncation)] let rot = (state >> 59) as u32; let x = xorshifted.rotate_right(rot).to_le(); @@ -65,8 +65,7 @@ pub trait SeedableRng: RngCore { impl> SeedableRng for R {} -#[allow(clippy::inline_always, clippy::inline_fn_without_body)] -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[contract_trait] pub trait RngSampler: RngCore { #[must_use] @@ -74,7 +73,7 @@ pub trait RngSampler: RngCore { /// Samples a uniform sample within `[0.0, 1.0)`, i.e. `0.0 <= X < 1.0` fn sample_uniform_closed_open(&mut self) -> ClosedOpenUnitF64 { // http://prng.di.unimi.it -> Generating uniform doubles in the unit interval - #[allow(clippy::cast_precision_loss)] + #[expect(clippy::cast_precision_loss)] let u01 = ((self.sample_u64() >> 11) as f64) * f64::from_bits(0x3CA0_0000_0000_0000_u64); // 0x1.0p-53 unsafe { ClosedOpenUnitF64::new_unchecked(u01) } @@ -85,7 +84,7 @@ pub trait RngSampler: RngCore { /// Samples a uniform sample within `(0.0, 1.0]`, i.e. `0.0 < X <= 1.0` fn sample_uniform_open_closed(&mut self) -> OpenClosedUnitF64 { // http://prng.di.unimi.it -> Generating uniform doubles in the unit interval - #[allow(clippy::cast_precision_loss)] + #[expect(clippy::cast_precision_loss)] let u01 = (((self.sample_u64() >> 11) + 1) as f64) * f64::from_bits(0x3CA0_0000_0000_0000_u64); // 0x1.0p-53 @@ -98,7 +97,7 @@ pub trait RngSampler: RngCore { fn sample_index(&mut self, length: NonZeroUsize) -> usize { // attributes on expressions are experimental // see https://github.com/rust-lang/rust/issues/15701 - #[allow( + #[expect( clippy::cast_precision_loss, clippy::cast_possible_truncation, clippy::cast_sign_loss @@ -111,36 +110,34 @@ pub trait RngSampler: RngCore { #[must_use] #[inline] - #[debug_ensures(ret < length.get(), "samples U(0, length - 1)")] - fn sample_index_u32(&mut self, length: NonZeroU32) -> u32 { + #[debug_ensures(u64::from(ret) < length.get(), "samples U(0, length - 1)")] + fn sample_index_u32(&mut self, length: OffByOneU32) -> u32 { // attributes on expressions are experimental // see https://github.com/rust-lang/rust/issues/15701 - #[allow( - clippy::cast_precision_loss, - clippy::cast_possible_truncation, - clippy::cast_sign_loss - )] + #[expect(clippy::cast_possible_truncation, clippy::cast_sign_loss)] let index = - M::floor(self.sample_uniform_closed_open().get() * f64::from(length.get())) as u32; + M::floor(self.sample_uniform_closed_open().get() * (f64::from(length.sub_one()) + 1.0)) + as u32; // Safety in case of f64 rounding errors - index.min(length.get() - 1) + index.min(length.sub_one()) } #[must_use] #[inline] - #[debug_ensures(ret < length.get(), "samples U(0, length - 1)")] - fn sample_index_u64(&mut self, length: NonZeroU64) -> u64 { + #[debug_ensures(u128::from(ret) < length.get(), "samples U(0, length - 1)")] + fn sample_index_u64(&mut self, length: OffByOneU64) -> u64 { // attributes on expressions are experimental // see https://github.com/rust-lang/rust/issues/15701 - #[allow( + #[expect( clippy::cast_precision_loss, clippy::cast_possible_truncation, clippy::cast_sign_loss )] let index = - M::floor(self.sample_uniform_closed_open().get() * (length.get() as f64)) as u64; + M::floor(self.sample_uniform_closed_open().get() * ((length.sub_one() as f64) + 1.0)) + as u64; // Safety in case of f64 rounding errors - index.min(length.get() - 1) + index.min(length.sub_one()) } #[must_use] @@ -149,7 +146,7 @@ pub trait RngSampler: RngCore { fn sample_index_u128(&mut self, length: NonZeroU128) -> u128 { // attributes on expressions are experimental // see https://github.com/rust-lang/rust/issues/15701 - #[allow( + #[expect( clippy::cast_precision_loss, clippy::cast_possible_truncation, clippy::cast_sign_loss @@ -199,12 +196,12 @@ pub trait RngSampler: RngCore { impl> RngSampler for R {} -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub trait PrimeableRng: RngCore { fn prime_with(&mut self, location_index: u64, time_index: u64); } -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub trait HabitatPrimeableRng>: PrimeableRng { #[inline] fn prime_with_habitat( @@ -222,7 +219,7 @@ pub trait HabitatPrimeableRng>: PrimeableRng { impl, H: Habitat> HabitatPrimeableRng for R {} -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub trait SplittableRng: RngCore { #[must_use] fn split(self) -> (Self, Self); diff --git a/necsim/core/src/cogs/speciation_probability.rs b/necsim/core/src/cogs/speciation_probability.rs index 8584228d6..81b483fae 100644 --- a/necsim/core/src/cogs/speciation_probability.rs +++ b/necsim/core/src/cogs/speciation_probability.rs @@ -5,7 +5,6 @@ use crate::{ landscape::Location, }; -#[allow(clippy::inline_always, clippy::inline_fn_without_body)] #[contract_trait] pub trait SpeciationProbability>: crate::cogs::Backup + core::fmt::Debug diff --git a/necsim/core/src/cogs/turnover_rate.rs b/necsim/core/src/cogs/turnover_rate.rs index fce772b01..613498bf2 100644 --- a/necsim/core/src/cogs/turnover_rate.rs +++ b/necsim/core/src/cogs/turnover_rate.rs @@ -5,7 +5,6 @@ use crate::{ landscape::Location, }; -#[allow(clippy::inline_always, clippy::inline_fn_without_body)] #[contract_trait] pub trait TurnoverRate>: crate::cogs::Backup + core::fmt::Debug diff --git a/necsim/core/src/event.rs b/necsim/core/src/event.rs index af42ac633..c5d8ce326 100644 --- a/necsim/core/src/event.rs +++ b/necsim/core/src/event.rs @@ -11,8 +11,8 @@ use crate::{ lineage::{GlobalLineageReference, LineageInteraction}, }; -#[allow(clippy::module_name_repetitions)] -#[allow(clippy::unsafe_derive_deserialize)] +#[expect(clippy::module_name_repetitions)] +#[expect(clippy::unsafe_derive_deserialize)] #[derive(Debug, Clone, Serialize, Deserialize, TypeLayout)] #[repr(C)] pub struct PackedEvent { @@ -35,13 +35,13 @@ impl PackedEvent { } } -#[allow(dead_code)] +#[expect(dead_code)] const EXCESSIVE_PACKED_EVENT_ERROR: [(); 1 - { const ASSERT: bool = core::mem::size_of::() == 56; ASSERT } as usize] = []; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq, Ord, PartialOrd, Hash)] pub enum EventType { Speciation, @@ -54,7 +54,7 @@ pub struct Dispersal { pub interaction: LineageInteraction, } -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug, Clone, Serialize, Deserialize, TypeLayout)] #[repr(C)] pub struct SpeciationEvent { @@ -64,13 +64,13 @@ pub struct SpeciationEvent { pub origin: IndexedLocation, } -#[allow(dead_code)] +#[expect(dead_code)] const EXCESSIVE_SPECIATION_EVENT_ERROR: [(); 1 - { const ASSERT: bool = core::mem::size_of::() == 40; ASSERT } as usize] = []; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug, Clone, Serialize, Deserialize)] pub struct DispersalEvent { pub global_lineage_reference: GlobalLineageReference, @@ -81,20 +81,20 @@ pub struct DispersalEvent { pub interaction: LineageInteraction, } -#[allow(dead_code)] +#[expect(dead_code)] const EXCESSIVE_DISPERSAL_EVENT_ERROR: [(); 1 - { const ASSERT: bool = core::mem::size_of::() == 64; ASSERT } as usize] = []; -#[allow(dead_code)] +#[expect(dead_code)] const EXCESSIVE_OPTION_DISPERSAL_EVENT_ERROR: [(); 1 - { const ASSERT: bool = core::mem::size_of::>() == core::mem::size_of::(); ASSERT } as usize] = []; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub enum TypedEvent { Speciation(SpeciationEvent), Dispersal(DispersalEvent), diff --git a/necsim/core/src/landscape/extent.rs b/necsim/core/src/landscape/extent.rs index c38e7afc3..de8d59bab 100644 --- a/necsim/core/src/landscape/extent.rs +++ b/necsim/core/src/landscape/extent.rs @@ -1,8 +1,8 @@ -use necsim_core_bond::OffByOneU32; +use necsim_core_bond::{OffByOneU32, OffByOneU64}; use super::Location; -#[allow(clippy::module_name_repetitions)] +#[allow(clippy::module_name_repetitions, clippy::unsafe_derive_deserialize)] // FIXME: use expect #[derive(PartialEq, Eq, Clone, Debug, serde::Deserialize, serde::Serialize, TypeLayout)] #[cfg_attr(feature = "cuda", derive(rust_cuda::lend::LendRustToCuda))] #[cfg_attr(feature = "cuda", cuda(ignore))] @@ -40,6 +40,14 @@ impl LandscapeExtent { self.height } + #[must_use] + pub const fn area(&self) -> OffByOneU64 { + // Safety: {1..=2^32} * {1..=2^32} = {1..=2^64} + unsafe { + OffByOneU64::new_unchecked((self.width.get() as u128) * (self.height.get() as u128)) + } + } + #[must_use] pub const fn contains(&self, location: &Location) -> bool { location.x() >= self.origin.x() diff --git a/necsim/core/src/landscape/location.rs b/necsim/core/src/landscape/location.rs index 7d8b2cf26..4ea067e7b 100644 --- a/necsim/core/src/landscape/location.rs +++ b/necsim/core/src/landscape/location.rs @@ -1,6 +1,6 @@ use serde::{Deserialize, Serialize}; -#[allow(clippy::module_name_repetitions)] +#[allow(clippy::module_name_repetitions)] // FIXME: use expect #[derive( Eq, PartialEq, PartialOrd, Ord, Clone, Hash, Debug, Serialize, Deserialize, TypeLayout, )] @@ -39,7 +39,7 @@ impl From for Location { #[derive( Eq, PartialEq, PartialOrd, Ord, Clone, Hash, Debug, Serialize, Deserialize, TypeLayout, )] -#[allow(clippy::module_name_repetitions)] +#[allow(clippy::module_name_repetitions)] // FIXME: use expect #[cfg_attr(feature = "cuda", derive(rust_cuda::lend::LendRustToCuda))] #[repr(C)] #[cfg_attr(feature = "cuda", cuda(ignore))] diff --git a/necsim/core/src/landscape/mod.rs b/necsim/core/src/landscape/mod.rs index 41a00b87f..9b0e873ee 100644 --- a/necsim/core/src/landscape/mod.rs +++ b/necsim/core/src/landscape/mod.rs @@ -1,6 +1,6 @@ mod extent; mod location; -#[allow(clippy::module_name_repetitions)] +#[allow(clippy::module_name_repetitions)] // FIXME: use expect pub use extent::{LandscapeExtent, LocationIterator}; pub use location::{IndexedLocation, Location}; diff --git a/necsim/core/src/lineage.rs b/necsim/core/src/lineage.rs index 57e85b9c3..2f9298a83 100644 --- a/necsim/core/src/lineage.rs +++ b/necsim/core/src/lineage.rs @@ -56,7 +56,7 @@ impl<'de> Deserialize<'de> for GlobalLineageReference { impl> LineageReference for GlobalLineageReference {} -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)] pub enum LineageInteraction { None, @@ -88,7 +88,7 @@ impl From> for LineageInteraction { } } -#[allow(clippy::module_name_repetitions)] +#[allow(clippy::module_name_repetitions)] // FIXME: use expect #[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, TypeLayout)] #[cfg_attr(feature = "cuda", derive(rust_cuda::lend::LendRustToCuda))] #[repr(C)] @@ -110,7 +110,6 @@ pub struct Lineage { impl Lineage { #[must_use] - #[allow(clippy::no_effect_underscore_binding)] #[debug_ensures( ret.indexed_location == old(indexed_location.clone()), "stores the indexed_location" @@ -162,7 +161,7 @@ pub enum TieBreaker { PreferLocal = 1, } -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug, PartialEq, Serialize, Deserialize)] #[repr(C)] pub struct MigratingLineage { diff --git a/necsim/core/src/reporter/combinator.rs b/necsim/core/src/reporter/combinator.rs index 0129bdc87..414c56f63 100644 --- a/necsim/core/src/reporter/combinator.rs +++ b/necsim/core/src/reporter/combinator.rs @@ -3,7 +3,7 @@ use crate::{ reporter::{boolean::Or, Reporter}, }; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug)] pub struct ReporterCombinator { front: F, diff --git a/necsim/core/src/reporter/filter.rs b/necsim/core/src/reporter/filter.rs index 57ef8c876..0bc4d0893 100644 --- a/necsim/core/src/reporter/filter.rs +++ b/necsim/core/src/reporter/filter.rs @@ -10,7 +10,6 @@ use crate::{ }, }; -#[allow(clippy::module_name_repetitions)] #[repr(transparent)] pub struct FilteredReporter< R: Reporter, diff --git a/necsim/core/src/reporter/group.rs b/necsim/core/src/reporter/group.rs index d3e800a05..ca50ef1b9 100644 --- a/necsim/core/src/reporter/group.rs +++ b/necsim/core/src/reporter/group.rs @@ -1,5 +1,5 @@ #[macro_export] -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] macro_rules! ReporterGroup { () => { $crate::reporter::NullReporter @@ -15,7 +15,7 @@ macro_rules! ReporterGroup { } #[macro_export] -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] macro_rules! ReporterUnGroup { ($reporter:expr => []) => {}; ($reporter:expr => [$first_reporter:ident $(,$reporter_tail:ident)*]) => { diff --git a/necsim/core/src/reporter/impl.rs b/necsim/core/src/reporter/impl.rs index 315086200..d2c7ae505 100644 --- a/necsim/core/src/reporter/impl.rs +++ b/necsim/core/src/reporter/impl.rs @@ -1,5 +1,5 @@ #[macro_export] -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] macro_rules! impl_report { // Special case: Ignored = MaybeUsed ($(#[$metas:meta])* $([$default:tt])? $target:ident(&mut $this:ident, $value:ident: Ignored) {}) => @@ -67,7 +67,7 @@ macro_rules! impl_report { } #[macro_export] -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] macro_rules! impl_finalise { ($(#[$metas:meta])* ($self:ident) $code:block) => { $(#[$metas])* diff --git a/necsim/core/src/reporter/mod.rs b/necsim/core/src/reporter/mod.rs index a934f58b1..8a5f5a19b 100644 --- a/necsim/core/src/reporter/mod.rs +++ b/necsim/core/src/reporter/mod.rs @@ -12,11 +12,11 @@ use used::MaybeUsed; pub mod boolean; pub mod used; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub use combinator::ReporterCombinator; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub use filter::FilteredReporter; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub use null::NullReporter; pub trait Reporter: core::fmt::Debug { diff --git a/necsim/core/src/reporter/null.rs b/necsim/core/src/reporter/null.rs index a5ac741fa..77aad21a6 100644 --- a/necsim/core/src/reporter/null.rs +++ b/necsim/core/src/reporter/null.rs @@ -1,6 +1,6 @@ use crate::{impl_report, reporter::Reporter}; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug)] pub struct NullReporter; diff --git a/necsim/core/src/reporter/used.rs b/necsim/core/src/reporter/used.rs index 8d83cd198..5331b69c1 100644 --- a/necsim/core/src/reporter/used.rs +++ b/necsim/core/src/reporter/used.rs @@ -2,7 +2,7 @@ use core::marker::PhantomData; use crate::reporter::boolean::{Boolean, False, True}; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[repr(transparent)] pub struct MaybeUsed { inner: T, diff --git a/necsim/core/src/simulation/builder.rs b/necsim/core/src/simulation/builder.rs index fc589b7ec..1bd3a8f5d 100644 --- a/necsim/core/src/simulation/builder.rs +++ b/necsim/core/src/simulation/builder.rs @@ -7,7 +7,7 @@ use crate::cogs::{ }; #[derive(Debug)] -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct SimulationBuilder< M: MathsCore, H: Habitat, diff --git a/necsim/core/src/simulation/mod.rs b/necsim/core/src/simulation/mod.rs index 29368e5a6..e8edfd5bd 100644 --- a/necsim/core/src/simulation/mod.rs +++ b/necsim/core/src/simulation/mod.rs @@ -18,7 +18,7 @@ use crate::{ reporter::Reporter, }; -#[allow(clippy::module_name_repetitions)] +#[allow(clippy::module_name_repetitions)] // FIXME: use expect pub use builder::{Simulation, SimulationBuilder}; use necsim_core_bond::{NonNegativeF64, PositiveF64}; diff --git a/necsim/impls/cuda/Cargo.toml b/necsim/impls/cuda/Cargo.toml index 0bc4114f3..5de014f34 100644 --- a/necsim/impls/cuda/Cargo.toml +++ b/necsim/impls/cuda/Cargo.toml @@ -10,12 +10,12 @@ edition = "2021" [dependencies] necsim-core = { path = "../../core", features = ["cuda"] } -const-type-layout = { version = "0.3.1", features = ["derive"] } +const-type-layout = { version = "0.3.2", features = ["derive"] } contracts = "0.6.3" serde = { version = "1.0", default-features = false, features = ["derive"] } [target.'cfg(target_os = "cuda")'.dependencies] -rust-cuda = { git = "https://github.com/juntyr/rust-cuda", rev = "f2a377d", features = ["derive"] } +rust-cuda = { git = "https://github.com/juntyr/rust-cuda", rev = "62e96a9", features = ["derive"] } [target.'cfg(not(target_os = "cuda"))'.dependencies] -rust-cuda = { git = "https://github.com/juntyr/rust-cuda", rev = "f2a377d", features = ["derive", "host"] } +rust-cuda = { git = "https://github.com/juntyr/rust-cuda", rev = "62e96a9", features = ["derive", "host"] } diff --git a/necsim/impls/cuda/src/cogs/maths.rs b/necsim/impls/cuda/src/cogs/maths.rs index 4b5df0d36..fbeff7055 100644 --- a/necsim/impls/cuda/src/cogs/maths.rs +++ b/necsim/impls/cuda/src/cogs/maths.rs @@ -1,7 +1,6 @@ use necsim_core::cogs::MathsCore; #[derive(Clone, Debug)] -#[allow(clippy::module_name_repetitions)] pub enum NvptxMathsCore {} impl MathsCore for NvptxMathsCore { @@ -25,7 +24,7 @@ impl MathsCore for NvptxMathsCore { unsafe { const FRAC_1_LOG2_E: f64 = 1.0_f64 / core::f64::consts::LOG2_E; - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_possible_truncation)] let x: f32 = x as f32; let f: f32; @@ -53,7 +52,7 @@ impl MathsCore for NvptxMathsCore { #[cfg(target_os = "cuda")] unsafe { - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_possible_truncation)] let x: f32 = (x * core::f64::consts::LOG2_E) as f32; let f: f32; @@ -87,9 +86,9 @@ impl MathsCore for NvptxMathsCore { // https://stackoverflow.com/a/54273307 // by https://stackoverflow.com/users/2341466/andars // Licensed under CC BY-SA 4.0 - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_possible_truncation)] let x: f32 = x as f32; - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_possible_truncation)] let exp: f32 = exp as f32; let log2_x: f32; @@ -118,7 +117,7 @@ impl MathsCore for NvptxMathsCore { #[cfg(target_os = "cuda")] unsafe { - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_possible_truncation)] let x: f32 = x as f32; let f: f32; @@ -142,7 +141,7 @@ impl MathsCore for NvptxMathsCore { #[cfg(target_os = "cuda")] unsafe { - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_possible_truncation)] let x: f32 = x as f32; let f: f32; diff --git a/necsim/impls/cuda/src/cogs/rng.rs b/necsim/impls/cuda/src/cogs/rng.rs index 8237ed1cf..ca1aa886c 100644 --- a/necsim/impls/cuda/src/cogs/rng.rs +++ b/necsim/impls/cuda/src/cogs/rng.rs @@ -10,7 +10,7 @@ use rust_cuda::{ use serde::{Deserialize, Deserializer, Serialize, Serializer}; -#[allow(clippy::module_name_repetitions)] +#[allow(clippy::module_name_repetitions)] // FIXME: use expect #[derive(Debug, Clone, rust_cuda::lend::LendRustToCuda)] #[cuda(free = "M", free = "R")] pub struct CudaRng diff --git a/necsim/impls/cuda/src/event_buffer.rs b/necsim/impls/cuda/src/event_buffer.rs index 1a08d85ca..51d2afb8f 100644 --- a/necsim/impls/cuda/src/event_buffer.rs +++ b/necsim/impls/cuda/src/event_buffer.rs @@ -32,7 +32,7 @@ use necsim_core::impl_report; use super::utils::MaybeSome; -#[allow(clippy::module_name_repetitions, clippy::type_complexity)] +#[allow(clippy::module_name_repetitions, clippy::type_complexity)] // FIXME: use expect #[derive(rust_cuda::lend::LendRustToCuda)] #[cuda(free = "ReportSpeciation", free = "ReportDispersal")] pub struct EventBuffer { @@ -143,7 +143,7 @@ impl let block_size = (block_size.x * block_size.y * block_size.z) as usize; let grid_size = (grid_size.x * grid_size.y * grid_size.z) as usize; - #[allow(clippy::bool_to_int_with_if)] + #[expect(clippy::bool_to_int_with_if)] let max_events = if ReportDispersal::VALUE { max_events } else if ReportSpeciation::VALUE { diff --git a/necsim/impls/cuda/src/lib.rs b/necsim/impls/cuda/src/lib.rs index 7f5a3bf91..7a93d45dd 100644 --- a/necsim/impls/cuda/src/lib.rs +++ b/necsim/impls/cuda/src/lib.rs @@ -2,7 +2,6 @@ #![no_std] #![feature(const_type_name)] #![cfg_attr(target_os = "cuda", feature(asm_experimental_arch))] -#![cfg_attr(target_os = "cuda", feature(asm_const))] #![cfg_attr(target_os = "cuda", feature(const_float_bits_conv))] #![allow(internal_features)] #![feature(core_intrinsics)] diff --git a/necsim/impls/cuda/src/utils.rs b/necsim/impls/cuda/src/utils.rs index 39c1c8285..cc2e816e3 100644 --- a/necsim/impls/cuda/src/utils.rs +++ b/necsim/impls/cuda/src/utils.rs @@ -9,10 +9,10 @@ pub struct MaybeSome(MaybeUninit); impl MaybeSome { #[cfg(not(target_os = "cuda"))] - #[allow(non_upper_case_globals)] + #[allow(non_upper_case_globals)] // FIXME: use expect pub(crate) const None: Self = Self(MaybeUninit::uninit()); - #[allow(non_snake_case)] + #[allow(non_snake_case)] // FIXME: use expect pub(crate) fn Some(value: T) -> Self { Self(MaybeUninit::new(value)) } diff --git a/necsim/impls/cuda/src/value_buffer.rs b/necsim/impls/cuda/src/value_buffer.rs index b1dc71f1a..522cba469 100644 --- a/necsim/impls/cuda/src/value_buffer.rs +++ b/necsim/impls/cuda/src/value_buffer.rs @@ -20,7 +20,7 @@ use super::utils::MaybeSome; #[derive(rust_cuda::lend::LendRustToCuda)] #[cuda(free = "T")] -#[allow(clippy::module_name_repetitions)] +#[allow(clippy::module_name_repetitions)] // FIXME: use expect pub struct ValueBuffer where T: StackOnly + PortableBitSemantics + TypeGraphLayout, @@ -140,7 +140,6 @@ impl ValueBuffer { pub fn take_value_for_core(&mut self) -> Option { - #[allow(clippy::option_if_let_else)] if let Some(mask) = self.mask.get_mut(0) { mask.write(false); diff --git a/necsim/impls/no-std/Cargo.toml b/necsim/impls/no-std/Cargo.toml index a952d12fb..880cbeaba 100644 --- a/necsim/impls/no-std/Cargo.toml +++ b/necsim/impls/no-std/Cargo.toml @@ -17,7 +17,7 @@ necsim-core-maths = { path = "../../core/maths" } necsim-core-bond = { path = "../../core/bond" } necsim-partitioning-core = { path = "../../partitioning/core" } -const-type-layout = { version = "0.3.1", features = ["derive"] } +const-type-layout = { version = "0.3.2", features = ["derive"] } contracts = "0.6.3" libm = "0.2" hashbrown = "0.14" @@ -30,7 +30,7 @@ fnv = { version = "1.0", default-features = false, features = [] } rand_core = "0.6" [target.'cfg(target_os = "cuda")'.dependencies] -rust-cuda = { git = "https://github.com/juntyr/rust-cuda", rev = "f2a377d", features = ["derive", "final"], optional = true } +rust-cuda = { git = "https://github.com/juntyr/rust-cuda", rev = "62e96a9", features = ["derive", "final"], optional = true } [target.'cfg(not(target_os = "cuda"))'.dependencies] -rust-cuda = { git = "https://github.com/juntyr/rust-cuda", rev = "f2a377d", features = ["derive", "final", "host"], optional = true } +rust-cuda = { git = "https://github.com/juntyr/rust-cuda", rev = "62e96a9", features = ["derive", "final", "host"], optional = true } diff --git a/necsim/impls/no-std/src/alias/mod.rs b/necsim/impls/no-std/src/alias/mod.rs index 558416936..afe730c12 100644 --- a/necsim/impls/no-std/src/alias/mod.rs +++ b/necsim/impls/no-std/src/alias/mod.rs @@ -7,8 +7,8 @@ use necsim_core_bond::{ClosedUnitF64, NonNegativeF64}; pub mod packed; -#[allow(clippy::module_name_repetitions)] -#[allow(non_snake_case)] +#[expect(clippy::module_name_repetitions)] +#[allow(non_snake_case)] // FIXME: use expect #[derive(Clone)] pub struct AliasMethodSampler { Us: Vec, @@ -17,7 +17,6 @@ pub struct AliasMethodSampler { } impl AliasMethodSampler { - #[allow(clippy::no_effect_underscore_binding)] #[debug_requires(!event_weights.is_empty(), "event_weights is non-empty")] #[debug_ensures( ret.Es.iter().eq(old(event_weights).iter().map(|(e, _p)| e)), @@ -31,11 +30,11 @@ impl AliasMethodSampler { "full buckets sample the same event just in case" )] pub fn new(event_weights: &[(E, NonNegativeF64)]) -> Self { - #[allow(non_snake_case)] + #[allow(non_snake_case)] // FIXME: use expect let mut Us = Vec::with_capacity(event_weights.len()); - #[allow(non_snake_case)] + #[allow(non_snake_case)] // FIXME: use expect let mut Es = Vec::with_capacity(event_weights.len()); - #[allow(non_snake_case)] + #[allow(non_snake_case)] // FIXME: use expect let mut Ks = Vec::with_capacity(event_weights.len()); let total_weight: NonNegativeF64 = event_weights.iter().map(|(_e, p)| *p).sum(); @@ -83,7 +82,7 @@ impl AliasMethodSampler { .for_each(|i| Us[i] = NonNegativeF64::one()); // Safety: The bucket weights are now probabilities in [0.0; 1.0] - #[allow(non_snake_case)] + #[allow(non_snake_case)] // FIXME: use expect let Us = unsafe { core::mem::transmute::, Vec>(Us) }; Self { Us, Es, Ks } @@ -95,14 +94,10 @@ impl AliasMethodSampler { let x = rng.sample_uniform_closed_open(); - #[allow( - clippy::cast_precision_loss, - clippy::cast_possible_truncation, - clippy::cast_sign_loss - )] + #[expect(clippy::cast_possible_truncation, clippy::cast_sign_loss)] let i = M::floor(x.get() * (self.Es.len() as f64)) as usize; // index into events - #[allow(clippy::cast_precision_loss)] + #[expect(clippy::cast_precision_loss)] let y = x.get() * (self.Es.len() as f64) - (i as f64); // U(0,1) to compare against U[i] if y < self.Us[i].get() { diff --git a/necsim/impls/no-std/src/alias/packed.rs b/necsim/impls/no-std/src/alias/packed.rs index 7548d7529..d3072921e 100644 --- a/necsim/impls/no-std/src/alias/packed.rs +++ b/necsim/impls/no-std/src/alias/packed.rs @@ -5,7 +5,6 @@ use alloc::vec::Vec; use necsim_core::cogs::{MathsCore, RngCore}; use necsim_core_bond::{ClosedUnitF64, NonNegativeF64}; -#[allow(clippy::module_name_repetitions)] #[derive(Clone, Debug, TypeLayout)] #[repr(C)] pub struct AliasMethodSamplerAtom { @@ -14,7 +13,6 @@ pub struct AliasMethodSamplerAtom { k: E, } -#[allow(dead_code)] struct AliasMethodSamplerAtomRaw { u: NonNegativeF64, e: E, @@ -39,7 +37,6 @@ impl AliasMethodSamplerAtom { self.u = self.u.one_minus(); } - #[allow(clippy::no_effect_underscore_binding)] #[debug_requires(!event_weights.is_empty(), "event_weights is non-empty")] #[debug_requires( event_weights.iter().all(|(_e, p)| *p >= 0.0_f64), @@ -57,7 +54,6 @@ impl AliasMethodSamplerAtom { "full buckets sample the same event just in case" )] pub fn create(event_weights: &[(E, NonNegativeF64)]) -> Vec> { - #[allow(non_snake_case)] let mut alias_samplers = Vec::with_capacity(event_weights.len()); let total_weight: NonNegativeF64 = event_weights.iter().map(|(_e, p)| *p).sum(); @@ -126,7 +122,6 @@ impl AliasMethodSamplerAtom { Self::sample_event_with_cdf_limit(alias_samplers, rng, ClosedUnitF64::one()) } - #[allow(clippy::no_effect_underscore_binding)] #[debug_requires(!alias_samplers.is_empty(), "alias_samplers is non-empty")] #[debug_ensures( old(alias_samplers).iter().map(|s| s.e).any(|e| e == ret), @@ -139,18 +134,14 @@ impl AliasMethodSamplerAtom { ) -> E { use necsim_core::cogs::RngSampler; - #[allow(clippy::cast_precision_loss)] + #[expect(clippy::cast_precision_loss)] let f = rng.sample_uniform_closed_open().get() * limit.get() * (alias_samplers.len() as f64); - #[allow( - clippy::cast_precision_loss, - clippy::cast_possible_truncation, - clippy::cast_sign_loss - )] + #[expect(clippy::cast_possible_truncation, clippy::cast_sign_loss)] let i = M::floor(f) as usize; // index into events - #[allow(clippy::cast_precision_loss)] + #[expect(clippy::cast_precision_loss)] let y = f - (i as f64); // U(0,1) to compare against U[i] let sample = &alias_samplers[i]; diff --git a/necsim/impls/no-std/src/array2d.rs b/necsim/impls/no-std/src/array2d.rs index f55364d98..7cc6871f5 100644 --- a/necsim/impls/no-std/src/array2d.rs +++ b/necsim/impls/no-std/src/array2d.rs @@ -352,7 +352,7 @@ impl> Array2D { Ok(self.array[start..end].iter()) } - #[allow(clippy::missing_panics_doc)] + #[expect(clippy::missing_panics_doc)] /// Returns an [`Iterator`] over all rows. Each [`Item`] is itself another /// [`Iterator`] over references to the elements in that row. /// diff --git a/necsim/impls/no-std/src/cache.rs b/necsim/impls/no-std/src/cache.rs index bfcd00d83..1da715d7c 100644 --- a/necsim/impls/no-std/src/cache.rs +++ b/necsim/impls/no-std/src/cache.rs @@ -3,7 +3,7 @@ use core::hash::{BuildHasher, Hash}; use fnv::FnvBuildHasher; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct DirectMappedCache { cache: Box<[Option]>, build_hasher: S, @@ -43,7 +43,7 @@ impl DirectMappedCache { let hash = self.build_hasher.hash_one(&value); - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_possible_truncation)] let index = (hash % (self.capacity() as u64)) as usize; let bucket = &mut self.cache[index]; diff --git a/necsim/impls/no-std/src/cogs/active_lineage_sampler/alias/individual/mod.rs b/necsim/impls/no-std/src/cogs/active_lineage_sampler/alias/individual/mod.rs index 2abdb6174..a1349d458 100644 --- a/necsim/impls/no-std/src/cogs/active_lineage_sampler/alias/individual/mod.rs +++ b/necsim/impls/no-std/src/cogs/active_lineage_sampler/alias/individual/mod.rs @@ -18,7 +18,7 @@ use super::sampler::stack::DynamicAliasMethodStackSampler; mod sampler; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct IndividualAliasActiveLineageSampler< M: MathsCore, H: Habitat, @@ -35,7 +35,7 @@ pub struct IndividualAliasActiveLineageSampler< alias_sampler: DynamicAliasMethodStackSampler, number_active_lineages: usize, last_event_time: NonNegativeF64, - #[allow(clippy::type_complexity)] + #[expect(clippy::type_complexity)] marker: PhantomData<(M, H, G, S, X, D, C, T, N, E, I)>, } @@ -76,7 +76,7 @@ impl< where H: 'h, { - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_possible_truncation)] let capacity = origin_sampler.full_upper_bound_size_hint() as usize; let mut lineage_store = S::with_capacity(origin_sampler.habitat(), capacity); diff --git a/necsim/impls/no-std/src/cogs/active_lineage_sampler/alias/location/mod.rs b/necsim/impls/no-std/src/cogs/active_lineage_sampler/alias/location/mod.rs index cecc4cd34..94ae62269 100644 --- a/necsim/impls/no-std/src/cogs/active_lineage_sampler/alias/location/mod.rs +++ b/necsim/impls/no-std/src/cogs/active_lineage_sampler/alias/location/mod.rs @@ -21,7 +21,7 @@ use super::sampler::indexed::DynamicAliasMethodIndexedSampler; mod sampler; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct LocationAliasActiveLineageSampler< M: MathsCore, H: Habitat, @@ -38,7 +38,7 @@ pub struct LocationAliasActiveLineageSampler< alias_sampler: DynamicAliasMethodIndexedSampler, number_active_lineages: usize, last_event_time: NonNegativeF64, - #[allow(clippy::type_complexity)] + #[expect(clippy::type_complexity)] marker: PhantomData<(M, H, G, S, X, D, C, T, N, E, I)>, } @@ -94,7 +94,7 @@ impl< where H: 'h, { - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_possible_truncation)] let capacity = origin_sampler.full_upper_bound_size_hint() as usize; let mut lineage_store = S::with_capacity(origin_sampler.habitat(), capacity); diff --git a/necsim/impls/no-std/src/cogs/active_lineage_sampler/alias/sampler/indexed/mod.rs b/necsim/impls/no-std/src/cogs/active_lineage_sampler/alias/sampler/indexed/mod.rs index 029ec46d8..db3c68086 100644 --- a/necsim/impls/no-std/src/cogs/active_lineage_sampler/alias/sampler/indexed/mod.rs +++ b/necsim/impls/no-std/src/cogs/active_lineage_sampler/alias/sampler/indexed/mod.rs @@ -22,7 +22,6 @@ struct RejectionSamplingGroup { total_weight: u128, } -#[allow(clippy::module_name_repetitions)] pub struct DynamicAliasMethodIndexedSampler { exponents: Vec, groups: Vec>, diff --git a/necsim/impls/no-std/src/cogs/active_lineage_sampler/alias/sampler/indexed/tests.rs b/necsim/impls/no-std/src/cogs/active_lineage_sampler/alias/sampler/indexed/tests.rs index da31ab406..7c7926802 100644 --- a/necsim/impls/no-std/src/cogs/active_lineage_sampler/alias/sampler/indexed/tests.rs +++ b/necsim/impls/no-std/src/cogs/active_lineage_sampler/alias/sampler/indexed/tests.rs @@ -25,7 +25,7 @@ fn singular_event_group() { } #[test] -#[allow(clippy::too_many_lines)] +#[expect(clippy::too_many_lines)] fn add_remove_event_group() { let mut group = RejectionSamplingGroup::new(0_u8, 1_u64); @@ -203,7 +203,7 @@ fn sample_single_group() { tally[sample as usize] += 1; } - #[allow(clippy::cast_precision_loss)] + #[expect(clippy::cast_precision_loss)] for (i, c) in tally.iter().enumerate() { let target = (((6 + i) as f64) / 51.0_f64) * 1000.0; let measure = ((*c as f64) / (N as f64)) * 1000.0; @@ -273,7 +273,7 @@ fn singular_event_group_full() { } #[test] -#[allow(clippy::too_many_lines)] +#[expect(clippy::too_many_lines)] fn add_remove_event_full() { let mut sampler = DynamicAliasMethodIndexedSampler::default(); assert_eq!(sampler.total_weight(), NonNegativeF64::zero()); @@ -604,7 +604,7 @@ fn add_remove_event_full() { } #[test] -#[allow(clippy::too_many_lines)] +#[expect(clippy::too_many_lines)] fn add_update_event_full() { let mut sampler = DynamicAliasMethodIndexedSampler::default(); assert_eq!(sampler.total_weight(), NonNegativeF64::zero()); @@ -934,7 +934,7 @@ fn sample_single_group_full() { tally[sample as usize] += 1; } - #[allow(clippy::cast_precision_loss)] + #[expect(clippy::cast_precision_loss)] for (i, c) in tally.iter().enumerate() { let target = (((6 + i) as f64) / 51.0_f64) * 1000.0; let measure = ((*c as f64) / (N as f64)) * 1000.0; @@ -980,7 +980,7 @@ fn sample_three_groups_full() { tally[sample as usize - 1] += 1; } - #[allow(clippy::cast_precision_loss)] + #[expect(clippy::cast_precision_loss)] for (i, c) in tally.iter().enumerate() { let target = (((i + 1) as f64) / 21.0_f64) * 1000.0; let measure = ((*c as f64) / (N as f64)) * 1000.0; @@ -1022,7 +1022,7 @@ fn sample_three_groups_full_reverse() { tally[sample as usize - 1] += 1; } - #[allow(clippy::cast_precision_loss)] + #[expect(clippy::cast_precision_loss)] for (i, c) in tally.iter().enumerate() { let target = (((i + 1) as f64) / 21.0_f64) * 1000.0; let measure = ((*c as f64) / (N as f64)) * 1000.0; @@ -1078,7 +1078,7 @@ impl DummyRng { fn new(mut vec: Vec) -> Self { vec.reverse(); - #[allow(clippy::cast_possible_truncation, clippy::cast_sign_loss)] + #[expect(clippy::cast_possible_truncation, clippy::cast_sign_loss)] Self( vec.into_iter() .map(|u01| ((u01 / f64::from_bits(0x3CA0_0000_0000_0000_u64)) as u64) << 11) diff --git a/necsim/impls/no-std/src/cogs/active_lineage_sampler/alias/sampler/mod.rs b/necsim/impls/no-std/src/cogs/active_lineage_sampler/alias/sampler/mod.rs index 745151bec..3b4d3ec30 100644 --- a/necsim/impls/no-std/src/cogs/active_lineage_sampler/alias/sampler/mod.rs +++ b/necsim/impls/no-std/src/cogs/active_lineage_sampler/alias/sampler/mod.rs @@ -15,12 +15,11 @@ struct PositiveF64Decomposed { fn decompose_weight(weight: PositiveF64) -> PositiveF64Decomposed { let bits = weight.get().to_bits(); - #[allow(clippy::cast_possible_truncation)] let mut exponent: i16 = ((bits >> 52) & 0x7ff_u64) as i16; let mantissa = if exponent == 0 { // Ensure that subnormal floats are presented internally as if they were normal - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_possible_truncation)] let subnormal_exponent = (bits.leading_zeros() as i16) - 12; exponent -= subnormal_exponent; @@ -37,7 +36,7 @@ fn decompose_weight(weight: PositiveF64) -> PositiveF64Decomposed { } } -#[allow(clippy::cast_possible_truncation, clippy::cast_sign_loss)] +#[expect(clippy::cast_possible_truncation, clippy::cast_sign_loss)] fn compose_weight(mut exponent: i16, mut mantissa: u128) -> NonNegativeF64 { if mantissa == 0 { return NonNegativeF64::zero(); @@ -63,7 +62,7 @@ fn compose_weight(mut exponent: i16, mut mantissa: u128) -> NonNegativeF64 { let mantissa_u64 = ((mantissa >> (excess_exponent - 1022 - exponent)) & 0x000f_ffff_ffff_ffff_u128) as u64; - #[allow(clippy::let_and_return)] + #[allow(clippy::let_and_return)] // FIXME: use expect { mantissa_u64 } diff --git a/necsim/impls/no-std/src/cogs/active_lineage_sampler/alias/sampler/stack/mod.rs b/necsim/impls/no-std/src/cogs/active_lineage_sampler/alias/sampler/stack/mod.rs index 63ae4c224..8aaf42144 100644 --- a/necsim/impls/no-std/src/cogs/active_lineage_sampler/alias/sampler/stack/mod.rs +++ b/necsim/impls/no-std/src/cogs/active_lineage_sampler/alias/sampler/stack/mod.rs @@ -19,7 +19,6 @@ struct RejectionSamplingGroup { total_weight: u128, } -#[allow(clippy::module_name_repetitions)] pub struct DynamicAliasMethodStackSampler { exponents: Vec, groups: Vec>, diff --git a/necsim/impls/no-std/src/cogs/active_lineage_sampler/alias/sampler/stack/tests.rs b/necsim/impls/no-std/src/cogs/active_lineage_sampler/alias/sampler/stack/tests.rs index 9bc1b6017..c3ca4e807 100644 --- a/necsim/impls/no-std/src/cogs/active_lineage_sampler/alias/sampler/stack/tests.rs +++ b/necsim/impls/no-std/src/cogs/active_lineage_sampler/alias/sampler/stack/tests.rs @@ -109,7 +109,7 @@ fn sample_single_group() { tally[sample as usize] += 1; } - #[allow(clippy::cast_precision_loss)] + #[expect(clippy::cast_precision_loss)] for (i, c) in tally.iter().enumerate() { let target = (((6 + i) as f64) / 51.0_f64) * 1000.0; let measure = ((*c as f64) / (N as f64)) * 1000.0; @@ -170,7 +170,7 @@ fn singular_event_group_full() { } #[test] -#[allow(clippy::too_many_lines)] +#[expect(clippy::too_many_lines)] fn add_remove_event_full() { let mut sampler = DynamicAliasMethodStackSampler::default(); assert_eq!(sampler.total_weight(), NonNegativeF64::zero()); @@ -432,7 +432,7 @@ fn sample_single_group_full() { tally[sample as usize] += 1; } - #[allow(clippy::cast_precision_loss)] + #[expect(clippy::cast_precision_loss)] for (i, c) in tally.iter().enumerate() { let target = (((6 + i) as f64) / 51.0_f64) * 1000.0; let measure = ((*c as f64) / (N as f64)) * 1000.0; @@ -478,7 +478,7 @@ fn sample_three_groups_full() { tally[sample as usize - 1] += 1; } - #[allow(clippy::cast_precision_loss)] + #[expect(clippy::cast_precision_loss)] for (i, c) in tally.iter().enumerate() { let target = (((i + 1) as f64) / 21.0_f64) * 1000.0; let measure = ((*c as f64) / (N as f64)) * 1000.0; @@ -520,7 +520,7 @@ fn sample_three_groups_full_reverse() { tally[sample as usize - 1] += 1; } - #[allow(clippy::cast_precision_loss)] + #[expect(clippy::cast_precision_loss)] for (i, c) in tally.iter().enumerate() { let target = (((i + 1) as f64) / 21.0_f64) * 1000.0; let measure = ((*c as f64) / (N as f64)) * 1000.0; @@ -576,7 +576,7 @@ impl DummyRng { fn new(mut vec: Vec) -> Self { vec.reverse(); - #[allow(clippy::cast_possible_truncation, clippy::cast_sign_loss)] + #[expect(clippy::cast_possible_truncation, clippy::cast_sign_loss)] Self( vec.into_iter() .map(|u01| ((u01 / f64::from_bits(0x3CA0_0000_0000_0000_u64)) as u64) << 11) diff --git a/necsim/impls/no-std/src/cogs/active_lineage_sampler/classical/mod.rs b/necsim/impls/no-std/src/cogs/active_lineage_sampler/classical/mod.rs index 2bd683d45..377e4703d 100644 --- a/necsim/impls/no-std/src/cogs/active_lineage_sampler/classical/mod.rs +++ b/necsim/impls/no-std/src/cogs/active_lineage_sampler/classical/mod.rs @@ -14,7 +14,7 @@ use crate::cogs::{ mod sampler; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug)] pub struct ClassicalActiveLineageSampler< M: MathsCore, @@ -28,7 +28,7 @@ pub struct ClassicalActiveLineageSampler< > { active_lineage_references: Vec, last_event_time: NonNegativeF64, - #[allow(clippy::type_complexity)] + #[expect(clippy::type_complexity)] _marker: PhantomData<(M, H, G, S, X, D, N, I)>, } @@ -64,7 +64,7 @@ impl< where H: 'h, { - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_possible_truncation)] let capacity = origin_sampler.full_upper_bound_size_hint() as usize; let mut lineage_store = S::with_capacity(origin_sampler.habitat(), capacity); diff --git a/necsim/impls/no-std/src/cogs/active_lineage_sampler/independent/event_time_sampler/const.rs b/necsim/impls/no-std/src/cogs/active_lineage_sampler/independent/event_time_sampler/const.rs index 598721483..6c8f77076 100644 --- a/necsim/impls/no-std/src/cogs/active_lineage_sampler/independent/event_time_sampler/const.rs +++ b/necsim/impls/no-std/src/cogs/active_lineage_sampler/independent/event_time_sampler/const.rs @@ -6,7 +6,7 @@ use necsim_core_bond::{NonNegativeF64, PositiveF64}; use super::EventTimeSampler; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Clone, Debug)] #[cfg_attr(feature = "cuda", derive(rust_cuda::lend::LendRustToCuda))] pub struct ConstEventTimeSampler { diff --git a/necsim/impls/no-std/src/cogs/active_lineage_sampler/independent/event_time_sampler/exp.rs b/necsim/impls/no-std/src/cogs/active_lineage_sampler/independent/event_time_sampler/exp.rs index 9e7b1207e..974cbf996 100644 --- a/necsim/impls/no-std/src/cogs/active_lineage_sampler/independent/event_time_sampler/exp.rs +++ b/necsim/impls/no-std/src/cogs/active_lineage_sampler/independent/event_time_sampler/exp.rs @@ -9,7 +9,7 @@ use super::EventTimeSampler; // 2^64 / PHI const INV_PHI: u64 = 0x9e37_79b9_7f4a_7c15_u64; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Clone, Debug)] #[cfg_attr(feature = "cuda", derive(rust_cuda::lend::LendRustToCuda))] pub struct ExpEventTimeSampler { @@ -48,13 +48,12 @@ impl, G: PrimeableRng, T: TurnoverRate> ) }; - #[allow(clippy::cast_possible_truncation, clippy::cast_sign_loss)] + #[expect(clippy::cast_possible_truncation, clippy::cast_sign_loss)] let mut time_step = M::floor(time.get() / self.delta_t.get()) as u64; let mut event_time = NonNegativeF64::from(time_step) * self.delta_t; let mut time_slice_end = NonNegativeF64::from(time_step + 1) * self.delta_t; - #[allow(clippy::cast_possible_truncation, clippy::cast_sign_loss)] rng.prime_with_habitat(habitat, indexed_location, time_step); let mut sub_index: u64 = 0; diff --git a/necsim/impls/no-std/src/cogs/active_lineage_sampler/independent/event_time_sampler/fixed.rs b/necsim/impls/no-std/src/cogs/active_lineage_sampler/independent/event_time_sampler/fixed.rs index c6ac3227d..4de7ee7b9 100644 --- a/necsim/impls/no-std/src/cogs/active_lineage_sampler/independent/event_time_sampler/fixed.rs +++ b/necsim/impls/no-std/src/cogs/active_lineage_sampler/independent/event_time_sampler/fixed.rs @@ -6,7 +6,7 @@ use necsim_core_bond::NonNegativeF64; use super::EventTimeSampler; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Clone, Debug, Default)] #[cfg_attr(feature = "cuda", derive(rust_cuda::lend::LendRustToCuda))] pub struct FixedEventTimeSampler([u8; 0]); @@ -27,8 +27,8 @@ impl, G: PrimeableRng, T: TurnoverRate> let lambda = turnover_rate.get_turnover_rate_at_location(indexed_location.location(), habitat); - #[allow(clippy::cast_possible_truncation)] - #[allow(clippy::cast_sign_loss)] + #[expect(clippy::cast_possible_truncation)] + #[expect(clippy::cast_sign_loss)] let time_step = M::floor(time.get() * lambda.get()) as u64 + 1; rng.prime_with_habitat(habitat, indexed_location, time_step); diff --git a/necsim/impls/no-std/src/cogs/active_lineage_sampler/independent/event_time_sampler/geometric.rs b/necsim/impls/no-std/src/cogs/active_lineage_sampler/independent/event_time_sampler/geometric.rs index 476685396..aac6ad40b 100644 --- a/necsim/impls/no-std/src/cogs/active_lineage_sampler/independent/event_time_sampler/geometric.rs +++ b/necsim/impls/no-std/src/cogs/active_lineage_sampler/independent/event_time_sampler/geometric.rs @@ -6,7 +6,7 @@ use necsim_core_bond::{NonNegativeF64, PositiveF64}; use super::EventTimeSampler; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Clone, Debug)] #[cfg_attr(feature = "cuda", derive(rust_cuda::lend::LendRustToCuda))] pub struct GeometricEventTimeSampler { @@ -39,8 +39,8 @@ impl, G: PrimeableRng, T: TurnoverRate> .neg_exp::() .one_minus(); - #[allow(clippy::cast_possible_truncation)] - #[allow(clippy::cast_sign_loss)] + #[expect(clippy::cast_possible_truncation)] + #[expect(clippy::cast_sign_loss)] let mut time_step = M::floor(time.get() / self.delta_t.get()) as u64 + 1; loop { diff --git a/necsim/impls/no-std/src/cogs/active_lineage_sampler/independent/event_time_sampler/mod.rs b/necsim/impls/no-std/src/cogs/active_lineage_sampler/independent/event_time_sampler/mod.rs index 19c8f2e58..79fefb88f 100644 --- a/necsim/impls/no-std/src/cogs/active_lineage_sampler/independent/event_time_sampler/mod.rs +++ b/necsim/impls/no-std/src/cogs/active_lineage_sampler/independent/event_time_sampler/mod.rs @@ -10,8 +10,6 @@ pub mod fixed; pub mod geometric; pub mod poisson; -#[allow(clippy::module_name_repetitions)] -#[allow(clippy::inline_always, clippy::inline_fn_without_body)] #[contract_trait] pub trait EventTimeSampler, G: PrimeableRng, T: TurnoverRate>: Clone + core::fmt::Debug diff --git a/necsim/impls/no-std/src/cogs/active_lineage_sampler/independent/event_time_sampler/poisson.rs b/necsim/impls/no-std/src/cogs/active_lineage_sampler/independent/event_time_sampler/poisson.rs index db7a42683..0a9591253 100644 --- a/necsim/impls/no-std/src/cogs/active_lineage_sampler/independent/event_time_sampler/poisson.rs +++ b/necsim/impls/no-std/src/cogs/active_lineage_sampler/independent/event_time_sampler/poisson.rs @@ -9,7 +9,7 @@ use super::EventTimeSampler; // 2^64 / PHI const INV_PHI: u64 = 0x9e37_79b9_7f4a_7c15_u64; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Clone, Debug)] #[cfg_attr(feature = "cuda", derive(rust_cuda::lend::LendRustToCuda))] pub struct PoissonEventTimeSampler { @@ -41,8 +41,8 @@ impl, G: PrimeableRng, T: TurnoverRate> let lambda_per_step = lambda * self.delta_t; let no_event_probability_per_step = M::exp(-lambda_per_step.get()); - #[allow(clippy::cast_possible_truncation)] - #[allow(clippy::cast_sign_loss)] + #[expect(clippy::cast_possible_truncation)] + #[expect(clippy::cast_sign_loss)] let mut time_step = M::floor(time.get() / self.delta_t.get()) as u64; let (event_time, event_index) = loop { @@ -65,7 +65,7 @@ impl, G: PrimeableRng, T: TurnoverRate> poisson } else { // Fallback in case no_event_probability_per_step underflows - #[allow(clippy::cast_possible_truncation, clippy::cast_sign_loss)] + #[expect(clippy::cast_possible_truncation, clippy::cast_sign_loss)] let normal_as_poisson = rng .sample_2d_normal(lambda_per_step.get(), lambda_per_step.sqrt::()) .0 @@ -77,7 +77,6 @@ impl, G: PrimeableRng, T: TurnoverRate> let mut next_event = None; for event_index in 0..number_events_at_time_steps { - #[allow(clippy::cast_precision_loss)] let event_time = (NonNegativeF64::from(time_step) + NonNegativeF64::from(rng.sample_uniform_closed_open())) * self.delta_t; diff --git a/necsim/impls/no-std/src/cogs/active_lineage_sampler/independent/mod.rs b/necsim/impls/no-std/src/cogs/active_lineage_sampler/independent/mod.rs index eb5243a48..a64711352 100644 --- a/necsim/impls/no-std/src/cogs/active_lineage_sampler/independent/mod.rs +++ b/necsim/impls/no-std/src/cogs/active_lineage_sampler/independent/mod.rs @@ -23,7 +23,7 @@ pub mod event_time_sampler; use event_time_sampler::EventTimeSampler; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug)] #[cfg_attr(feature = "cuda", derive(rust_cuda::lend::LendRustToCuda))] #[cfg_attr(feature = "cuda", cuda(free = "M"))] @@ -89,7 +89,7 @@ impl< where H: 'h, { - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_possible_truncation)] let capacity = origin_sampler.full_upper_bound_size_hint() as usize; let mut lineages = Vec::with_capacity(capacity); diff --git a/necsim/impls/no-std/src/cogs/active_lineage_sampler/resuming/lineage.rs b/necsim/impls/no-std/src/cogs/active_lineage_sampler/resuming/lineage.rs index 22c52579e..c6dd947e6 100644 --- a/necsim/impls/no-std/src/cogs/active_lineage_sampler/resuming/lineage.rs +++ b/necsim/impls/no-std/src/cogs/active_lineage_sampler/resuming/lineage.rs @@ -2,7 +2,7 @@ use alloc::vec::Vec; use necsim_core::lineage::{GlobalLineageReference, Lineage}; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug)] pub enum ExceptionalLineage { Coalescence { diff --git a/necsim/impls/no-std/src/cogs/active_lineage_sampler/resuming/mod.rs b/necsim/impls/no-std/src/cogs/active_lineage_sampler/resuming/mod.rs index 2489c5f62..0c7444704 100644 --- a/necsim/impls/no-std/src/cogs/active_lineage_sampler/resuming/mod.rs +++ b/necsim/impls/no-std/src/cogs/active_lineage_sampler/resuming/mod.rs @@ -33,7 +33,7 @@ pub struct RestartFixUpActiveLineageSampler< inner: A, restart_time: PositiveF64, fixable_lineages: Vec, - #[allow(clippy::type_complexity)] + #[expect(clippy::type_complexity)] _marker: PhantomData<(M, H, G, S, X, D, C, T, N, E, I)>, } diff --git a/necsim/impls/no-std/src/cogs/active_lineage_sampler/resuming/sampler.rs b/necsim/impls/no-std/src/cogs/active_lineage_sampler/resuming/sampler.rs index 4520f67e6..323ecd5ce 100644 --- a/necsim/impls/no-std/src/cogs/active_lineage_sampler/resuming/sampler.rs +++ b/necsim/impls/no-std/src/cogs/active_lineage_sampler/resuming/sampler.rs @@ -48,8 +48,11 @@ impl< habitat: &'a H, lineage_store: &'a S, ) -> Self::LineageIterator<'a> { - // All pre- and post-conditions are maintained - self.__contracts_impl_iter_active_lineages_ordered(habitat, lineage_store) + // Note: inlined from __contracts_impl_iter_active_lineages_ordered + self.fixable_lineages.iter().chain( + self.inner + .iter_active_lineages_ordered(habitat, lineage_store), + ) } #[must_use] @@ -133,7 +136,6 @@ impl< Some((fixable_lineage, self.restart_time)) } - #[allow(clippy::no_effect_underscore_binding)] #[debug_ensures( self.number_active_lineages() == old(self.number_active_lineages()) + 1, "adds an active lineage" diff --git a/necsim/impls/no-std/src/cogs/active_lineage_sampler/singular.rs b/necsim/impls/no-std/src/cogs/active_lineage_sampler/singular.rs index f595c9808..2f9a52c24 100644 --- a/necsim/impls/no-std/src/cogs/active_lineage_sampler/singular.rs +++ b/necsim/impls/no-std/src/cogs/active_lineage_sampler/singular.rs @@ -7,7 +7,7 @@ use necsim_core::{ lineage::Lineage, }; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub trait SingularActiveLineageSampler< M: MathsCore, H: Habitat, diff --git a/necsim/impls/no-std/src/cogs/coalescence_sampler/conditional.rs b/necsim/impls/no-std/src/cogs/coalescence_sampler/conditional.rs index e1109422a..e19b03967 100644 --- a/necsim/impls/no-std/src/cogs/coalescence_sampler/conditional.rs +++ b/necsim/impls/no-std/src/cogs/coalescence_sampler/conditional.rs @@ -12,7 +12,7 @@ use necsim_core_bond::ClosedUnitF64; use super::optional_coalescence; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug)] pub struct ConditionalCoalescenceSampler< M: MathsCore, @@ -62,7 +62,6 @@ impl, S: GloballyCoherentLineageStore> ConditionalCoalescenceSampler { #[must_use] - #[allow(clippy::unused_self)] pub fn sample_coalescence_at_location( &self, location: Location, @@ -73,7 +72,7 @@ impl, S: GloballyCoherentLineageStore> let lineages_at_location = lineage_store.get_local_lineage_references_at_location_unordered(&location, habitat); - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_possible_truncation)] let population = lineages_at_location.len() as u32; let chosen_coalescence_index = @@ -89,7 +88,6 @@ impl, S: GloballyCoherentLineageStore> #[must_use] #[debug_requires(habitat.get_habitat_at_location(location) > 0, "location is habitable")] - #[allow(clippy::unused_self)] pub fn get_coalescence_probability_at_location( &self, location: &Location, @@ -100,7 +98,7 @@ impl, S: GloballyCoherentLineageStore> // If the lineage store includes self, the population must be decremented // to avoid coalescence with the currently active lineage - #[allow(clippy::cast_precision_loss)] + #[expect(clippy::cast_precision_loss)] let population = (lineage_store .get_local_lineage_references_at_location_unordered(location, habitat) .len() diff --git a/necsim/impls/no-std/src/cogs/coalescence_sampler/independent.rs b/necsim/impls/no-std/src/cogs/coalescence_sampler/independent.rs index 3c417d07f..6d81be089 100644 --- a/necsim/impls/no-std/src/cogs/coalescence_sampler/independent.rs +++ b/necsim/impls/no-std/src/cogs/coalescence_sampler/independent.rs @@ -11,7 +11,7 @@ use crate::cogs::lineage_store::{ independent::IndependentLineageStore, }; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug)] #[cfg_attr(feature = "cuda", derive(rust_cuda::lend::LendRustToCuda))] #[cfg_attr(feature = "cuda", cuda(free = "M", free = "H"))] diff --git a/necsim/impls/no-std/src/cogs/coalescence_sampler/unconditional.rs b/necsim/impls/no-std/src/cogs/coalescence_sampler/unconditional.rs index f7a17bc6a..d77c59159 100644 --- a/necsim/impls/no-std/src/cogs/coalescence_sampler/unconditional.rs +++ b/necsim/impls/no-std/src/cogs/coalescence_sampler/unconditional.rs @@ -11,7 +11,7 @@ use necsim_core::{ use super::optional_coalescence; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug)] pub struct UnconditionalCoalescenceSampler< M: MathsCore, diff --git a/necsim/impls/no-std/src/cogs/dispersal_sampler/almost_infinite_clark2dt.rs b/necsim/impls/no-std/src/cogs/dispersal_sampler/almost_infinite/clark2dt.rs similarity index 98% rename from necsim/impls/no-std/src/cogs/dispersal_sampler/almost_infinite_clark2dt.rs rename to necsim/impls/no-std/src/cogs/dispersal_sampler/almost_infinite/clark2dt.rs index 7858b7a1a..f5d4cd8d8 100644 --- a/necsim/impls/no-std/src/cogs/dispersal_sampler/almost_infinite_clark2dt.rs +++ b/necsim/impls/no-std/src/cogs/dispersal_sampler/almost_infinite/clark2dt.rs @@ -8,7 +8,6 @@ use necsim_core_bond::{ClosedUnitF64, NonNegativeF64, PositiveF64}; use crate::cogs::habitat::almost_infinite::AlmostInfiniteHabitat; -#[allow(clippy::module_name_repetitions)] #[derive(Debug)] #[cfg_attr(feature = "cuda", derive(rust_cuda::lend::LendRustToCuda))] #[cfg_attr(feature = "cuda", cuda(free = "M", free = "G"))] @@ -26,7 +25,7 @@ impl> AlmostInfiniteClark2DtDispersalSampler { // For now, we numerically integrate the self-dispersal probability // using polar coordinates - #[allow(clippy::useless_conversion)] // prepare for new range iterators + #[expect(clippy::useless_conversion)] // prepare for new range iterators let self_dispersal = (0..N) .into_iter() .map(|i| { @@ -132,7 +131,7 @@ impl> SeparableDispersalSampler(x: f64, exp: f64) -> f64 { - #[allow(clippy::float_cmp)] + #[expect(clippy::float_cmp)] if exp == 1.0 { return x; } @@ -263,7 +262,7 @@ mod tests { } #[test] - #[allow(clippy::too_many_lines)] + #[expect(clippy::too_many_lines)] fn test_cdf() { assert_eq_bits!( cdf::( @@ -559,7 +558,7 @@ mod tests { } #[test] - #[allow(clippy::too_many_lines)] + #[expect(clippy::too_many_lines)] fn test_cdf_inverse() { assert_eq_bits!( cdf_inverse::( diff --git a/necsim/impls/no-std/src/cogs/dispersal_sampler/almost_infinite/downscaled.rs b/necsim/impls/no-std/src/cogs/dispersal_sampler/almost_infinite/downscaled.rs new file mode 100644 index 000000000..ba2ae7aaa --- /dev/null +++ b/necsim/impls/no-std/src/cogs/dispersal_sampler/almost_infinite/downscaled.rs @@ -0,0 +1,263 @@ +use core::{marker::PhantomData, num::NonZeroU32}; + +use alloc::{sync::Arc, vec::Vec}; +use hashbrown::HashMap; +use necsim_core::{ + cogs::{DispersalSampler, MathsCore, RngCore, RngSampler, SeparableDispersalSampler}, + landscape::Location, +}; +use necsim_core_bond::{ClosedUnitF64, NonNegativeF64}; + +use crate::{ + alias::packed::AliasMethodSamplerAtom, + cogs::habitat::almost_infinite::{ + downscaled::AlmostInfiniteDownscaledHabitat, AlmostInfiniteHabitat, + }, +}; + +#[derive(Debug)] +#[cfg_attr(feature = "cuda", derive(rust_cuda::lend::LendRustToCuda))] +#[cfg_attr(feature = "cuda", cuda(free = "M", free = "G"))] +pub struct AlmostInfiniteDownscaledDispersalSampler< + M: MathsCore, + G: RngCore, + D: Clone + DispersalSampler, G>, +> { + #[cfg_attr(feature = "cuda", cuda(embed))] + dispersal: D, + self_dispersal: ClosedUnitF64, + #[cfg_attr(feature = "cuda", cuda(embed))] + non_self_dispersal: Option]>>, + marker: PhantomData<(M, G)>, +} + +#[doc(hidden)] +#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, TypeLayout)] +#[repr(C)] +pub struct DispersalOffset { + x: u32, + y: u32, +} + +#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] +pub enum NonSelfDispersal { + #[serde(alias = "Accurate", alias = "RejectionSampling")] + AccurateRejectionSampling, + #[serde(alias = "UnlikelyApproximation")] + RejectionSamplingOrPrecomputeApproximation { + #[serde(alias = "likelihood")] + non_self_dispersal_rejection_sampling_probability_threshold: ClosedUnitF64, + }, + #[serde( + alias = "Approximate", + alias = "Precompute", + alias = "PrecomputeApproximation" + )] + PrecomputeApproximationIfNoRejection, +} + +impl NonSelfDispersal { + #[must_use] + pub const fn non_self_dispersal_rejection_sampling_probability_threshold( + self, + ) -> ClosedUnitF64 { + match self { + Self::AccurateRejectionSampling => ClosedUnitF64::zero(), + Self::RejectionSamplingOrPrecomputeApproximation { + non_self_dispersal_rejection_sampling_probability_threshold, + } => non_self_dispersal_rejection_sampling_probability_threshold, + Self::PrecomputeApproximationIfNoRejection => ClosedUnitF64::one(), + } + } +} + +impl, D: Clone + DispersalSampler, G>> + AlmostInfiniteDownscaledDispersalSampler +{ + #[must_use] + pub fn new( + habitat: &AlmostInfiniteDownscaledHabitat, + dispersal: D, + samples: NonZeroU32, + non_self_dispersal: NonSelfDispersal, + ) -> Self { + use necsim_core::cogs::SeedableRng; + + let dispersal = Self { + dispersal, + // since the dispersal sampler doesn't need to know its self-dispersal + // and non-self-dispersal to perform non-separable dispersal, we can + // set it to zero here + self_dispersal: ClosedUnitF64::zero(), + non_self_dispersal: None, + marker: PhantomData::<(M, G)>, + }; + + let origin = Location::new(0, 0); + let mut rng = G::seed_from_u64(42); + + let mut targets = HashMap::new(); + + // TODO: optimise + for _ in 0..samples.get() { + let target = dispersal.sample_dispersal_from_location(&origin, habitat, &mut rng); + + *targets.entry(target).or_insert(0_u32) += 1; + } + + let self_dispersal_count = targets.get(&origin).copied().unwrap_or(0); + let self_dispersal_emperical = f64::from(self_dispersal_count) / f64::from(samples.get()); + // Safety: the fraction of 0 >= counter <= N and N must be in [0.0; 1.0] + // Note: we still clamp to account for rounding errors + let self_dispersal_emperical = + unsafe { ClosedUnitF64::new_unchecked(self_dispersal_emperical.clamp(0.0, 1.0)) }; + + let non_self_dispersal = if self_dispersal_emperical.one_minus() + >= non_self_dispersal.non_self_dispersal_rejection_sampling_probability_threshold() + { + // if the non-self-dispersal probability is larger (or equal) than the + // threshold, use rejection sampling for non-self-dispersal + // if the threshold is 1.0, we still favour rejection sampling if the + // non-self-dispersal probability is also 1.0 + // if the threshold is 0.0, we always use rejection sampling + log::info!( + "Rejection sampling is used for separate non-self-dispersal, which has a \ + probability of {:.3}%", + self_dispersal_emperical.one_minus().get() * 100.0 + ); + + None + } else { + // if the non-self-dispersal probability is smaller than the threshold, + // precompute a discrete alias sampler for non-self-dispersal + log::info!( + "A precomputed alias sampler is used for separate non-self-dispersal, which has a \ + probability of {:.3}%", + self_dispersal_emperical.one_minus().get() * 100.0 + ); + + let mut non_self_dispersal = targets + .into_iter() + .filter_map(|(target, count)| { + if target == origin { + None + } else { + Some(( + DispersalOffset { + x: target.x(), + y: target.y(), + }, + NonNegativeF64::from(count), + )) + } + }) + .collect::>(); + // sort to ensure reproducible construction of the non-self-dispersal alias + // sampler + non_self_dispersal.sort_unstable(); + + let non_self_dispersal = AliasMethodSamplerAtom::create(&non_self_dispersal); + Some(Arc::from(non_self_dispersal)) + }; + + Self { + dispersal: dispersal.dispersal, + self_dispersal: self_dispersal_emperical, + non_self_dispersal, + marker: PhantomData::<(M, G)>, + } + } +} + +impl, D: Clone + DispersalSampler, G>> Clone + for AlmostInfiniteDownscaledDispersalSampler +{ + fn clone(&self) -> Self { + Self { + dispersal: self.dispersal.clone(), + self_dispersal: self.self_dispersal, + non_self_dispersal: self.non_self_dispersal.clone(), + marker: PhantomData::<(M, G)>, + } + } +} + +#[contract_trait] +impl, D: Clone + DispersalSampler, G>> + DispersalSampler, G> + for AlmostInfiniteDownscaledDispersalSampler +{ + #[must_use] + fn sample_dispersal_from_location( + &self, + location: &Location, + habitat: &AlmostInfiniteDownscaledHabitat, + rng: &mut G, + ) -> Location { + // TODO: optimise + let sub_index = rng.sample_index_u32(habitat.downscale_area()); + + let index_x = sub_index % (habitat.downscale_x() as u32); + let index_y = sub_index % (habitat.downscale_y() as u32); + + // generate an upscaled location by sampling a random sub-location + let location = Location::new(location.x() + index_x, location.y() + index_y); + + // sample dispersal from the inner dispersal sampler as normal + let target_location = + self.dispersal + .sample_dispersal_from_location(&location, habitat.unscaled(), rng); + + let index_x = target_location.x() % (habitat.downscale_x() as u32); + let index_y = target_location.y() % (habitat.downscale_y() as u32); + + // downscale the target location + Location::new(target_location.x() - index_x, target_location.y() - index_y) + } +} + +#[contract_trait] +impl, D: Clone + DispersalSampler, G>> + SeparableDispersalSampler, G> + for AlmostInfiniteDownscaledDispersalSampler +{ + #[must_use] + fn sample_non_self_dispersal_from_location( + &self, + location: &Location, + habitat: &AlmostInfiniteDownscaledHabitat, + rng: &mut G, + ) -> Location { + // use the precomputed non-self-dispersal alias sampler if it is available + if let Some(non_self_dispersal) = &self.non_self_dispersal { + // TODO: improve accuracy + let DispersalOffset { + x: offset_x, + y: offset_y, + } = AliasMethodSamplerAtom::sample_event(non_self_dispersal, rng); + + return Location::new( + location.x().wrapping_add(offset_x), + location.y().wrapping_add(offset_y), + ); + } + + // fall back to using rejection sampling + let mut target_location = self.sample_dispersal_from_location(location, habitat, rng); + + while &target_location == location { + target_location = self.sample_dispersal_from_location(location, habitat, rng); + } + + target_location + } + + #[must_use] + fn get_self_dispersal_probability_at_location( + &self, + _location: &Location, + _habitat: &AlmostInfiniteDownscaledHabitat, + ) -> ClosedUnitF64 { + self.self_dispersal + } +} diff --git a/necsim/impls/no-std/src/cogs/dispersal_sampler/almost_infinite/mod.rs b/necsim/impls/no-std/src/cogs/dispersal_sampler/almost_infinite/mod.rs new file mode 100644 index 000000000..d7442600e --- /dev/null +++ b/necsim/impls/no-std/src/cogs/dispersal_sampler/almost_infinite/mod.rs @@ -0,0 +1,3 @@ +pub mod clark2dt; +pub mod downscaled; +pub mod normal; diff --git a/necsim/impls/no-std/src/cogs/dispersal_sampler/almost_infinite_normal.rs b/necsim/impls/no-std/src/cogs/dispersal_sampler/almost_infinite/normal.rs similarity index 98% rename from necsim/impls/no-std/src/cogs/dispersal_sampler/almost_infinite_normal.rs rename to necsim/impls/no-std/src/cogs/dispersal_sampler/almost_infinite/normal.rs index ecd9fb2d0..78c23f119 100644 --- a/necsim/impls/no-std/src/cogs/dispersal_sampler/almost_infinite_normal.rs +++ b/necsim/impls/no-std/src/cogs/dispersal_sampler/almost_infinite/normal.rs @@ -8,7 +8,6 @@ use necsim_core_bond::{ClosedUnitF64, NonNegativeF64}; use crate::cogs::habitat::almost_infinite::AlmostInfiniteHabitat; -#[allow(clippy::module_name_repetitions)] #[derive(Debug)] #[cfg_attr(feature = "cuda", derive(rust_cuda::lend::LendRustToCuda))] #[cfg_attr(feature = "cuda", cuda(free = "M", free = "G"))] diff --git a/necsim/impls/no-std/src/cogs/dispersal_sampler/in_memory/alias/dispersal.rs b/necsim/impls/no-std/src/cogs/dispersal_sampler/in_memory/alias/dispersal.rs index 6977cdb69..853ef37ec 100644 --- a/necsim/impls/no-std/src/cogs/dispersal_sampler/in_memory/alias/dispersal.rs +++ b/necsim/impls/no-std/src/cogs/dispersal_sampler/in_memory/alias/dispersal.rs @@ -25,7 +25,7 @@ impl, G: RngCore> DispersalSampler let dispersal_target_index = alias_dispersal_at_location.sample_event(rng); - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_possible_truncation)] Location::new( habitat.get_extent().origin().x().wrapping_add( (dispersal_target_index % usize::from(habitat.get_extent().width())) as u32, diff --git a/necsim/impls/no-std/src/cogs/dispersal_sampler/in_memory/alias/mod.rs b/necsim/impls/no-std/src/cogs/dispersal_sampler/in_memory/alias/mod.rs index 513bbe6ea..55ed23d53 100644 --- a/necsim/impls/no-std/src/cogs/dispersal_sampler/in_memory/alias/mod.rs +++ b/necsim/impls/no-std/src/cogs/dispersal_sampler/in_memory/alias/mod.rs @@ -18,7 +18,6 @@ use super::{contract::check_in_memory_dispersal_contract, InMemoryDispersalSampl mod dispersal; -#[allow(clippy::module_name_repetitions)] #[derive(Debug)] pub struct InMemoryAliasDispersalSampler, G: RngCore> { alias_dispersal: ArcArray2D>>, @@ -44,7 +43,7 @@ impl, G: RngCore> InMemoryDispersalSampler>( dispersal: &Array2D, habitat: &H, @@ -25,7 +25,7 @@ pub fn check_in_memory_dispersal_contract>( let habitat_width = habitat_extent.width(); for row_index in 0..dispersal.num_rows() { - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_possible_truncation)] let dispersal_origin = Location::new( (row_index % usize::from(habitat_width)) as u32, (row_index / usize::from(habitat_width)) as u32, @@ -35,7 +35,7 @@ pub fn check_in_memory_dispersal_contract>( let mut any_dispersal = false; for col_index in 0..dispersal.num_columns() { - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_possible_truncation)] let dispersal_target = Location::new( (col_index % usize::from(habitat_width)) as u32, (col_index / usize::from(habitat_width)) as u32, diff --git a/necsim/impls/no-std/src/cogs/dispersal_sampler/in_memory/cumulative/contract.rs b/necsim/impls/no-std/src/cogs/dispersal_sampler/in_memory/cumulative/contract.rs index d2fcdf2de..cf025e2c4 100644 --- a/necsim/impls/no-std/src/cogs/dispersal_sampler/in_memory/cumulative/contract.rs +++ b/necsim/impls/no-std/src/cogs/dispersal_sampler/in_memory/cumulative/contract.rs @@ -10,7 +10,7 @@ impl, G: RngCore> InMemoryCumulativeDispersalSamp let habitat_width = habitat.get_extent().width(); for target_index in self.valid_dispersal_targets.iter().filter_map(|x| *x) { - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_possible_truncation)] let dispersal_target = Location::new( (target_index % usize::from(habitat_width)) as u32, (target_index / usize::from(habitat_width)) as u32, diff --git a/necsim/impls/no-std/src/cogs/dispersal_sampler/in_memory/cumulative/dispersal.rs b/necsim/impls/no-std/src/cogs/dispersal_sampler/in_memory/cumulative/dispersal.rs index 59103a7eb..efeecbc64 100644 --- a/necsim/impls/no-std/src/cogs/dispersal_sampler/in_memory/cumulative/dispersal.rs +++ b/necsim/impls/no-std/src/cogs/dispersal_sampler/in_memory/cumulative/dispersal.rs @@ -49,7 +49,7 @@ impl, G: RngCore> DispersalSampler unreachable!("habitat dispersal origin must disperse somewhere") }; - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_possible_truncation)] Location::new( habitat.get_extent().origin().x().wrapping_add( (valid_dispersal_target_index % usize::from(habitat.get_extent().width())) as u32, diff --git a/necsim/impls/no-std/src/cogs/dispersal_sampler/in_memory/cumulative/mod.rs b/necsim/impls/no-std/src/cogs/dispersal_sampler/in_memory/cumulative/mod.rs index 54d2e2ab2..a790da18b 100644 --- a/necsim/impls/no-std/src/cogs/dispersal_sampler/in_memory/cumulative/mod.rs +++ b/necsim/impls/no-std/src/cogs/dispersal_sampler/in_memory/cumulative/mod.rs @@ -15,7 +15,6 @@ use super::{contract::check_in_memory_dispersal_contract, InMemoryDispersalSampl mod contract; mod dispersal; -#[allow(clippy::module_name_repetitions)] #[derive(Debug)] pub struct InMemoryCumulativeDispersalSampler, G: RngCore> { cumulative_dispersal: Arc<[ClosedUnitF64]>, @@ -26,7 +25,6 @@ pub struct InMemoryCumulativeDispersalSampler, G: Rn impl, G: RngCore> InMemoryDispersalSampler for InMemoryCumulativeDispersalSampler { - #[allow(clippy::no_effect_underscore_binding)] #[debug_ensures(ret.as_ref().map_or(true, |ret| { ret.explicit_only_valid_targets_dispersal_contract(old(habitat)) }), "valid_dispersal_targets only allows dispersal to habitat")] @@ -46,7 +44,7 @@ impl, G: RngCore> InMemoryDispersalSampler, G: RngCore> InMemoryDispersalSampler = None; for col_index in 0..dispersal.num_columns() { - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_possible_truncation)] let location = Location::new( habitat_extent.origin().x().wrapping_add( diff --git a/necsim/impls/no-std/src/cogs/dispersal_sampler/in_memory/mod.rs b/necsim/impls/no-std/src/cogs/dispersal_sampler/in_memory/mod.rs index 333c4fd8b..86022dccf 100644 --- a/necsim/impls/no-std/src/cogs/dispersal_sampler/in_memory/mod.rs +++ b/necsim/impls/no-std/src/cogs/dispersal_sampler/in_memory/mod.rs @@ -13,7 +13,7 @@ pub mod packed_alias; pub mod packed_separable_alias; pub mod separable_alias; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub trait InMemoryDispersalSampler, G: RngCore>: DispersalSampler + Sized { @@ -40,7 +40,7 @@ pub trait InMemoryDispersalSampler, G: RngCore>: ) -> Result; } -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug, displaydoc::Display)] pub enum InMemoryDispersalSamplerError { /** The size of the dispersal map is inconsistent with the size of the diff --git a/necsim/impls/no-std/src/cogs/dispersal_sampler/in_memory/packed_alias/dispersal.rs b/necsim/impls/no-std/src/cogs/dispersal_sampler/in_memory/packed_alias/dispersal.rs index f8c3e0697..e8b74d353 100644 --- a/necsim/impls/no-std/src/cogs/dispersal_sampler/in_memory/packed_alias/dispersal.rs +++ b/necsim/impls/no-std/src/cogs/dispersal_sampler/in_memory/packed_alias/dispersal.rs @@ -40,7 +40,7 @@ impl, G: RngCore> DispersalSampler let dispersal_target_index: usize = AliasMethodSamplerAtom::sample_event(alias_dispersals_at_location, rng); - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_possible_truncation)] Location::new( habitat.get_extent().origin().x().wrapping_add( (dispersal_target_index % usize::from(habitat.get_extent().width())) as u32, diff --git a/necsim/impls/no-std/src/cogs/dispersal_sampler/in_memory/packed_alias/mod.rs b/necsim/impls/no-std/src/cogs/dispersal_sampler/in_memory/packed_alias/mod.rs index 814a4f096..bc9414404 100644 --- a/necsim/impls/no-std/src/cogs/dispersal_sampler/in_memory/packed_alias/mod.rs +++ b/necsim/impls/no-std/src/cogs/dispersal_sampler/in_memory/packed_alias/mod.rs @@ -20,7 +20,6 @@ use super::{ }; #[derive(Clone, Debug, TypeLayout)] -#[allow(clippy::module_name_repetitions)] #[doc(hidden)] #[repr(C)] pub struct AliasSamplerRange { @@ -43,7 +42,6 @@ impl From for Range { } } -#[allow(clippy::module_name_repetitions)] #[cfg_attr(feature = "cuda", derive(rust_cuda::lend::LendRustToCuda))] #[cfg_attr(feature = "cuda", cuda(free = "M", free = "H", free = "G"))] pub struct InMemoryPackedAliasDispersalSampler, G: RngCore> { @@ -75,7 +73,7 @@ impl, G: RngCore> InMemoryDispersalSampler, G: RngCore> DispersalSampler self_dispersal_index }; - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_possible_truncation)] Location::new( habitat.get_extent().origin().x().wrapping_add( (dispersal_target_index % usize::from(habitat.get_extent().width())) as u32, @@ -133,7 +133,7 @@ impl, G: RngCore> SeparableDispersalSampler, G: RngCore> @@ -60,7 +57,7 @@ pub struct InMemoryPackedSeparableAliasDispersalSampler, G: RngCore> InMemoryDispersalSampler for InMemoryPackedSeparableAliasDispersalSampler { - #[allow(clippy::too_many_lines)] + #[expect(clippy::too_many_lines)] fn new( dispersal: &Array2D, habitat: &H, @@ -92,7 +89,7 @@ impl, G: RngCore> InMemoryDispersalSampler, G: RngCore> SeparableDispersalSampler, G: RngCore> { alias_dispersal: ArcArray2D>>, @@ -53,7 +52,7 @@ impl, G: RngCore> InMemoryDispersalSampler> DispersalSampler, G> ) -> Location { use necsim_core::cogs::RngSampler; - let habitat_index_max = - habitat.get_extent().width().get() * habitat.get_extent().height().get(); + let dispersal_target_index = rng.sample_index_u64(habitat.get_extent().area()); - // Safety: habitat width and height are both > 0 - let dispersal_target_index = - rng.sample_index_u64(unsafe { NonZeroU64::new_unchecked(habitat_index_max) }); - - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_possible_truncation)] Location::new( habitat .get_extent() @@ -86,15 +81,15 @@ impl> SeparableDispersalSampler Location { use necsim_core::cogs::RngSampler; - let habitat_index_max = - habitat.get_extent().width().get() * habitat.get_extent().height().get(); + let habitat_index_max = habitat.get_extent().area(); let current_location_index = u64::from(location.y()) * habitat.get_extent().width().get() + u64::from(location.x()); let dispersal_target_index = { // Safety: by PRE, `habitat_index_max` > 1 - let dispersal_target_index = - rng.sample_index_u64(unsafe { NonZeroU64::new_unchecked(habitat_index_max - 1) }); + let dispersal_target_index = rng.sample_index_u64( + unsafe { NonZeroU64::new_unchecked(habitat_index_max.sub_one()) }.into(), + ); if dispersal_target_index >= current_location_index { dispersal_target_index + 1 @@ -103,7 +98,7 @@ impl> SeparableDispersalSampler, G: RngCore>: Backup + core::fmt::Debug @@ -26,7 +23,7 @@ pub trait AntiTrespassingDispersalSampler, G: RngCor ) -> Location; } -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug)] #[cfg_attr(feature = "cuda", derive(rust_cuda::lend::LendRustToCuda))] #[cfg_attr(feature = "cuda", cuda(free = "M"))] @@ -90,7 +87,6 @@ impl< { #[must_use] #[inline] - #[allow(clippy::no_effect_underscore_binding)] #[debug_ensures(old(habitat).is_location_habitable(&ret), "target is habitable")] fn sample_dispersal_from_location( &self, @@ -133,7 +129,6 @@ impl< { #[must_use] #[inline] - #[allow(clippy::no_effect_underscore_binding)] #[debug_ensures(old(habitat).is_location_habitable(&ret), "target is habitable")] #[debug_ensures(&ret != location, "disperses to a different location")] fn sample_non_self_dispersal_from_location( diff --git a/necsim/impls/no-std/src/cogs/dispersal_sampler/trespassing/uniform.rs b/necsim/impls/no-std/src/cogs/dispersal_sampler/trespassing/uniform.rs index 26bef8225..6ae1e1d76 100644 --- a/necsim/impls/no-std/src/cogs/dispersal_sampler/trespassing/uniform.rs +++ b/necsim/impls/no-std/src/cogs/dispersal_sampler/trespassing/uniform.rs @@ -7,7 +7,7 @@ use necsim_core::{ use super::AntiTrespassingDispersalSampler; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug)] #[cfg_attr(feature = "cuda", derive(rust_cuda::lend::LendRustToCuda))] #[cfg_attr(feature = "cuda", cuda(free = "M", free = "H", free = "G"))] diff --git a/necsim/impls/no-std/src/cogs/dispersal_sampler/wrapping_noise.rs b/necsim/impls/no-std/src/cogs/dispersal_sampler/wrapping_noise.rs index 54f83c872..c7dcba6a9 100644 --- a/necsim/impls/no-std/src/cogs/dispersal_sampler/wrapping_noise.rs +++ b/necsim/impls/no-std/src/cogs/dispersal_sampler/wrapping_noise.rs @@ -5,11 +5,11 @@ use necsim_core::{ use necsim_core_bond::{ClosedUnitF64, NonNegativeF64}; use crate::cogs::{ - dispersal_sampler::almost_infinite_normal::AlmostInfiniteNormalDispersalSampler, + dispersal_sampler::almost_infinite::normal::AlmostInfiniteNormalDispersalSampler, habitat::wrapping_noise::WrappingNoiseHabitat, }; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug)] #[cfg_attr(feature = "cuda", derive(rust_cuda::lend::LendRustToCuda))] #[cfg_attr(feature = "cuda", cuda(free = "M"))] diff --git a/necsim/impls/no-std/src/cogs/emigration_exit/domain.rs b/necsim/impls/no-std/src/cogs/emigration_exit/domain.rs index dca13451b..263d68618 100644 --- a/necsim/impls/no-std/src/cogs/emigration_exit/domain.rs +++ b/necsim/impls/no-std/src/cogs/emigration_exit/domain.rs @@ -15,7 +15,7 @@ use necsim_core::{ use crate::decomposition::Decomposition; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug)] pub struct DomainEmigrationExit, C: Decomposition> { decomposition: C, diff --git a/necsim/impls/no-std/src/cogs/emigration_exit/independent/choice/always.rs b/necsim/impls/no-std/src/cogs/emigration_exit/independent/choice/always.rs index ffba660b1..72232fa08 100644 --- a/necsim/impls/no-std/src/cogs/emigration_exit/independent/choice/always.rs +++ b/necsim/impls/no-std/src/cogs/emigration_exit/independent/choice/always.rs @@ -6,7 +6,7 @@ use necsim_core_bond::PositiveF64; use super::EmigrationChoice; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug, Default)] pub struct AlwaysEmigrationChoice([u8; 0]); diff --git a/necsim/impls/no-std/src/cogs/emigration_exit/independent/choice/mod.rs b/necsim/impls/no-std/src/cogs/emigration_exit/independent/choice/mod.rs index 2705041ff..308ae37fa 100644 --- a/necsim/impls/no-std/src/cogs/emigration_exit/independent/choice/mod.rs +++ b/necsim/impls/no-std/src/cogs/emigration_exit/independent/choice/mod.rs @@ -7,8 +7,7 @@ use necsim_core_bond::PositiveF64; pub mod always; pub mod probabilistic; -#[allow(clippy::module_name_repetitions)] -#[allow(clippy::inline_always, clippy::inline_fn_without_body)] +#[expect(clippy::module_name_repetitions)] #[contract_trait] pub trait EmigrationChoice>: Backup + core::fmt::Debug { fn should_lineage_emigrate( diff --git a/necsim/impls/no-std/src/cogs/emigration_exit/independent/choice/probabilistic.rs b/necsim/impls/no-std/src/cogs/emigration_exit/independent/choice/probabilistic.rs index d8c8bbdc1..7bdd51293 100644 --- a/necsim/impls/no-std/src/cogs/emigration_exit/independent/choice/probabilistic.rs +++ b/necsim/impls/no-std/src/cogs/emigration_exit/independent/choice/probabilistic.rs @@ -6,7 +6,7 @@ use necsim_core_bond::{ClosedUnitF64, PositiveF64}; use super::EmigrationChoice; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug)] pub struct ProbabilisticEmigrationChoice { probability: ClosedUnitF64, @@ -39,7 +39,7 @@ impl> EmigrationChoice for ProbabilisticEmigra let hash = diffuse(time.get().to_bits()); // http://prng.di.unimi.it -> Generating uniform doubles in the unit interval - #[allow(clippy::cast_precision_loss)] + #[expect(clippy::cast_precision_loss)] let u01 = ((hash >> 11) as f64) * f64::from_bits(0x3CA0_0000_0000_0000_u64); // 0x1.0p-53 u01 <= self.probability.get() diff --git a/necsim/impls/no-std/src/cogs/emigration_exit/independent/mod.rs b/necsim/impls/no-std/src/cogs/emigration_exit/independent/mod.rs index 5720aca3a..f1e1472a1 100644 --- a/necsim/impls/no-std/src/cogs/emigration_exit/independent/mod.rs +++ b/necsim/impls/no-std/src/cogs/emigration_exit/independent/mod.rs @@ -18,7 +18,7 @@ use crate::{ pub mod choice; use choice::EmigrationChoice; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug)] pub struct IndependentEmigrationExit< M: MathsCore, diff --git a/necsim/impls/no-std/src/cogs/emigration_exit/never.rs b/necsim/impls/no-std/src/cogs/emigration_exit/never.rs index 62e5320a5..c8be62fe3 100644 --- a/necsim/impls/no-std/src/cogs/emigration_exit/never.rs +++ b/necsim/impls/no-std/src/cogs/emigration_exit/never.rs @@ -6,7 +6,7 @@ use necsim_core::{ }; use necsim_core_bond::{NonNegativeF64, PositiveF64}; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug, Default)] #[cfg_attr(feature = "cuda", derive(rust_cuda::lend::LendRustToCuda))] pub struct NeverEmigrationExit([u8; 0]); diff --git a/necsim/impls/no-std/src/cogs/event_sampler/gillespie/conditional/mod.rs b/necsim/impls/no-std/src/cogs/event_sampler/gillespie/conditional/mod.rs index 2775ad348..5c4853968 100644 --- a/necsim/impls/no-std/src/cogs/event_sampler/gillespie/conditional/mod.rs +++ b/necsim/impls/no-std/src/cogs/event_sampler/gillespie/conditional/mod.rs @@ -23,7 +23,7 @@ mod probability; use probability::ProbabilityAtLocation; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug)] pub struct ConditionalGillespieEventSampler< M: MathsCore, @@ -35,7 +35,7 @@ pub struct ConditionalGillespieEventSampler< T: TurnoverRate, N: SpeciationProbability, > { - #[allow(clippy::type_complexity)] + #[expect(clippy::type_complexity)] marker: PhantomData<(M, H, G, S, X, D, T, N)>, } diff --git a/necsim/impls/no-std/src/cogs/event_sampler/gillespie/conditional/probability.rs b/necsim/impls/no-std/src/cogs/event_sampler/gillespie/conditional/probability.rs index 8d7ccaba2..05715c2ed 100644 --- a/necsim/impls/no-std/src/cogs/event_sampler/gillespie/conditional/probability.rs +++ b/necsim/impls/no-std/src/cogs/event_sampler/gillespie/conditional/probability.rs @@ -9,7 +9,7 @@ use necsim_core_bond::ClosedUnitF64; use crate::cogs::coalescence_sampler::conditional::ConditionalCoalescenceSampler; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct ProbabilityAtLocation { speciation: ClosedUnitF64, out_dispersal: ClosedUnitF64, diff --git a/necsim/impls/no-std/src/cogs/event_sampler/gillespie/mod.rs b/necsim/impls/no-std/src/cogs/event_sampler/gillespie/mod.rs index f0c8b72cb..9255ae548 100644 --- a/necsim/impls/no-std/src/cogs/event_sampler/gillespie/mod.rs +++ b/necsim/impls/no-std/src/cogs/event_sampler/gillespie/mod.rs @@ -10,9 +10,8 @@ use necsim_core_bond::NonNegativeF64; pub mod conditional; pub mod unconditional; -#[allow(clippy::inline_always, clippy::inline_fn_without_body)] #[contract_trait] -#[allow(clippy::module_name_repetitions, clippy::too_many_arguments)] +#[expect(clippy::module_name_repetitions, clippy::too_many_arguments)] pub trait GillespieEventSampler< M: MathsCore, H: Habitat, diff --git a/necsim/impls/no-std/src/cogs/event_sampler/gillespie/unconditional.rs b/necsim/impls/no-std/src/cogs/event_sampler/gillespie/unconditional.rs index b1864186d..564176033 100644 --- a/necsim/impls/no-std/src/cogs/event_sampler/gillespie/unconditional.rs +++ b/necsim/impls/no-std/src/cogs/event_sampler/gillespie/unconditional.rs @@ -16,7 +16,7 @@ use necsim_core_bond::{NonNegativeF64, PositiveF64}; use super::GillespieEventSampler; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug)] pub struct UnconditionalGillespieEventSampler< M: MathsCore, @@ -29,7 +29,7 @@ pub struct UnconditionalGillespieEventSampler< T: TurnoverRate, N: SpeciationProbability, > { - #[allow(clippy::type_complexity)] + #[expect(clippy::type_complexity)] marker: PhantomData<(M, H, G, S, X, D, C, T, N)>, } diff --git a/necsim/impls/no-std/src/cogs/event_sampler/independent.rs b/necsim/impls/no-std/src/cogs/event_sampler/independent.rs index 17ac313d0..73178a4a8 100644 --- a/necsim/impls/no-std/src/cogs/event_sampler/independent.rs +++ b/necsim/impls/no-std/src/cogs/event_sampler/independent.rs @@ -19,7 +19,7 @@ use crate::cogs::{ use super::tracking::{MinSpeciationTrackingEventSampler, SpeciationSample}; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug)] #[cfg_attr(feature = "cuda", derive(rust_cuda::lend::LendRustToCuda))] #[cfg_attr( diff --git a/necsim/impls/no-std/src/cogs/event_sampler/unconditional.rs b/necsim/impls/no-std/src/cogs/event_sampler/unconditional.rs index b20c476e7..3a245a083 100644 --- a/necsim/impls/no-std/src/cogs/event_sampler/unconditional.rs +++ b/necsim/impls/no-std/src/cogs/event_sampler/unconditional.rs @@ -12,7 +12,7 @@ use necsim_core::{ }; use necsim_core_bond::PositiveF64; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug)] pub struct UnconditionalEventSampler< M: MathsCore, @@ -25,7 +25,7 @@ pub struct UnconditionalEventSampler< T: TurnoverRate, N: SpeciationProbability, > { - #[allow(clippy::type_complexity)] + #[expect(clippy::type_complexity)] marker: PhantomData<(M, H, G, S, X, D, C, T, N)>, } diff --git a/necsim/impls/no-std/src/cogs/habitat/almost_infinite/downscaled.rs b/necsim/impls/no-std/src/cogs/habitat/almost_infinite/downscaled.rs new file mode 100644 index 000000000..77bc22638 --- /dev/null +++ b/necsim/impls/no-std/src/cogs/habitat/almost_infinite/downscaled.rs @@ -0,0 +1,305 @@ +use necsim_core::{ + cogs::{Habitat, MathsCore, RngCore, UniformlySampleableHabitat}, + landscape::{IndexedLocation, LandscapeExtent, Location}, +}; +use necsim_core_bond::{OffByOneU32, OffByOneU64}; + +use super::AlmostInfiniteHabitat; + +const ALMOST_INFINITE_EXTENT: LandscapeExtent = + LandscapeExtent::new(Location::new(0, 0), OffByOneU32::max(), OffByOneU32::max()); + +#[derive(Debug)] +#[cfg_attr(feature = "cuda", derive(rust_cuda::lend::LendRustToCuda))] +#[cfg_attr(feature = "cuda", cuda(free = "M"))] +pub struct AlmostInfiniteDownscaledHabitat { + #[cfg_attr(feature = "cuda", cuda(embed))] + habitat: AlmostInfiniteHabitat, + downscale_x: Log2U16, + downscale_y: Log2U16, +} + +#[derive(Copy, Clone, Debug, PartialEq, Eq, TypeLayout)] +#[repr(u32)] +pub enum Log2U16 { + _1B0 = 1 << 0, + _1B1 = 1 << 1, + _1B2 = 1 << 2, + _1B3 = 1 << 3, + _1B4 = 1 << 4, + _1B5 = 1 << 5, + _1B6 = 1 << 6, + _1B7 = 1 << 7, + _1B8 = 1 << 8, + _1B9 = 1 << 9, + _1B10 = 1 << 10, + _1B11 = 1 << 11, + _1B12 = 1 << 12, + _1B13 = 1 << 13, + _1B14 = 1 << 14, + _1B15 = 1 << 15, + _1B16 = 1 << 16, +} + +impl Log2U16 { + #[must_use] + pub const fn log2(self) -> u32 { + match self { + Self::_1B0 => 0, + Self::_1B1 => 1, + Self::_1B2 => 2, + Self::_1B3 => 3, + Self::_1B4 => 4, + Self::_1B5 => 5, + Self::_1B6 => 6, + Self::_1B7 => 7, + Self::_1B8 => 8, + Self::_1B9 => 9, + Self::_1B10 => 10, + Self::_1B11 => 11, + Self::_1B12 => 12, + Self::_1B13 => 13, + Self::_1B14 => 14, + Self::_1B15 => 15, + Self::_1B16 => 16, + } + } +} + +impl Clone for AlmostInfiniteDownscaledHabitat { + fn clone(&self) -> Self { + Self { + habitat: self.habitat.clone(), + downscale_x: self.downscale_x, + downscale_y: self.downscale_y, + } + } +} + +impl AlmostInfiniteDownscaledHabitat { + #[must_use] + pub fn new(downscale_x: Log2U16, downscale_y: Log2U16) -> Self { + Self::new_with_habitat(AlmostInfiniteHabitat::default(), downscale_x, downscale_y) + } + + #[must_use] + pub fn new_with_habitat( + habitat: AlmostInfiniteHabitat, + downscale_x: Log2U16, + downscale_y: Log2U16, + ) -> Self { + Self { + habitat, + downscale_x, + downscale_y, + } + } + + #[must_use] + pub fn downscale_x(&self) -> Log2U16 { + self.downscale_x + } + + #[must_use] + pub fn downscale_y(&self) -> Log2U16 { + self.downscale_y + } + + #[must_use] + pub fn downscale_area(&self) -> OffByOneU32 { + // 2^{0..16} * 2^{0..16} >=1 and < 2^32 + unsafe { OffByOneU32::new_unchecked((self.downscale_x as u64) * (self.downscale_y as u64)) } + } + + #[must_use] + pub fn unscaled(&self) -> &AlmostInfiniteHabitat { + &self.habitat + } +} + +#[contract_trait] +impl Habitat for AlmostInfiniteDownscaledHabitat { + type LocationIterator<'a> = impl Iterator; + + #[must_use] + fn is_finite(&self) -> bool { + false + } + + #[must_use] + fn get_extent(&self) -> &LandscapeExtent { + &ALMOST_INFINITE_EXTENT + } + + #[must_use] + fn get_total_habitat(&self) -> OffByOneU64 { + OffByOneU64::max() + } + + #[must_use] + fn get_habitat_at_location(&self, location: &Location) -> u32 { + // TODO: optimise + if ((location.x() % (self.downscale_x as u32)) == 0) + && ((location.y() % (self.downscale_y as u32)) == 0) + { + (self.downscale_x as u32) * (self.downscale_y as u32) + } else { + 0 + } + } + + #[must_use] + fn map_indexed_location_to_u64_injective(&self, indexed_location: &IndexedLocation) -> u64 { + // TODO: optimise + let index_x = indexed_location.index() % (self.downscale_x as u32); + let index_y = indexed_location.index() / (self.downscale_x as u32); + + self.habitat + .map_indexed_location_to_u64_injective(&IndexedLocation::new( + Location::new( + indexed_location.location().x() + index_x, + indexed_location.location().y() + index_y, + ), + 0, + )) + } + + #[must_use] + fn iter_habitable_locations(&self) -> Self::LocationIterator<'_> { + // TODO: optimise + let width = unsafe { + OffByOneU32::new_unchecked(OffByOneU32::max().get() / (self.downscale_x as u64)) + }; + let height = unsafe { + OffByOneU32::new_unchecked(OffByOneU32::max().get() / (self.downscale_y as u64)) + }; + + LandscapeExtent::new(Location::new(0, 0), width, height) + .iter() + .map(|location| { + Location::new( + location.x() * (self.downscale_x as u32), + location.y() * (self.downscale_y as u32), + ) + }) + } +} + +#[contract_trait] +impl> UniformlySampleableHabitat + for AlmostInfiniteDownscaledHabitat +{ + #[must_use] + #[inline] + fn sample_habitable_indexed_location(&self, rng: &mut G) -> IndexedLocation { + // TODO: optimise + let location = self.habitat.sample_habitable_indexed_location(rng); + + let index_x = location.location().x() % (self.downscale_x as u32); + let index_y = location.location().y() % (self.downscale_y as u32); + + IndexedLocation::new( + Location::new( + location.location().x() - index_x, + location.location().y() - index_y, + ), + index_y * (self.downscale_x as u32) + index_x, + ) + } +} + +impl serde::Serialize for Log2U16 { + fn serialize(&self, serializer: S) -> Result { + if serializer.is_human_readable() { + serializer.collect_str(&format_args!("1B{}", self.log2())) + } else { + serializer.serialize_u32((*self) as u32) + } + } +} + +impl<'de> serde::Deserialize<'de> for Log2U16 { + fn deserialize>(deserializer: D) -> Result { + struct Log2U16Visitor; + + impl<'de> serde::de::Visitor<'de> for Log2U16Visitor { + type Value = Log2U16; + + fn expecting(&self, fmt: &mut alloc::fmt::Formatter) -> alloc::fmt::Result { + fmt.write_str("an integer in 2^{0..=16} or its base-two scientific notation string") + } + + fn visit_u64(self, v: u64) -> Result { + match v { + const { Log2U16::_1B0 as u64 } => Ok(Log2U16::_1B0), + const { Log2U16::_1B1 as u64 } => Ok(Log2U16::_1B1), + const { Log2U16::_1B2 as u64 } => Ok(Log2U16::_1B2), + const { Log2U16::_1B3 as u64 } => Ok(Log2U16::_1B3), + const { Log2U16::_1B4 as u64 } => Ok(Log2U16::_1B4), + const { Log2U16::_1B5 as u64 } => Ok(Log2U16::_1B5), + const { Log2U16::_1B6 as u64 } => Ok(Log2U16::_1B6), + const { Log2U16::_1B7 as u64 } => Ok(Log2U16::_1B7), + const { Log2U16::_1B8 as u64 } => Ok(Log2U16::_1B8), + const { Log2U16::_1B9 as u64 } => Ok(Log2U16::_1B9), + const { Log2U16::_1B10 as u64 } => Ok(Log2U16::_1B10), + const { Log2U16::_1B11 as u64 } => Ok(Log2U16::_1B11), + const { Log2U16::_1B12 as u64 } => Ok(Log2U16::_1B12), + const { Log2U16::_1B13 as u64 } => Ok(Log2U16::_1B13), + const { Log2U16::_1B14 as u64 } => Ok(Log2U16::_1B14), + const { Log2U16::_1B15 as u64 } => Ok(Log2U16::_1B15), + const { Log2U16::_1B16 as u64 } => Ok(Log2U16::_1B16), + v => Err(serde::de::Error::invalid_value( + serde::de::Unexpected::Unsigned(v), + &self, + )), + } + } + + fn visit_str(self, v: &str) -> Result { + let Some(exp) = v.strip_prefix("1B") else { + return Err(serde::de::Error::invalid_value( + serde::de::Unexpected::Str(v), + &self, + )); + }; + + let Ok(exp) = exp.parse::() else { + return Err(serde::de::Error::invalid_value( + serde::de::Unexpected::Str(v), + &self, + )); + }; + + let Some(v) = [ + Log2U16::_1B0, + Log2U16::_1B1, + Log2U16::_1B2, + Log2U16::_1B3, + Log2U16::_1B4, + Log2U16::_1B5, + Log2U16::_1B6, + Log2U16::_1B7, + Log2U16::_1B8, + Log2U16::_1B9, + Log2U16::_1B10, + Log2U16::_1B11, + Log2U16::_1B12, + Log2U16::_1B13, + Log2U16::_1B14, + Log2U16::_1B15, + Log2U16::_1B16, + ] + .get(exp) else { + return Err(serde::de::Error::invalid_value( + serde::de::Unexpected::Str(v), + &self, + )); + }; + + Ok(*v) + } + } + + deserializer.deserialize_any(Log2U16Visitor) + } +} diff --git a/necsim/impls/no-std/src/cogs/habitat/almost_infinite.rs b/necsim/impls/no-std/src/cogs/habitat/almost_infinite/mod.rs similarity index 94% rename from necsim/impls/no-std/src/cogs/habitat/almost_infinite.rs rename to necsim/impls/no-std/src/cogs/habitat/almost_infinite/mod.rs index f3d97311b..0fae40e70 100644 --- a/necsim/impls/no-std/src/cogs/habitat/almost_infinite.rs +++ b/necsim/impls/no-std/src/cogs/habitat/almost_infinite/mod.rs @@ -8,10 +8,12 @@ use necsim_core_bond::{OffByOneU32, OffByOneU64}; use crate::cogs::lineage_store::coherent::globally::singleton_demes::SingletonDemesHabitat; +pub mod downscaled; + const ALMOST_INFINITE_EXTENT: LandscapeExtent = LandscapeExtent::new(Location::new(0, 0), OffByOneU32::max(), OffByOneU32::max()); -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[cfg_attr(feature = "cuda", derive(rust_cuda::lend::LendRustToCuda))] #[cfg_attr(feature = "cuda", cuda(free = "M"))] pub struct AlmostInfiniteHabitat { @@ -103,13 +105,13 @@ impl AlmostInfiniteHabitat { // Discrete dispersal assumes lineage positions are centred on (0.5, 0.5), // i.e. |dispersal| >= 0.5 changes the cell // (dx and dy must be rounded to nearest int away from 0.0) - #[allow(clippy::cast_possible_truncation, clippy::cast_sign_loss)] + #[expect(clippy::cast_possible_truncation)] let (dx, dy): (i64, i64) = (M::round(dx) as i64, M::round(dy) as i64); let new_x = (i64::from(location.x()) + dx) % WRAP; let new_y = (i64::from(location.y()) + dy) % WRAP; - #[allow(clippy::cast_sign_loss, clippy::cast_possible_truncation)] + #[expect(clippy::cast_sign_loss, clippy::cast_possible_truncation)] Location::new( ((new_x + WRAP) % WRAP) as u32, ((new_y + WRAP) % WRAP) as u32, diff --git a/necsim/impls/no-std/src/cogs/habitat/in_memory.rs b/necsim/impls/no-std/src/cogs/habitat/in_memory.rs index a5464654a..b00364df5 100644 --- a/necsim/impls/no-std/src/cogs/habitat/in_memory.rs +++ b/necsim/impls/no-std/src/cogs/habitat/in_memory.rs @@ -10,7 +10,7 @@ use necsim_core_bond::{OffByOneU32, OffByOneU64}; use crate::array2d::Array2D; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug)] #[cfg_attr(feature = "cuda", derive(rust_cuda::lend::LendRustToCuda))] #[cfg_attr(feature = "cuda", cuda(free = "M"))] @@ -87,7 +87,7 @@ impl Habitat for InMemoryHabitat { .enumerate() .filter_map(move |(location_index, habitat)| { if *habitat > 0 { - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_possible_truncation)] Some(Location::new( self.extent.origin().x().wrapping_add( (location_index % usize::from(self.extent.width())) as u32, @@ -110,14 +110,14 @@ impl> UniformlySampleableHabitat for InMemoryH fn sample_habitable_indexed_location(&self, rng: &mut G) -> IndexedLocation { use necsim_core::cogs::RngSampler; - let indexed_location_index = rng.sample_index_u64(self.get_total_habitat().into()); + let indexed_location_index = rng.sample_index_u64(self.get_total_habitat()); let location_index = match self.u64_injection.binary_search(&indexed_location_index) { Ok(index) => index, Err(index) => index - 1, }; - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_possible_truncation)] IndexedLocation::new( Location::new( self.extent @@ -167,7 +167,6 @@ impl InMemoryHabitat { return None; } - #[allow(clippy::cast_possible_truncation)] let extent = LandscapeExtent::new(Location::new(0, 0), width, height); Some(Self { diff --git a/necsim/impls/no-std/src/cogs/habitat/non_spatial.rs b/necsim/impls/no-std/src/cogs/habitat/non_spatial.rs index f210cba81..11a6784b9 100644 --- a/necsim/impls/no-std/src/cogs/habitat/non_spatial.rs +++ b/necsim/impls/no-std/src/cogs/habitat/non_spatial.rs @@ -1,7 +1,4 @@ -use core::{ - marker::PhantomData, - num::{NonZeroU32, NonZeroU64}, -}; +use core::{marker::PhantomData, num::NonZeroU32}; use necsim_core::{ cogs::{Habitat, MathsCore, RngCore, UniformlySampleableHabitat}, @@ -9,7 +6,7 @@ use necsim_core::{ }; use necsim_core_bond::{OffByOneU32, OffByOneU64}; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug)] #[cfg_attr(feature = "cuda", derive(rust_cuda::lend::LendRustToCuda))] #[cfg_attr(feature = "cuda", cuda(free = "M"))] @@ -121,17 +118,12 @@ impl> UniformlySampleableHabitat for NonSpatia fn sample_habitable_indexed_location(&self, rng: &mut G) -> IndexedLocation { use necsim_core::cogs::RngSampler; - let habitat_index_max = - self.extent.width().get() * self.extent.height().get() * u64::from(self.deme.get()); - - // Safety: habitat width, height, and deme are all > 0 - let mut dispersal_target_index = - rng.sample_index_u64(unsafe { NonZeroU64::new_unchecked(habitat_index_max) }); - #[allow(clippy::cast_possible_truncation)] + let mut dispersal_target_index = rng.sample_index_u64(self.get_total_habitat()); + #[expect(clippy::cast_possible_truncation)] let index = (dispersal_target_index % u64::from(self.deme.get())) as u32; dispersal_target_index /= u64::from(self.deme.get()); - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_possible_truncation)] IndexedLocation::new( Location::new( self.extent diff --git a/necsim/impls/no-std/src/cogs/habitat/spatially_implicit.rs b/necsim/impls/no-std/src/cogs/habitat/spatially_implicit.rs index 390176c2d..3d55b4264 100644 --- a/necsim/impls/no-std/src/cogs/habitat/spatially_implicit.rs +++ b/necsim/impls/no-std/src/cogs/habitat/spatially_implicit.rs @@ -11,7 +11,7 @@ use crate::cogs::habitat::non_spatial::NonSpatialHabitat; const SPATIALLY_IMPLICIT_EXTENT: LandscapeExtent = LandscapeExtent::new(Location::new(0, 0), OffByOneU32::max(), OffByOneU32::max()); -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug)] #[cfg_attr(feature = "cuda", derive(rust_cuda::lend::LendRustToCuda))] #[cfg_attr(feature = "cuda", cuda(free = "M"))] diff --git a/necsim/impls/no-std/src/cogs/habitat/wrapping_noise/mod.rs b/necsim/impls/no-std/src/cogs/habitat/wrapping_noise/mod.rs index 5e4f1bd3f..696ebe5bd 100644 --- a/necsim/impls/no-std/src/cogs/habitat/wrapping_noise/mod.rs +++ b/necsim/impls/no-std/src/cogs/habitat/wrapping_noise/mod.rs @@ -16,7 +16,7 @@ use crate::cogs::{ lineage_store::coherent::globally::singleton_demes::SingletonDemesHabitat, rng::wyhash::WyHash, }; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[cfg_attr(feature = "cuda", derive(rust_cuda::lend::LendRustToCuda))] #[cfg_attr(feature = "cuda", cuda(free = "M"))] pub struct WrappingNoiseHabitat { @@ -78,9 +78,9 @@ impl WrappingNoiseHabitat { samples.sort_unstable_by(f64::total_cmp); - #[allow(clippy::cast_possible_truncation)] - #[allow(clippy::cast_sign_loss)] - #[allow(clippy::cast_precision_loss)] + #[expect(clippy::cast_possible_truncation)] + #[expect(clippy::cast_sign_loss)] + #[expect(clippy::cast_precision_loss)] let threshold = samples [(M::floor((samples.len() as f64) * coverage.get()) as usize).min(samples.len() - 1)]; diff --git a/necsim/impls/no-std/src/cogs/habitat/wrapping_noise/opensimplex_noise/mod.rs b/necsim/impls/no-std/src/cogs/habitat/wrapping_noise/opensimplex_noise/mod.rs index d19a1a75d..a21c6ac88 100644 --- a/necsim/impls/no-std/src/cogs/habitat/wrapping_noise/opensimplex_noise/mod.rs +++ b/necsim/impls/no-std/src/cogs/habitat/wrapping_noise/opensimplex_noise/mod.rs @@ -47,20 +47,19 @@ impl OpenSimplexNoise { } } - #[allow(dead_code)] #[must_use] pub fn eval_2d(&self, x: f64, y: f64, wrap: f64) -> f64 { OpenSimplexNoise2D::eval::(Vec2::new(x, y), &self.perm, wrap) } - #[allow(dead_code)] #[must_use] + #[allow(dead_code)] // FIXME: use expect pub fn eval_3d(&self, x: f64, y: f64, z: f64, wrap: f64) -> f64 { OpenSimplexNoise3D::eval::(Vec3::new(x, y, z), &self.perm, wrap) } - #[allow(dead_code)] #[must_use] + #[allow(dead_code)] // FIXME: use expect pub fn eval_4d(&self, x: f64, y: f64, z: f64, w: f64, wrap: f64) -> f64 { OpenSimplexNoise4D::eval::(Vec4::new(x, y, z, w), &self.perm, wrap) } diff --git a/necsim/impls/no-std/src/cogs/habitat/wrapping_noise/opensimplex_noise/open_simplex_noise_4d.rs b/necsim/impls/no-std/src/cogs/habitat/wrapping_noise/opensimplex_noise/open_simplex_noise_4d.rs index fb330f108..30f8af920 100644 --- a/necsim/impls/no-std/src/cogs/habitat/wrapping_noise/opensimplex_noise/open_simplex_noise_4d.rs +++ b/necsim/impls/no-std/src/cogs/habitat/wrapping_noise/opensimplex_noise/open_simplex_noise_4d.rs @@ -312,7 +312,7 @@ impl OpenSimplexNoise4D { + contribute(1.0, 1.0, 1.0, 1.0) } - #[allow(clippy::too_many_lines)] + #[expect(clippy::too_many_lines)] fn inside_second_dispentachoron( ins: Vec4, contribute: impl Fn(f64, f64, f64, f64) -> f64, @@ -492,7 +492,7 @@ impl OpenSimplexNoise4D { + contribute(0.0, 0.0, 1.0, 1.0) } - #[allow(clippy::too_many_lines)] + #[expect(clippy::too_many_lines)] fn inside_first_dispentachoron( ins: Vec4, contribute: impl Fn(f64, f64, f64, f64) -> f64, diff --git a/necsim/impls/no-std/src/cogs/immigration_entry/buffered.rs b/necsim/impls/no-std/src/cogs/immigration_entry/buffered.rs index ecf95e6e1..37c162c91 100644 --- a/necsim/impls/no-std/src/cogs/immigration_entry/buffered.rs +++ b/necsim/impls/no-std/src/cogs/immigration_entry/buffered.rs @@ -6,7 +6,7 @@ use necsim_core::{ lineage::MigratingLineage, }; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug, Default)] pub struct BufferedImmigrationEntry { immigrants: BinaryHeap>, diff --git a/necsim/impls/no-std/src/cogs/immigration_entry/never.rs b/necsim/impls/no-std/src/cogs/immigration_entry/never.rs index 9c4df3ac8..be0904b35 100644 --- a/necsim/impls/no-std/src/cogs/immigration_entry/never.rs +++ b/necsim/impls/no-std/src/cogs/immigration_entry/never.rs @@ -3,7 +3,7 @@ use necsim_core::{ lineage::MigratingLineage, }; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug, Default)] #[cfg_attr(feature = "cuda", derive(rust_cuda::lend::LendRustToCuda))] pub struct NeverImmigrationEntry([u8; 0]); diff --git a/necsim/impls/no-std/src/cogs/lineage_reference/in_memory.rs b/necsim/impls/no-std/src/cogs/lineage_reference/in_memory.rs index cc7672a35..d8e095b49 100644 --- a/necsim/impls/no-std/src/cogs/lineage_reference/in_memory.rs +++ b/necsim/impls/no-std/src/cogs/lineage_reference/in_memory.rs @@ -3,7 +3,7 @@ use core::hash::Hash; use necsim_core::cogs::{Backup, Habitat, LineageReference, MathsCore}; #[derive(PartialEq, Eq, Hash, Debug, TypeLayout)] -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[repr(transparent)] pub struct InMemoryLineageReference(usize); diff --git a/necsim/impls/no-std/src/cogs/lineage_store/coherent/globally/gillespie/mod.rs b/necsim/impls/no-std/src/cogs/lineage_store/coherent/globally/gillespie/mod.rs index 95dee3b23..684033f16 100644 --- a/necsim/impls/no-std/src/cogs/lineage_store/coherent/globally/gillespie/mod.rs +++ b/necsim/impls/no-std/src/cogs/lineage_store/coherent/globally/gillespie/mod.rs @@ -16,7 +16,7 @@ use crate::cogs::lineage_reference::in_memory::InMemoryLineageReference; mod store; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug)] pub struct GillespieLineageStore> { lineages_store: Slab, diff --git a/necsim/impls/no-std/src/cogs/lineage_store/coherent/globally/singleton_demes/mod.rs b/necsim/impls/no-std/src/cogs/lineage_store/coherent/globally/singleton_demes/mod.rs index 64fb4bfdb..2ae74b974 100644 --- a/necsim/impls/no-std/src/cogs/lineage_store/coherent/globally/singleton_demes/mod.rs +++ b/necsim/impls/no-std/src/cogs/lineage_store/coherent/globally/singleton_demes/mod.rs @@ -16,7 +16,7 @@ mod store; /// Marker trait which declares that all locations have <= 1 habitat /// i.e. all indexed locations have index 0 -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub trait SingletonDemesHabitat: Habitat { #[must_use] #[inline] @@ -27,7 +27,7 @@ pub trait SingletonDemesHabitat: Habitat { } } -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug)] pub struct SingletonDemesLineageStore> { lineages_store: Slab, diff --git a/necsim/impls/no-std/src/cogs/lineage_store/coherent/locally/classical/mod.rs b/necsim/impls/no-std/src/cogs/lineage_store/coherent/locally/classical/mod.rs index bae6895ac..ece0e7dba 100644 --- a/necsim/impls/no-std/src/cogs/lineage_store/coherent/locally/classical/mod.rs +++ b/necsim/impls/no-std/src/cogs/lineage_store/coherent/locally/classical/mod.rs @@ -14,7 +14,7 @@ use crate::cogs::lineage_reference::in_memory::InMemoryLineageReference; mod store; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug)] pub struct ClassicalLineageStore> { lineages_store: Slab, diff --git a/necsim/impls/no-std/src/cogs/lineage_store/independent.rs b/necsim/impls/no-std/src/cogs/lineage_store/independent.rs index 606be853e..b3d279f23 100644 --- a/necsim/impls/no-std/src/cogs/lineage_store/independent.rs +++ b/necsim/impls/no-std/src/cogs/lineage_store/independent.rs @@ -5,7 +5,7 @@ use necsim_core::{ lineage::{GlobalLineageReference, Lineage}, }; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug)] #[cfg_attr(feature = "cuda", derive(rust_cuda::lend::LendRustToCuda))] #[cfg_attr(feature = "cuda", cuda(free = "M", free = "H"))] diff --git a/necsim/impls/no-std/src/cogs/maths/intrinsics.rs b/necsim/impls/no-std/src/cogs/maths/intrinsics.rs index 46801aac8..77f323649 100644 --- a/necsim/impls/no-std/src/cogs/maths/intrinsics.rs +++ b/necsim/impls/no-std/src/cogs/maths/intrinsics.rs @@ -1,2 +1,2 @@ -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub use necsim_core_maths::IntrinsicsMathsCore; diff --git a/necsim/impls/no-std/src/cogs/maths/reproducible.rs b/necsim/impls/no-std/src/cogs/maths/reproducible.rs index 30aad861a..ea1c1a89f 100644 --- a/necsim/impls/no-std/src/cogs/maths/reproducible.rs +++ b/necsim/impls/no-std/src/cogs/maths/reproducible.rs @@ -1,7 +1,7 @@ use necsim_core::cogs::MathsCore; #[derive(Clone, Debug)] -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub enum ReproducibleMathsCore {} impl MathsCore for ReproducibleMathsCore { diff --git a/necsim/impls/no-std/src/cogs/origin_sampler/decomposition.rs b/necsim/impls/no-std/src/cogs/origin_sampler/decomposition.rs index 518e26a61..7dbdeef33 100644 --- a/necsim/impls/no-std/src/cogs/origin_sampler/decomposition.rs +++ b/necsim/impls/no-std/src/cogs/origin_sampler/decomposition.rs @@ -12,7 +12,7 @@ use crate::{ decomposition::Decomposition, }; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug)] pub struct DecompositionOriginSampler< 'd, @@ -54,7 +54,7 @@ impl<'d, M: MathsCore, O: UntrustedOriginSampler<'d, M>, D: Decomposition u64 { - #[allow( + #[expect( clippy::cast_possible_truncation, clippy::cast_sign_loss, clippy::cast_precision_loss @@ -77,7 +77,6 @@ impl<'d, M: MathsCore, O: UntrustedOriginSampler<'d, M>, D: Decomposition Option { - #[allow(clippy::while_let_on_iterator)] while let Some(lineage) = self.origin_sampler.next() { // Forward any out-of-habitat or out-of-deme lineages // (but only on the root subdomain -> no duplication) diff --git a/necsim/impls/no-std/src/cogs/origin_sampler/in_memory.rs b/necsim/impls/no-std/src/cogs/origin_sampler/in_memory.rs index 4ea417586..285bc3fd7 100644 --- a/necsim/impls/no-std/src/cogs/origin_sampler/in_memory.rs +++ b/necsim/impls/no-std/src/cogs/origin_sampler/in_memory.rs @@ -16,7 +16,7 @@ use crate::cogs::{ use super::{TrustedOriginSampler, UntrustedOriginSampler}; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct InMemoryOriginSampler<'h, M: MathsCore, I: Iterator> { pre_sampler: OriginPreSampler, last_index: u64, @@ -66,11 +66,7 @@ impl<'h, M: MathsCore, I: Iterator> UntrustedOriginSampler<'h, M> } fn full_upper_bound_size_hint(&self) -> u64 { - #[allow( - clippy::cast_possible_truncation, - clippy::cast_sign_loss, - clippy::cast_precision_loss - )] + #[expect(clippy::cast_possible_truncation, clippy::cast_sign_loss)] { (f64::from(self.habitat.get_total_habitat()) * self.pre_sampler.get_sample_proportion().get()) as u64 diff --git a/necsim/impls/no-std/src/cogs/origin_sampler/mod.rs b/necsim/impls/no-std/src/cogs/origin_sampler/mod.rs index 0a3720da6..2d21e7a04 100644 --- a/necsim/impls/no-std/src/cogs/origin_sampler/mod.rs +++ b/necsim/impls/no-std/src/cogs/origin_sampler/mod.rs @@ -13,9 +13,8 @@ pub mod spatially_implicit; use pre_sampler::OriginPreSampler; -#[allow(clippy::inline_always, clippy::inline_fn_without_body)] #[contract_trait] -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] /// `Lineage`s produced by the sampler's iterator must have /// * unique global references pub trait UntrustedOriginSampler<'h, M: MathsCore>: @@ -38,7 +37,7 @@ pub trait UntrustedOriginSampler<'h, M: MathsCore>: /// * unique global references /// * unique indexed locations /// * valid indexed locations (i.e. inside habitable demes) -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub unsafe trait TrustedOriginSampler<'h, M: MathsCore>: UntrustedOriginSampler<'h, M> { diff --git a/necsim/impls/no-std/src/cogs/origin_sampler/non_spatial.rs b/necsim/impls/no-std/src/cogs/origin_sampler/non_spatial.rs index 8cebb7036..71d3dab2d 100644 --- a/necsim/impls/no-std/src/cogs/origin_sampler/non_spatial.rs +++ b/necsim/impls/no-std/src/cogs/origin_sampler/non_spatial.rs @@ -16,7 +16,7 @@ use crate::cogs::{ use super::{TrustedOriginSampler, UntrustedOriginSampler}; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct NonSpatialOriginSampler<'h, M: MathsCore, I: Iterator> { pre_sampler: OriginPreSampler, last_index: u64, @@ -66,11 +66,7 @@ impl<'h, M: MathsCore, I: Iterator> UntrustedOriginSampler<'h, M> } fn full_upper_bound_size_hint(&self) -> u64 { - #[allow( - clippy::cast_possible_truncation, - clippy::cast_sign_loss, - clippy::cast_precision_loss - )] + #[expect(clippy::cast_possible_truncation, clippy::cast_sign_loss)] { (f64::from(self.habitat.get_total_habitat()) * self.pre_sampler.get_sample_proportion().get()) as u64 diff --git a/necsim/impls/no-std/src/cogs/origin_sampler/pre_sampler.rs b/necsim/impls/no-std/src/cogs/origin_sampler/pre_sampler.rs index 6fb1072a6..67240d589 100644 --- a/necsim/impls/no-std/src/cogs/origin_sampler/pre_sampler.rs +++ b/necsim/impls/no-std/src/cogs/origin_sampler/pre_sampler.rs @@ -11,7 +11,7 @@ use necsim_partitioning_core::partition::Partition; const INV_PHI: f64 = 6.180_339_887_498_949e-1_f64; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct OriginPreSampler> { inner: I, proportion: ClosedUnitF64, @@ -91,7 +91,7 @@ impl> OriginPreSampler { *quasi_random += INV_PHI; *quasi_random -= M::floor(*quasi_random); - #[allow(clippy::cast_sign_loss, clippy::cast_possible_truncation)] + #[expect(clippy::cast_sign_loss, clippy::cast_possible_truncation)] let skip = M::floor(M::ln(*quasi_random) * inv_geometric_sample_rate) as usize; self.nth(skip) diff --git a/necsim/impls/no-std/src/cogs/origin_sampler/resuming.rs b/necsim/impls/no-std/src/cogs/origin_sampler/resuming.rs index 72e6fcf1e..b182a27d1 100644 --- a/necsim/impls/no-std/src/cogs/origin_sampler/resuming.rs +++ b/necsim/impls/no-std/src/cogs/origin_sampler/resuming.rs @@ -9,7 +9,7 @@ use crate::cogs::origin_sampler::{pre_sampler::OriginPreSampler, TrustedOriginSa use super::UntrustedOriginSampler; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct ResumingOriginSampler< 'h, M: MathsCore, @@ -80,7 +80,7 @@ impl< } fn full_upper_bound_size_hint(&self) -> u64 { - #[allow( + #[expect( clippy::cast_precision_loss, clippy::cast_possible_truncation, clippy::cast_sign_loss diff --git a/necsim/impls/no-std/src/cogs/origin_sampler/singleton_demes/circle.rs b/necsim/impls/no-std/src/cogs/origin_sampler/singleton_demes/circle.rs index b301bb4bd..429b9db96 100644 --- a/necsim/impls/no-std/src/cogs/origin_sampler/singleton_demes/circle.rs +++ b/necsim/impls/no-std/src/cogs/origin_sampler/singleton_demes/circle.rs @@ -9,12 +9,9 @@ use necsim_core_bond::OffByOneU32; use crate::cogs::{ lineage_store::coherent::globally::singleton_demes::SingletonDemesHabitat, - origin_sampler::pre_sampler::OriginPreSampler, + origin_sampler::{pre_sampler::OriginPreSampler, TrustedOriginSampler, UntrustedOriginSampler}, }; -use super::{TrustedOriginSampler, UntrustedOriginSampler}; - -#[allow(clippy::module_name_repetitions)] pub struct SingletonDemesCircleOriginSampler< 'h, M: MathsCore, @@ -70,7 +67,7 @@ impl<'h, M: MathsCore, H: SingletonDemesHabitat, I: Iterator> diameter, ); - #[allow(clippy::cast_possible_truncation, clippy::cast_sign_loss)] + #[expect(clippy::cast_possible_truncation, clippy::cast_sign_loss)] let upper_bound_size_hint = M::ceil( f64::from(radius) * f64::from(radius) diff --git a/necsim/impls/no-std/src/cogs/origin_sampler/singleton_demes/downscaled.rs b/necsim/impls/no-std/src/cogs/origin_sampler/singleton_demes/downscaled.rs new file mode 100644 index 000000000..13ea58e60 --- /dev/null +++ b/necsim/impls/no-std/src/cogs/origin_sampler/singleton_demes/downscaled.rs @@ -0,0 +1,92 @@ +use core::{fmt, iter::Iterator}; + +use necsim_core::{ + cogs::MathsCore, + landscape::{IndexedLocation, Location}, + lineage::Lineage, +}; + +use crate::cogs::{ + habitat::almost_infinite::{ + downscaled::AlmostInfiniteDownscaledHabitat, AlmostInfiniteHabitat, + }, + origin_sampler::{pre_sampler::OriginPreSampler, TrustedOriginSampler, UntrustedOriginSampler}, +}; + +pub struct AlmostInfiniteDownscaledOriginSampler< + 'h, + M: MathsCore, + O: UntrustedOriginSampler<'h, M, Habitat = AlmostInfiniteHabitat>, +> { + sampler: O, + habitat: &'h AlmostInfiniteDownscaledHabitat, +} + +impl<'h, M: MathsCore, O: UntrustedOriginSampler<'h, M, Habitat = AlmostInfiniteHabitat>> + AlmostInfiniteDownscaledOriginSampler<'h, M, O> +{ + #[must_use] + pub fn new(sampler: O, habitat: &'h AlmostInfiniteDownscaledHabitat) -> Self { + Self { sampler, habitat } + } +} + +impl<'h, M: MathsCore, O: UntrustedOriginSampler<'h, M, Habitat = AlmostInfiniteHabitat>> + fmt::Debug for AlmostInfiniteDownscaledOriginSampler<'h, M, O> +{ + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + fmt.debug_struct(stringify!(AlmostInfiniteDownscaledOriginSampler)) + .field("sampler", &self.sampler) + .field("habitat", &self.habitat) + .finish() + } +} + +#[contract_trait] +impl<'h, M: MathsCore, O: UntrustedOriginSampler<'h, M, Habitat = AlmostInfiniteHabitat>> + UntrustedOriginSampler<'h, M> for AlmostInfiniteDownscaledOriginSampler<'h, M, O> +{ + type Habitat = AlmostInfiniteDownscaledHabitat; + type PreSampler = O::PreSampler; + + fn habitat(&self) -> &'h Self::Habitat { + self.habitat + } + + fn into_pre_sampler(self) -> OriginPreSampler { + self.sampler.into_pre_sampler() + } + + fn full_upper_bound_size_hint(&self) -> u64 { + self.sampler.full_upper_bound_size_hint() + } +} + +unsafe impl<'h, M: MathsCore, O: TrustedOriginSampler<'h, M, Habitat = AlmostInfiniteHabitat>> + TrustedOriginSampler<'h, M> for AlmostInfiniteDownscaledOriginSampler<'h, M, O> +{ +} + +impl<'h, M: MathsCore, O: UntrustedOriginSampler<'h, M, Habitat = AlmostInfiniteHabitat>> + Iterator for AlmostInfiniteDownscaledOriginSampler<'h, M, O> +{ + type Item = Lineage; + + fn next(&mut self) -> Option { + let location = self.sampler.next()?.indexed_location; + + let index_x = location.location().x() % (self.habitat.downscale_x() as u32); + let index_y = location.location().y() % (self.habitat.downscale_y() as u32); + + Some(Lineage::new( + IndexedLocation::new( + Location::new( + location.location().x() - index_x, + location.location().y() - index_y, + ), + index_y * (self.habitat.downscale_x() as u32) + index_x, + ), + self.habitat, + )) + } +} diff --git a/necsim/impls/no-std/src/cogs/origin_sampler/singleton_demes/mod.rs b/necsim/impls/no-std/src/cogs/origin_sampler/singleton_demes/mod.rs index 66ebd0def..a76358915 100644 --- a/necsim/impls/no-std/src/cogs/origin_sampler/singleton_demes/mod.rs +++ b/necsim/impls/no-std/src/cogs/origin_sampler/singleton_demes/mod.rs @@ -4,15 +4,14 @@ use necsim_core::{cogs::MathsCore, lineage::Lineage}; use crate::cogs::{ lineage_store::coherent::globally::singleton_demes::SingletonDemesHabitat, - origin_sampler::pre_sampler::OriginPreSampler, + origin_sampler::{pre_sampler::OriginPreSampler, TrustedOriginSampler, UntrustedOriginSampler}, }; -use super::{TrustedOriginSampler, UntrustedOriginSampler}; - pub mod circle; +pub mod downscaled; pub mod rectangle; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub enum SingletonDemesOriginSampler< 'h, M: MathsCore, diff --git a/necsim/impls/no-std/src/cogs/origin_sampler/singleton_demes/rectangle.rs b/necsim/impls/no-std/src/cogs/origin_sampler/singleton_demes/rectangle.rs index e4005cec1..a2e836df0 100644 --- a/necsim/impls/no-std/src/cogs/origin_sampler/singleton_demes/rectangle.rs +++ b/necsim/impls/no-std/src/cogs/origin_sampler/singleton_demes/rectangle.rs @@ -14,7 +14,6 @@ use crate::cogs::{ origin_sampler::{pre_sampler::OriginPreSampler, TrustedOriginSampler, UntrustedOriginSampler}, }; -#[allow(clippy::module_name_repetitions)] pub struct SingletonDemesRectangleOriginSampler< 'h, M: MathsCore, @@ -77,7 +76,7 @@ impl<'h, M: MathsCore, H: SingletonDemesHabitat, I: Iterator> } fn full_upper_bound_size_hint(&self) -> u64 { - #[allow(clippy::cast_possible_truncation, clippy::cast_sign_loss)] + #[expect(clippy::cast_possible_truncation, clippy::cast_sign_loss)] { (f64::from(self.sample.width()) * f64::from(self.sample.height()) diff --git a/necsim/impls/no-std/src/cogs/origin_sampler/spatially_implicit.rs b/necsim/impls/no-std/src/cogs/origin_sampler/spatially_implicit.rs index 30fe6915b..d0aef7c29 100644 --- a/necsim/impls/no-std/src/cogs/origin_sampler/spatially_implicit.rs +++ b/necsim/impls/no-std/src/cogs/origin_sampler/spatially_implicit.rs @@ -9,7 +9,7 @@ use crate::cogs::{ use super::{TrustedOriginSampler, UntrustedOriginSampler}; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct SpatiallyImplicitOriginSampler<'h, M: MathsCore, I: Iterator> { local_iterator: NonSpatialOriginSampler<'h, M, I>, habitat: &'h SpatiallyImplicitHabitat, diff --git a/necsim/impls/no-std/src/cogs/rng/rand.rs b/necsim/impls/no-std/src/cogs/rng/rand.rs index d29ceeb1b..dcef65e47 100644 --- a/necsim/impls/no-std/src/cogs/rng/rand.rs +++ b/necsim/impls/no-std/src/cogs/rng/rand.rs @@ -5,7 +5,7 @@ use necsim_core::cogs::{Backup, MathsCore, RngCore}; use rand_core::{RngCore as RandRngCore, SeedableRng as RandSeedableRng}; use serde::{de::DeserializeOwned, Deserialize, Deserializer, Serialize, Serializer}; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Clone, TypeLayout)] #[layout(free = "M")] #[repr(transparent)] diff --git a/necsim/impls/no-std/src/cogs/rng/seahash.rs b/necsim/impls/no-std/src/cogs/rng/seahash.rs index d13be722f..d5867f5d2 100644 --- a/necsim/impls/no-std/src/cogs/rng/seahash.rs +++ b/necsim/impls/no-std/src/cogs/rng/seahash.rs @@ -4,7 +4,6 @@ use necsim_core::cogs::{MathsCore, PrimeableRng, RngCore}; use serde::{Deserialize, Serialize}; -#[allow(clippy::module_name_repetitions)] #[derive(Debug, Serialize, Deserialize, TypeLayout)] #[serde(deny_unknown_fields)] #[layout(free = "M")] diff --git a/necsim/impls/no-std/src/cogs/rng/wyhash.rs b/necsim/impls/no-std/src/cogs/rng/wyhash.rs index 2697546d5..dc2bd039a 100644 --- a/necsim/impls/no-std/src/cogs/rng/wyhash.rs +++ b/necsim/impls/no-std/src/cogs/rng/wyhash.rs @@ -11,7 +11,6 @@ const P1: u64 = 0xe703_7ed1_a0b4_28db; const P2: u64 = 0x8ebc_6af0_9c88_c6e3; const P5: u64 = 0xeb44_acca_b455_d165; -#[allow(clippy::module_name_repetitions)] #[derive(Debug, Serialize, Deserialize, TypeLayout)] #[layout(free = "M")] #[serde(deny_unknown_fields)] @@ -72,8 +71,8 @@ impl PrimeableRng for WyHash { // wyhash state repriming // https://docs.rs/wyhash/0.5.0/src/wyhash/functions.rs.html#67-70 let hash = wymum( - ((location_index << 32) | (location_index >> 32)) ^ (self.seed ^ P0), - ((time_index << 32) | (time_index >> 32)) ^ P2, + location_index.rotate_right(32) ^ (self.seed ^ P0), + time_index.rotate_right(32) ^ P2, ); self.state = wymum(hash, 16 ^ P5); @@ -81,7 +80,7 @@ impl PrimeableRng for WyHash { } #[inline] -#[allow(clippy::cast_possible_truncation)] +#[expect(clippy::cast_possible_truncation)] fn wymum(mut a: u64, mut b: u64) -> u64 { // WyHash diffusion function // https://docs.rs/wyhash/0.5.0/src/wyhash/functions.rs.html#8-12 diff --git a/necsim/impls/no-std/src/cogs/speciation_probability/spatially_implicit.rs b/necsim/impls/no-std/src/cogs/speciation_probability/spatially_implicit.rs index 2321250b9..6202c19f8 100644 --- a/necsim/impls/no-std/src/cogs/speciation_probability/spatially_implicit.rs +++ b/necsim/impls/no-std/src/cogs/speciation_probability/spatially_implicit.rs @@ -8,7 +8,7 @@ use crate::cogs::habitat::spatially_implicit::SpatiallyImplicitHabitat; #[derive(Clone, Debug)] #[cfg_attr(feature = "cuda", derive(rust_cuda::lend::LendRustToCuda))] -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct SpatiallyImplicitSpeciationProbability { meta_speciation_probability: PositiveUnitF64, } diff --git a/necsim/impls/no-std/src/cogs/speciation_probability/uniform.rs b/necsim/impls/no-std/src/cogs/speciation_probability/uniform.rs index 9c119db94..78833e158 100644 --- a/necsim/impls/no-std/src/cogs/speciation_probability/uniform.rs +++ b/necsim/impls/no-std/src/cogs/speciation_probability/uniform.rs @@ -6,7 +6,7 @@ use necsim_core_bond::ClosedUnitF64; #[derive(Clone, Debug)] #[cfg_attr(feature = "cuda", derive(rust_cuda::lend::LendRustToCuda))] -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct UniformSpeciationProbability { speciation_probability: ClosedUnitF64, } diff --git a/necsim/impls/no-std/src/cogs/turnover_rate/in_memory.rs b/necsim/impls/no-std/src/cogs/turnover_rate/in_memory.rs index f12800b11..91867a36b 100644 --- a/necsim/impls/no-std/src/cogs/turnover_rate/in_memory.rs +++ b/necsim/impls/no-std/src/cogs/turnover_rate/in_memory.rs @@ -10,7 +10,7 @@ use necsim_core_bond::NonNegativeF64; use crate::{array2d::Array2D, cogs::habitat::in_memory::InMemoryHabitat}; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Clone, Debug)] #[cfg_attr(feature = "cuda", derive(rust_cuda::lend::LendRustToCuda))] pub struct InMemoryTurnoverRate { @@ -40,7 +40,7 @@ impl TurnoverRate> for InMemoryTurnoverRate } } -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(displaydoc::Display, Debug)] pub enum InMemoryTurnoverRateError { /// There is some location with zero turnover and non-zero habitat. diff --git a/necsim/impls/no-std/src/cogs/turnover_rate/uniform.rs b/necsim/impls/no-std/src/cogs/turnover_rate/uniform.rs index c2465befc..4eed4bbdd 100644 --- a/necsim/impls/no-std/src/cogs/turnover_rate/uniform.rs +++ b/necsim/impls/no-std/src/cogs/turnover_rate/uniform.rs @@ -6,7 +6,7 @@ use necsim_core_bond::{NonNegativeF64, PositiveF64}; #[derive(Clone, Debug)] #[cfg_attr(feature = "cuda", derive(rust_cuda::lend::LendRustToCuda))] -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct UniformTurnoverRate { turnover_rate: PositiveF64, } diff --git a/necsim/impls/no-std/src/decomposition/equal/area.rs b/necsim/impls/no-std/src/decomposition/equal/area.rs index e88f4b556..cf8037c19 100644 --- a/necsim/impls/no-std/src/decomposition/equal/area.rs +++ b/necsim/impls/no-std/src/decomposition/equal/area.rs @@ -37,7 +37,7 @@ impl> EqualDecomposition { .into_iter() .enumerate() .filter_map(|(i, index)| { - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_possible_truncation)] let next_rank = ((i as u64) * u64::from(subdomain.size().get()) / num_indices) as u32; diff --git a/necsim/impls/no-std/src/decomposition/equal/mod.rs b/necsim/impls/no-std/src/decomposition/equal/mod.rs index 79619f699..4f0eea7b2 100644 --- a/necsim/impls/no-std/src/decomposition/equal/mod.rs +++ b/necsim/impls/no-std/src/decomposition/equal/mod.rs @@ -16,7 +16,7 @@ mod weight; #[cfg(test)] mod test; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug)] pub struct EqualDecomposition> { subdomain: Partition, @@ -58,7 +58,7 @@ impl> Decomposition for EqualDecomposition (index + 1) as u32, Err(index) => index as u32, @@ -68,7 +68,7 @@ impl> Decomposition for EqualDecomposition> EqualDecomposition { fn next_log2(coord: OffByOneU32) -> u8 { - #[allow(clippy::cast_possible_truncation, clippy::cast_sign_loss)] + #[expect(clippy::cast_possible_truncation, clippy::cast_sign_loss)] if coord.get() > 1 { M::ceil(M::ln(f64::from(coord)) / core::f64::consts::LN_2) as u8 } else { diff --git a/necsim/impls/no-std/src/decomposition/equal/weight.rs b/necsim/impls/no-std/src/decomposition/equal/weight.rs index 3790be225..fe1a88e5c 100644 --- a/necsim/impls/no-std/src/decomposition/equal/weight.rs +++ b/necsim/impls/no-std/src/decomposition/equal/weight.rs @@ -46,7 +46,7 @@ impl> EqualDecomposition { let indices: Vec = indices .into_iter() .filter_map(|(index, habitat)| { - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_possible_truncation)] let next_rank = (u128::from(cumulative_habitat) * u128::from(subdomain.size().get()) / u128::from(total_habitat)) as u32; diff --git a/necsim/impls/no-std/src/decomposition/mod.rs b/necsim/impls/no-std/src/decomposition/mod.rs index 7791d99c5..704c27a19 100644 --- a/necsim/impls/no-std/src/decomposition/mod.rs +++ b/necsim/impls/no-std/src/decomposition/mod.rs @@ -9,7 +9,6 @@ pub mod modulo; pub mod monolithic; pub mod radial; -#[allow(clippy::inline_always, clippy::inline_fn_without_body)] #[contract_trait] pub trait Decomposition>: Backup + Sized + core::fmt::Debug { fn get_subdomain(&self) -> Partition; diff --git a/necsim/impls/no-std/src/decomposition/modulo.rs b/necsim/impls/no-std/src/decomposition/modulo.rs index 54a1fa58c..939446e1d 100644 --- a/necsim/impls/no-std/src/decomposition/modulo.rs +++ b/necsim/impls/no-std/src/decomposition/modulo.rs @@ -6,7 +6,7 @@ use necsim_partitioning_core::partition::Partition; use crate::decomposition::Decomposition; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug)] pub struct ModuloDecomposition { subdomain: Partition, @@ -41,7 +41,7 @@ impl> Decomposition for ModuloDecomposition { * u64::from(extent.width()) + u64::from(location.x() - extent.origin().x()); - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_possible_truncation)] { (location_index % u64::from(self.subdomain.size().get())) as u32 } diff --git a/necsim/impls/no-std/src/decomposition/monolithic.rs b/necsim/impls/no-std/src/decomposition/monolithic.rs index bcb556a29..db8522e08 100644 --- a/necsim/impls/no-std/src/decomposition/monolithic.rs +++ b/necsim/impls/no-std/src/decomposition/monolithic.rs @@ -6,7 +6,7 @@ use necsim_partitioning_core::partition::Partition; use crate::decomposition::Decomposition; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug, Default)] pub struct MonolithicDecomposition(()); diff --git a/necsim/impls/no-std/src/decomposition/radial.rs b/necsim/impls/no-std/src/decomposition/radial.rs index c05fa3a63..a15309c1a 100644 --- a/necsim/impls/no-std/src/decomposition/radial.rs +++ b/necsim/impls/no-std/src/decomposition/radial.rs @@ -8,7 +8,7 @@ use necsim_partitioning_core::partition::Partition; use crate::decomposition::Decomposition; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug)] pub struct RadialDecomposition { subdomain: Partition, @@ -42,7 +42,7 @@ impl> Decomposition for RadialDecomposition { let neutral_x = location.x().wrapping_sub(extent.origin().x()); let neutral_y = location.y().wrapping_sub(extent.origin().y()); - #[allow(clippy::cast_precision_loss)] + #[expect(clippy::cast_precision_loss)] let fraction = (atan2( (i64::from(neutral_y) - i64::from(extent.height()) / 2) as f64, (i64::from(neutral_x) - i64::from(extent.width()) / 2) as f64, @@ -50,7 +50,7 @@ impl> Decomposition for RadialDecomposition { * 0.5_f64) + 0.5_f64; - #[allow(clippy::cast_possible_truncation, clippy::cast_sign_loss)] + #[expect(clippy::cast_possible_truncation, clippy::cast_sign_loss)] { (M::floor(f64::from(self.subdomain.size().get()) * fraction) as u32) .min(self.subdomain.size().get() - 1) diff --git a/necsim/impls/no-std/src/lib.rs b/necsim/impls/no-std/src/lib.rs index aa63583a1..4fa3d723a 100644 --- a/necsim/impls/no-std/src/lib.rs +++ b/necsim/impls/no-std/src/lib.rs @@ -5,6 +5,7 @@ #![feature(const_type_name)] #![feature(negative_impls)] #![feature(impl_trait_in_assoc_type)] +#![feature(inline_const_pat)] #![allow(incomplete_features)] #![feature(specialization)] diff --git a/necsim/impls/no-std/src/parallelisation/independent/individuals.rs b/necsim/impls/no-std/src/parallelisation/independent/individuals.rs index 6182e0947..4df2633d5 100644 --- a/necsim/impls/no-std/src/parallelisation/independent/individuals.rs +++ b/necsim/impls/no-std/src/parallelisation/independent/individuals.rs @@ -34,7 +34,7 @@ use crate::{ use super::{reporter::IgnoreProgressReporterProxy, DedupCache}; -#[allow(clippy::type_complexity)] +#[expect(clippy::type_complexity)] pub fn simulate< 'p, M: MathsCore, diff --git a/necsim/impls/no-std/src/parallelisation/independent/landscape.rs b/necsim/impls/no-std/src/parallelisation/independent/landscape.rs index 2a28c8ea3..74ef2844d 100644 --- a/necsim/impls/no-std/src/parallelisation/independent/landscape.rs +++ b/necsim/impls/no-std/src/parallelisation/independent/landscape.rs @@ -37,7 +37,7 @@ use crate::{ use super::{reporter::IgnoreProgressReporterProxy, DedupCache}; -#[allow(clippy::type_complexity, clippy::too_many_lines)] +#[expect(clippy::type_complexity)] pub fn simulate< 'p, M: MathsCore, diff --git a/necsim/impls/no-std/src/parallelisation/independent/mod.rs b/necsim/impls/no-std/src/parallelisation/independent/mod.rs index 2af9e12e5..717c7f886 100644 --- a/necsim/impls/no-std/src/parallelisation/independent/mod.rs +++ b/necsim/impls/no-std/src/parallelisation/independent/mod.rs @@ -40,7 +40,7 @@ impl DedupCache { DirectMappedCache::with_capacity(match self { DedupCache::Absolute(AbsoluteCapacity { capacity }) => capacity.get(), DedupCache::Relative(RelativeCapacity { factor }) => { - #[allow( + #[expect( clippy::cast_precision_loss, clippy::cast_sign_loss, clippy::cast_possible_truncation @@ -54,7 +54,7 @@ impl DedupCache { } } -#[allow(clippy::unsafe_derive_deserialize)] +#[expect(clippy::unsafe_derive_deserialize)] #[derive(Copy, Clone, Debug, Serialize, Deserialize)] pub enum EventSlice { Absolute(AbsoluteCapacity), @@ -67,7 +67,7 @@ impl EventSlice { match self { EventSlice::Absolute(AbsoluteCapacity { capacity }) => capacity, EventSlice::Relative(RelativeCapacity { factor }) => { - #[allow( + #[expect( clippy::cast_precision_loss, clippy::cast_sign_loss, clippy::cast_possible_truncation diff --git a/necsim/impls/no-std/src/parallelisation/independent/monolithic/mod.rs b/necsim/impls/no-std/src/parallelisation/independent/monolithic/mod.rs index 6bc67feaa..62cc7015b 100644 --- a/necsim/impls/no-std/src/parallelisation/independent/monolithic/mod.rs +++ b/necsim/impls/no-std/src/parallelisation/independent/monolithic/mod.rs @@ -39,7 +39,7 @@ use reporter::{ WaterLevelReporterConstructor, WaterLevelReporterProxy, WaterLevelReporterStrategy, }; -#[allow(clippy::type_complexity, clippy::too_many_lines)] +#[expect(clippy::type_complexity, clippy::too_many_lines)] pub fn simulate< 'p, M: MathsCore, @@ -118,14 +118,12 @@ pub fn simulate< let mut min_spec_samples = dedup_cache.construct(slow_lineages.len()); let mut total_steps = 0_u64; - #[allow(clippy::or_fun_call)] let mut max_time = slow_lineages .iter() .map(|(lineage, _)| lineage.last_event_time) .max() .unwrap_or(NonNegativeF64::zero()); - #[allow(clippy::or_fun_call)] let mut level_time = slow_lineages .iter() .map(|(lineage, _)| lineage.last_event_time) diff --git a/necsim/impls/no-std/src/parallelisation/independent/monolithic/reporter/live.rs b/necsim/impls/no-std/src/parallelisation/independent/monolithic/reporter/live.rs index 24bb72672..427bb000c 100644 --- a/necsim/impls/no-std/src/parallelisation/independent/monolithic/reporter/live.rs +++ b/necsim/impls/no-std/src/parallelisation/independent/monolithic/reporter/live.rs @@ -12,7 +12,7 @@ use necsim_partitioning_core::LocalPartition; use super::WaterLevelReporterProxy; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct LiveWaterLevelReporterProxy<'l, 'p, R: Reporter, P: LocalPartition<'p, R>> { water_level: NonNegativeF64, slow_events: Vec, diff --git a/necsim/impls/no-std/src/parallelisation/independent/monolithic/reporter/mod.rs b/necsim/impls/no-std/src/parallelisation/independent/monolithic/reporter/mod.rs index 7df56366e..7306e5c99 100644 --- a/necsim/impls/no-std/src/parallelisation/independent/monolithic/reporter/mod.rs +++ b/necsim/impls/no-std/src/parallelisation/independent/monolithic/reporter/mod.rs @@ -10,8 +10,6 @@ use necsim_partitioning_core::LocalPartition; mod live; mod recorded; -#[allow(clippy::inline_always, clippy::inline_fn_without_body)] -#[allow(clippy::no_effect_underscore_binding)] #[contract_trait] pub trait WaterLevelReporterProxy<'l, 'p, R: Reporter, P: LocalPartition<'p, R>>: Sized @@ -32,7 +30,6 @@ pub trait WaterLevelReporterProxy<'l, 'p, R: Reporter, P: LocalPartition<'p, R>> fn local_partition(&mut self) -> &mut P; } -#[allow(clippy::empty_enum)] pub enum WaterLevelReporterStrategy {} pub trait WaterLevelReporterConstructor< diff --git a/necsim/impls/no-std/src/parallelisation/independent/monolithic/reporter/recorded.rs b/necsim/impls/no-std/src/parallelisation/independent/monolithic/reporter/recorded.rs index 455313de5..6c3adb817 100644 --- a/necsim/impls/no-std/src/parallelisation/independent/monolithic/reporter/recorded.rs +++ b/necsim/impls/no-std/src/parallelisation/independent/monolithic/reporter/recorded.rs @@ -7,7 +7,7 @@ use necsim_partitioning_core::LocalPartition; use super::WaterLevelReporterProxy; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct RecordedWaterLevelReporterProxy<'l, 'p, R: Reporter, P: LocalPartition<'p, R>> { water_level: NonNegativeF64, diff --git a/necsim/impls/no-std/src/parallelisation/monolithic/averaging.rs b/necsim/impls/no-std/src/parallelisation/monolithic/averaging.rs index b255c2ab0..ecf123663 100644 --- a/necsim/impls/no-std/src/parallelisation/monolithic/averaging.rs +++ b/necsim/impls/no-std/src/parallelisation/monolithic/averaging.rs @@ -21,7 +21,7 @@ use crate::{ parallelisation::Status, }; -#[allow(clippy::type_complexity)] +#[expect(clippy::type_complexity)] pub fn simulate< 'p, M: MathsCore, diff --git a/necsim/impls/no-std/src/parallelisation/monolithic/lockstep.rs b/necsim/impls/no-std/src/parallelisation/monolithic/lockstep.rs index f1ff75edc..778a1a073 100644 --- a/necsim/impls/no-std/src/parallelisation/monolithic/lockstep.rs +++ b/necsim/impls/no-std/src/parallelisation/monolithic/lockstep.rs @@ -21,7 +21,7 @@ use crate::{ parallelisation::Status, }; -#[allow(clippy::type_complexity)] +#[expect(clippy::type_complexity)] pub fn simulate< 'p, M: MathsCore, diff --git a/necsim/impls/no-std/src/parallelisation/monolithic/mod.rs b/necsim/impls/no-std/src/parallelisation/monolithic/mod.rs index 0cf1900d6..6fba278ae 100644 --- a/necsim/impls/no-std/src/parallelisation/monolithic/mod.rs +++ b/necsim/impls/no-std/src/parallelisation/monolithic/mod.rs @@ -2,7 +2,7 @@ mod reporter; pub mod averaging; pub mod lockstep; -#[allow(clippy::module_inception)] +#[expect(clippy::module_inception)] pub mod monolithic; pub mod optimistic; pub mod optimistic_lockstep; diff --git a/necsim/impls/no-std/src/parallelisation/monolithic/monolithic.rs b/necsim/impls/no-std/src/parallelisation/monolithic/monolithic.rs index 86c1f2418..83cdbf20f 100644 --- a/necsim/impls/no-std/src/parallelisation/monolithic/monolithic.rs +++ b/necsim/impls/no-std/src/parallelisation/monolithic/monolithic.rs @@ -20,7 +20,7 @@ use crate::{ parallelisation::Status, }; -#[allow(clippy::type_complexity)] +#[expect(clippy::type_complexity)] pub fn simulate< 'p, M: MathsCore, diff --git a/necsim/impls/no-std/src/parallelisation/monolithic/optimistic.rs b/necsim/impls/no-std/src/parallelisation/monolithic/optimistic.rs index ee9a55a49..f075f2850 100644 --- a/necsim/impls/no-std/src/parallelisation/monolithic/optimistic.rs +++ b/necsim/impls/no-std/src/parallelisation/monolithic/optimistic.rs @@ -26,7 +26,7 @@ use crate::{ use super::reporter::BufferingReporterProxy; -#[allow(clippy::type_complexity)] +#[expect(clippy::type_complexity)] pub fn simulate< 'p, M: MathsCore, diff --git a/necsim/impls/no-std/src/parallelisation/monolithic/optimistic_lockstep.rs b/necsim/impls/no-std/src/parallelisation/monolithic/optimistic_lockstep.rs index d9cdab94d..5cb1ed6e8 100644 --- a/necsim/impls/no-std/src/parallelisation/monolithic/optimistic_lockstep.rs +++ b/necsim/impls/no-std/src/parallelisation/monolithic/optimistic_lockstep.rs @@ -21,7 +21,7 @@ use crate::{ parallelisation::Status, }; -#[allow(clippy::type_complexity)] +#[expect(clippy::type_complexity)] pub fn simulate< 'p, M: MathsCore, diff --git a/necsim/impls/std/Cargo.toml b/necsim/impls/std/Cargo.toml index da7e73aab..793b40537 100644 --- a/necsim/impls/std/Cargo.toml +++ b/necsim/impls/std/Cargo.toml @@ -19,3 +19,4 @@ bincode = "1.3" serde = { version = "1.0", features = ["derive"] } pcg_rand = { version = "0.13", features = ["u128", "serde1"] } glob = "0.3" +rmp-serde = "1.3" diff --git a/necsim/impls/std/src/cogs/dispersal_sampler/in_memory.rs b/necsim/impls/std/src/cogs/dispersal_sampler/in_memory.rs index 89e101176..98878b6ea 100644 --- a/necsim/impls/std/src/cogs/dispersal_sampler/in_memory.rs +++ b/necsim/impls/std/src/cogs/dispersal_sampler/in_memory.rs @@ -2,7 +2,7 @@ use necsim_impls_no_std::cogs::dispersal_sampler::in_memory::InMemoryDispersalSa use thiserror::Error; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Error, Debug)] #[error("{0}")] pub struct InMemoryDispersalSamplerError(pub InMemoryDispersalSamplerErrorNoStd); diff --git a/necsim/impls/std/src/cogs/rng/pcg.rs b/necsim/impls/std/src/cogs/rng/pcg.rs index 23f5d3d68..bcbdfcee2 100644 --- a/necsim/impls/std/src/cogs/rng/pcg.rs +++ b/necsim/impls/std/src/cogs/rng/pcg.rs @@ -6,7 +6,6 @@ use serde::{Deserialize, Serialize}; use necsim_core::cogs::{MathsCore, RngCore, SplittableRng}; -#[allow(clippy::module_name_repetitions)] #[derive(Serialize, Deserialize)] #[serde(from = "PcgState", into = "PcgState")] pub struct Pcg { @@ -57,7 +56,7 @@ impl RngCore for Pcg { } impl SplittableRng for Pcg { - #[allow(clippy::identity_op)] + #[expect(clippy::identity_op)] fn split(self) -> (Self, Self) { let mut left_state = self.inner.get_state(); left_state.increment = (((left_state.increment >> 1) * 2 + 0) << 1) | 1; diff --git a/necsim/impls/std/src/event_log/mod.rs b/necsim/impls/std/src/event_log/mod.rs index c30da4285..f6c65bc89 100644 --- a/necsim/impls/std/src/event_log/mod.rs +++ b/necsim/impls/std/src/event_log/mod.rs @@ -7,7 +7,7 @@ pub mod recorder; pub mod replay; #[derive(Serialize, Deserialize, PartialEq)] -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct EventLogHeader { min_time: PositiveF64, max_time: PositiveF64, diff --git a/necsim/impls/std/src/event_log/recorder.rs b/necsim/impls/std/src/event_log/recorder.rs index 4fa7f8d12..7aef8285a 100644 --- a/necsim/impls/std/src/event_log/recorder.rs +++ b/necsim/impls/std/src/event_log/recorder.rs @@ -32,7 +32,7 @@ use necsim_core::event::{DispersalEvent, PackedEvent, SpeciationEvent}; use super::EventLogHeader; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct EventLogRecorder { segment_capacity: NonZeroUsize, directory: PathBuf, @@ -224,7 +224,7 @@ impl fmt::Debug for EventLogRecorder { } } -#[allow(clippy::unsafe_derive_deserialize)] +#[expect(clippy::unsafe_derive_deserialize)] #[derive(Debug, Deserialize)] #[serde(try_from = "EventLogRecorderRaw")] pub struct EventLogConfig { diff --git a/necsim/impls/std/src/event_log/replay/globbed.rs b/necsim/impls/std/src/event_log/replay/globbed.rs index 740640804..aa41f5284 100644 --- a/necsim/impls/std/src/event_log/replay/globbed.rs +++ b/necsim/impls/std/src/event_log/replay/globbed.rs @@ -5,7 +5,7 @@ use serde::{Deserialize, Deserializer}; use super::segment::SortedSegment; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct GlobbedSortedSegments { segments: Vec, } diff --git a/necsim/impls/std/src/event_log/replay/mod.rs b/necsim/impls/std/src/event_log/replay/mod.rs index bc6a342a6..2a7410c47 100644 --- a/necsim/impls/std/src/event_log/replay/mod.rs +++ b/necsim/impls/std/src/event_log/replay/mod.rs @@ -14,7 +14,7 @@ use globbed::GlobbedSortedSegments; use segment::SortedSegment; use sorted_segments::SortedSortedSegments; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug, Deserialize)] #[serde(try_from = "EventLogReplayRaw")] pub struct EventLogReplay { diff --git a/necsim/impls/std/src/event_log/replay/segment.rs b/necsim/impls/std/src/event_log/replay/segment.rs index d63238a9f..b9543f1fe 100644 --- a/necsim/impls/std/src/event_log/replay/segment.rs +++ b/necsim/impls/std/src/event_log/replay/segment.rs @@ -14,7 +14,7 @@ use necsim_core::event::PackedEvent; use crate::event_log::EventLogHeader; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct SortedSegment { path: PathBuf, header: EventLogHeader, diff --git a/necsim/impls/std/src/event_log/replay/sorted_segments.rs b/necsim/impls/std/src/event_log/replay/sorted_segments.rs index 57c18b6e9..8206d6fda 100644 --- a/necsim/impls/std/src/event_log/replay/sorted_segments.rs +++ b/necsim/impls/std/src/event_log/replay/sorted_segments.rs @@ -7,7 +7,7 @@ use necsim_core::event::PackedEvent; use super::segment::SortedSegment; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct SortedSortedSegments { segments: Vec, next: Option, @@ -101,7 +101,6 @@ impl PartialOrd for SortedSortedSegments { } impl PartialEq for SortedSortedSegments { - #[allow(clippy::unconditional_recursion)] fn eq(&self, other: &Self) -> bool { self.next.eq(&other.next) } diff --git a/necsim/impls/std/src/lineage_file/loader.rs b/necsim/impls/std/src/lineage_file/loader.rs index fa239039e..dbc0612d6 100644 --- a/necsim/impls/std/src/lineage_file/loader.rs +++ b/necsim/impls/std/src/lineage_file/loader.rs @@ -11,7 +11,7 @@ use necsim_core::lineage::Lineage; #[derive(Debug, Deserialize, Clone)] #[serde(try_from = "LineageFileLoaderRaw")] -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct LineageFileLoader { lineages: Vec, path: PathBuf, @@ -33,8 +33,8 @@ impl LineageFileLoader { pub fn try_new(path: &Path) -> anyhow::Result { let file = OpenOptions::new().read(true).write(false).open(path)?; - let mut deserializer = - bincode::Deserializer::with_reader(BufReader::new(file), bincode::options()); + let mut deserializer = rmp_serde::Deserializer::new(BufReader::new(file)); + // bincode::Deserializer::with_reader(BufReader::new(file), bincode::options()); let lineages = >::deserialize(&mut deserializer)?; diff --git a/necsim/impls/std/src/lineage_file/saver.rs b/necsim/impls/std/src/lineage_file/saver.rs index 31b0f6f39..8139407d2 100644 --- a/necsim/impls/std/src/lineage_file/saver.rs +++ b/necsim/impls/std/src/lineage_file/saver.rs @@ -12,7 +12,7 @@ use necsim_core::lineage::Lineage; #[derive(Deserialize)] #[serde(try_from = "LineageFileSaverRaw")] -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct LineageFileSaver { file: File, path: PathBuf, @@ -67,8 +67,8 @@ impl LineageFileSaver { /// /// Fails if a the lineages could not be written to the file at `path` pub fn write<'a, I: Iterator>(mut self, lineages: I) -> anyhow::Result<()> { - let mut serializer = - bincode::Serializer::new(BufWriter::new(&mut self.file), bincode::options()); + let mut serializer = rmp_serde::Serializer::new(BufWriter::new(&mut self.file)); + // bincode::Serializer::new(BufWriter::new(&mut self.file), bincode::options()); serializer.collect_seq(lineages)?; diff --git a/necsim/partitioning/core/src/iterator.rs b/necsim/partitioning/core/src/iterator.rs index a4a97c7d8..ab61db17e 100644 --- a/necsim/partitioning/core/src/iterator.rs +++ b/necsim/partitioning/core/src/iterator.rs @@ -2,7 +2,7 @@ use alloc::vec::Vec; use necsim_core::lineage::MigratingLineage; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct ImmigrantPopIterator<'i> { immigrants: &'i mut Vec, } diff --git a/necsim/partitioning/core/src/lib.rs b/necsim/partitioning/core/src/lib.rs index 6671d24ea..71f68d67a 100644 --- a/necsim/partitioning/core/src/lib.rs +++ b/necsim/partitioning/core/src/lib.rs @@ -25,7 +25,7 @@ pub trait Partitioning: Sized { fn get_size(&self) -> PartitionSize; - #[allow(clippy::missing_errors_doc)] + #[expect(clippy::missing_errors_doc)] fn with_local_partition< R: Reporter, P: ReporterContext, @@ -74,7 +74,7 @@ pub trait LocalPartition<'p, R: Reporter>: Sized { fn reduce_vote_any(&mut self, vote: bool) -> bool; - #[allow(clippy::missing_errors_doc)] + #[expect(clippy::missing_errors_doc)] fn reduce_vote_min_time(&mut self, local_time: PositiveF64) -> Result; diff --git a/necsim/partitioning/core/src/partition.rs b/necsim/partitioning/core/src/partition.rs index eb7482438..25097dbb1 100644 --- a/necsim/partitioning/core/src/partition.rs +++ b/necsim/partitioning/core/src/partition.rs @@ -3,7 +3,7 @@ use core::{convert::TryFrom, fmt, num::NonZeroU32}; use serde::{Deserialize, Serialize}; #[derive(Debug)] -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct PartitionRankOutOfBounds(u32, u32); impl fmt::Display for PartitionRankOutOfBounds { @@ -16,7 +16,7 @@ impl fmt::Display for PartitionRankOutOfBounds { } } -#[allow(clippy::module_name_repetitions, clippy::unsafe_derive_deserialize)] +#[expect(clippy::unsafe_derive_deserialize)] #[derive(Copy, Clone, Debug, Serialize, Deserialize)] #[serde(try_from = "PartitionRaw")] pub struct Partition { @@ -90,8 +90,8 @@ struct PartitionRaw { size: PartitionSize, } -#[allow(clippy::module_name_repetitions)] -#[allow(clippy::unsafe_derive_deserialize)] +#[expect(clippy::module_name_repetitions)] +#[expect(clippy::unsafe_derive_deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)] #[serde(transparent)] pub struct PartitionSize(pub NonZeroU32); diff --git a/necsim/partitioning/core/src/reporter.rs b/necsim/partitioning/core/src/reporter.rs index 3ad1411fb..a7124669a 100644 --- a/necsim/partitioning/core/src/reporter.rs +++ b/necsim/partitioning/core/src/reporter.rs @@ -1,6 +1,6 @@ use necsim_core::reporter::{boolean::Boolean, FilteredReporter, Reporter}; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub trait ReporterContext: core::fmt::Debug { type Reporter: Reporter; @@ -12,12 +12,12 @@ pub trait ReporterContext: core::fmt::Debug { ) -> anyhow::Result>; } -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub trait FinalisableReporter { fn finalise(self); } -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct OpaqueFinalisableReporter { reporter: R, } diff --git a/necsim/partitioning/monolithic/src/lib.rs b/necsim/partitioning/monolithic/src/lib.rs index 3511c3979..597aa5c56 100644 --- a/necsim/partitioning/monolithic/src/lib.rs +++ b/necsim/partitioning/monolithic/src/lib.rs @@ -26,7 +26,6 @@ use necsim_impls_std::event_log::recorder::EventLogConfig; pub mod live; pub mod recorded; -#[allow(clippy::module_name_repetitions)] #[derive(Default)] pub struct MonolithicPartitioning(()); @@ -88,7 +87,6 @@ impl Partitioning for MonolithicPartitioning { } } -#[allow(clippy::module_name_repetitions)] #[derive(Debug)] pub enum MonolithicLocalPartition { Live(Box>), diff --git a/necsim/partitioning/monolithic/src/live.rs b/necsim/partitioning/monolithic/src/live.rs index 3d9337065..0ed914d96 100644 --- a/necsim/partitioning/monolithic/src/live.rs +++ b/necsim/partitioning/monolithic/src/live.rs @@ -10,7 +10,7 @@ use necsim_partitioning_core::{ iterator::ImmigrantPopIterator, partition::Partition, LocalPartition, MigrationMode, }; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct LiveMonolithicLocalPartition { reporter: FilteredReporter, loopback: Vec, diff --git a/necsim/partitioning/monolithic/src/recorded.rs b/necsim/partitioning/monolithic/src/recorded.rs index 7ece1c10b..33580c3a3 100644 --- a/necsim/partitioning/monolithic/src/recorded.rs +++ b/necsim/partitioning/monolithic/src/recorded.rs @@ -18,7 +18,7 @@ use necsim_partitioning_core::{ iterator::ImmigrantPopIterator, partition::Partition, LocalPartition, MigrationMode, }; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct RecordedMonolithicLocalPartition { reporter: FilteredReporter, recorder: EventLogRecorder, diff --git a/necsim/partitioning/mpi/build.rs b/necsim/partitioning/mpi/build.rs index d2bf279f8..028640e8f 100644 --- a/necsim/partitioning/mpi/build.rs +++ b/necsim/partitioning/mpi/build.rs @@ -7,4 +7,6 @@ fn main() { if is_msmpi { println!("cargo:rustc-cfg=msmpi"); } + + println!("cargo::rustc-check-cfg=cfg(msmpi)"); } diff --git a/necsim/partitioning/mpi/src/lib.rs b/necsim/partitioning/mpi/src/lib.rs index 9e9234eb2..c699483cf 100644 --- a/necsim/partitioning/mpi/src/lib.rs +++ b/necsim/partitioning/mpi/src/lib.rs @@ -170,7 +170,7 @@ impl Partitioning for MpiPartitioning { type LocalPartition<'p, R: Reporter> = MpiLocalPartition<'p, R>; fn get_size(&self) -> PartitionSize { - #[allow(clippy::cast_sign_loss)] + #[expect(clippy::cast_sign_loss)] let size = unsafe { NonZeroU32::new_unchecked(self.world.size() as u32) }; PartitionSize(size) @@ -206,7 +206,7 @@ impl Partitioning for MpiPartitioning { let mut mpi_local_global_wait = (false, false); let mut mpi_local_remaining = 0_u64; - #[allow(clippy::cast_sign_loss)] + #[expect(clippy::cast_sign_loss)] let world_size = self.world.size() as usize; let mut mpi_emigration_buffers: Vec> = Vec::with_capacity(world_size); @@ -259,7 +259,6 @@ impl Partitioning for MpiPartitioning { #[serde(deny_unknown_fields)] #[serde(deserialize_state = "PartitionSize")] #[serde(default)] -#[allow(dead_code)] struct MpiPartitioningRaw { #[serde(deserialize_state_with = "deserialize_state_mpi_world")] world: Option, @@ -307,7 +306,7 @@ fn reduce_partitioning_data( let local_ser_len = Count::try_from(local_ser.len()) .context("MPI local partition result is too big to share")?; - #[allow(clippy::cast_sign_loss)] + #[expect(clippy::cast_sign_loss)] let mut counts = vec![0 as Count; world.size() as usize]; world.all_gather_into(&local_ser_len, &mut counts); @@ -326,7 +325,7 @@ fn reduce_partitioning_data( }) .collect::, _>>()?; - #[allow(clippy::cast_sign_loss)] + #[expect(clippy::cast_sign_loss)] let mut all_sers = vec![0_u8; counts.iter().copied().sum::() as usize]; world.all_gather_varcount_into( local_ser.as_slice(), @@ -337,7 +336,7 @@ fn reduce_partitioning_data( .iter() .scan(0_usize, |acc, &x| { let pre = *acc; - #[allow(clippy::cast_sign_loss)] + #[expect(clippy::cast_sign_loss)] { *acc += x as usize; } diff --git a/necsim/partitioning/mpi/src/partition/common.rs b/necsim/partitioning/mpi/src/partition/common.rs index 45691f175..0d2596e85 100644 --- a/necsim/partitioning/mpi/src/partition/common.rs +++ b/necsim/partitioning/mpi/src/partition/common.rs @@ -51,7 +51,7 @@ impl<'p> MpiCommonPartition<'p> { ) -> Self { let world = universe.world(); - #[allow(clippy::cast_sign_loss)] + #[expect(clippy::cast_sign_loss)] let world_size = world.size() as usize; let mut migration_buffers = Vec::with_capacity(world_size); @@ -83,9 +83,9 @@ impl<'p> MpiCommonPartition<'p> { #[must_use] pub fn get_partition(&self) -> Partition { - #[allow(clippy::cast_sign_loss)] + #[expect(clippy::cast_sign_loss)] let rank = self.world.rank() as u32; - #[allow(clippy::cast_sign_loss)] + #[expect(clippy::cast_sign_loss)] let size = unsafe { NonZeroU32::new_unchecked(self.world.size() as u32) }; unsafe { Partition::new_unchecked(rank, PartitionSize(size)) } @@ -128,7 +128,7 @@ impl<'p> MpiCommonPartition<'p> { while let Some((msg, status)) = any_process.immediate_matched_probe_with_tag(MpiPartitioning::MPI_MIGRATION_TAG) { - #[allow(clippy::cast_sign_loss)] + #[expect(clippy::cast_sign_loss)] let number_immigrants = status.count(MpiMigratingLineage::equivalent_datatype()) as usize; @@ -175,7 +175,7 @@ impl<'p> MpiCommonPartition<'p> { let emigration_buffer = &mut self.migration_buffers[rank_index]; if !emigration_buffer.is_empty() { - #[allow(clippy::cast_possible_wrap)] + #[expect(clippy::cast_possible_wrap)] let receiver_process = self.world.process_at_rank(partition.rank() as i32); let mut last_migration_time = self.last_migration_times[rank_index]; @@ -240,7 +240,7 @@ impl<'p> MpiCommonPartition<'p> { #[must_use] pub fn wait_for_termination(&mut self) -> ControlFlow<(), ()> { // This partition can only terminate once all migrations have been processed - for buffer in self.migration_buffers.iter() { + for buffer in &self.migration_buffers { if !buffer.is_empty() { return ControlFlow::Continue(()); } @@ -248,7 +248,7 @@ impl<'p> MpiCommonPartition<'p> { // This partition can only terminate if all emigrations have been // sent and acknowledged (request finished + empty buffers) - for buffer in self.mpi_emigration_buffers.iter() { + for buffer in &self.mpi_emigration_buffers { if !buffer.get_data().map_or(false, Vec::is_empty) { return ControlFlow::Continue(()); } diff --git a/necsim/partitioning/mpi/src/partition/mod.rs b/necsim/partitioning/mpi/src/partition/mod.rs index 2cc9a80c9..362ac6d1d 100644 --- a/necsim/partitioning/mpi/src/partition/mod.rs +++ b/necsim/partitioning/mpi/src/partition/mod.rs @@ -16,14 +16,14 @@ mod parallel; mod root; mod utils; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub use parallel::MpiParallelPartition; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub use root::MpiRootPartition; use crate::FinalisableMpiReporter; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug)] pub enum MpiLocalPartition<'p, R: Reporter> { Root(Box>), diff --git a/necsim/partitioning/mpi/src/partition/root.rs b/necsim/partitioning/mpi/src/partition/root.rs index 7153c28ac..7c80b56b8 100644 --- a/necsim/partitioning/mpi/src/partition/root.rs +++ b/necsim/partitioning/mpi/src/partition/root.rs @@ -176,7 +176,7 @@ impl<'p, R: Reporter> Reporter for MpiRootPartition<'p, R> { { let remaining_status: (u64, _) = msg.matched_receive(); - #[allow(clippy::cast_sign_loss)] + #[expect(clippy::cast_sign_loss)] { self.all_remaining[remaining_status.1.source_rank() as usize] = remaining_status.0; } } diff --git a/necsim/partitioning/mpi/src/partition/utils.rs b/necsim/partitioning/mpi/src/partition/utils.rs index ef1400166..1f671ac00 100644 --- a/necsim/partitioning/mpi/src/partition/utils.rs +++ b/necsim/partitioning/mpi/src/partition/utils.rs @@ -115,7 +115,7 @@ impl MpiMigratingLineage { unsafe impl Equivalence for MpiMigratingLineage { type Out = UserDatatype; - #[allow(clippy::cast_possible_wrap)] + #[expect(clippy::cast_possible_wrap)] fn equivalent_datatype() -> Self::Out { // Ensure compilation breaks if a new field is added let MigratingLineage { diff --git a/necsim/partitioning/mpi/src/request.rs b/necsim/partitioning/mpi/src/request.rs index d95f1d8b9..ffeedc24c 100644 --- a/necsim/partitioning/mpi/src/request.rs +++ b/necsim/partitioning/mpi/src/request.rs @@ -1,6 +1,6 @@ use mpi::request::{CancelGuard, LocalScope, Request}; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct DataOrRequest<'a, T: ?Sized, R: ?Sized> { value: &'a mut T, scope: &'a LocalScope<'a>, diff --git a/necsim/partitioning/threads/Cargo.toml b/necsim/partitioning/threads/Cargo.toml index ce161b3b2..ec3b97db1 100644 --- a/necsim/partitioning/threads/Cargo.toml +++ b/necsim/partitioning/threads/Cargo.toml @@ -17,4 +17,4 @@ thiserror = "1.0" anyhow = "1.0" serde = "1.0" humantime-serde = "1.1" -bit-set = "0.5" +bit-set = "0.8" diff --git a/necsim/partitioning/threads/src/lib.rs b/necsim/partitioning/threads/src/lib.rs index 256b13f13..cbd8d85e0 100644 --- a/necsim/partitioning/threads/src/lib.rs +++ b/necsim/partitioning/threads/src/lib.rs @@ -136,7 +136,7 @@ impl Partitioning for ThreadsPartitioning { self.num_threads } - #[allow(clippy::too_many_lines)] + #[expect(clippy::too_many_lines)] /// # Errors /// /// Returns `MissingEventLog` if the local partition is non-monolithic and diff --git a/necsim/partitioning/threads/src/partition.rs b/necsim/partitioning/threads/src/partition.rs index fc8901c87..8d530d7ab 100644 --- a/necsim/partitioning/threads/src/partition.rs +++ b/necsim/partitioning/threads/src/partition.rs @@ -25,7 +25,7 @@ use necsim_partitioning_core::{partition::Partition, LocalPartition, MigrationMo use crate::vote::{AsyncVote, Vote}; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct ThreadsLocalPartition { partition: Partition, vote_any: Vote, @@ -54,7 +54,7 @@ impl fmt::Debug for ThreadsLocalPartition { } impl ThreadsLocalPartition { - #[allow(clippy::too_many_arguments)] + #[expect(clippy::too_many_arguments)] #[must_use] pub(crate) fn new( partition: Partition, @@ -220,7 +220,7 @@ impl<'p, R: Reporter> LocalPartition<'p, R> for ThreadsLocalPartition { let mut local_wait = ControlFlow::Break(()); // This partition can only terminate once all emigrations have been processed - for buffer in self.emigration_buffers.iter() { + for buffer in &self.emigration_buffers { if !buffer.is_empty() { local_wait = ControlFlow::Continue(()); break; diff --git a/necsim/partitioning/threads/src/vote.rs b/necsim/partitioning/threads/src/vote.rs index e6174b567..3c142a823 100644 --- a/necsim/partitioning/threads/src/vote.rs +++ b/necsim/partitioning/threads/src/vote.rs @@ -71,7 +71,7 @@ impl Vote { } } -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Clone)] pub struct AsyncVote { shared: Arc>, @@ -91,7 +91,7 @@ struct AsyncGenerationalData { } impl AsyncVote { - #[allow(dead_code)] + #[expect(dead_code)] // FIXME #[must_use] pub fn new(n: usize) -> Self where diff --git a/necsim/plugins/common/src/biodiversity.rs b/necsim/plugins/common/src/biodiversity.rs index 8c9379829..574c54ef8 100644 --- a/necsim/plugins/common/src/biodiversity.rs +++ b/necsim/plugins/common/src/biodiversity.rs @@ -2,7 +2,7 @@ use std::fmt; use necsim_core::{event::SpeciationEvent, impl_finalise, impl_report, reporter::Reporter}; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct BiodiversityReporter { last_event: Option, diff --git a/necsim/plugins/common/src/event_counter.rs b/necsim/plugins/common/src/event_counter.rs index a65901ce4..00334ec27 100644 --- a/necsim/plugins/common/src/event_counter.rs +++ b/necsim/plugins/common/src/event_counter.rs @@ -8,7 +8,7 @@ use necsim_core::{ }; use necsim_core_bond::NonNegativeF64; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Default)] pub struct EventCounterReporter { last_parent_prior_time: Option, diff --git a/necsim/plugins/common/src/execution_time.rs b/necsim/plugins/common/src/execution_time.rs index 5c98930fa..71067c1c1 100644 --- a/necsim/plugins/common/src/execution_time.rs +++ b/necsim/plugins/common/src/execution_time.rs @@ -2,7 +2,7 @@ use std::{fmt, time::Instant}; use necsim_core::{impl_finalise, impl_report, reporter::Reporter}; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct ExecutionTimeReporter { init_time: Instant, start_time: Option, diff --git a/necsim/plugins/common/src/progress.rs b/necsim/plugins/common/src/progress.rs index a5a55c19f..f2d768e9a 100644 --- a/necsim/plugins/common/src/progress.rs +++ b/necsim/plugins/common/src/progress.rs @@ -17,7 +17,7 @@ struct ProgressUpdater { sender: Sender<()>, } -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct ProgressReporter { updater: Option, last_remaining: Arc, @@ -141,7 +141,7 @@ impl Default for ProgressReporter { fn display_progress(total: u64, remaining: u64) { const UPDATE_PRECISION: usize = 50; - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_possible_truncation)] let display_progress = ((total - remaining) * (UPDATE_PRECISION as u64) / total.max(1)) as usize; diff --git a/necsim/plugins/common/src/verbose.rs b/necsim/plugins/common/src/verbose.rs index 0cda89a10..08049d255 100644 --- a/necsim/plugins/common/src/verbose.rs +++ b/necsim/plugins/common/src/verbose.rs @@ -2,7 +2,7 @@ use std::fmt; use necsim_core::{impl_report, reporter::Reporter}; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Default)] pub struct VerboseReporter(()); diff --git a/necsim/plugins/core/src/export.rs b/necsim/plugins/core/src/export.rs index 2a0a80ab9..a1f6400d5 100644 --- a/necsim/plugins/core/src/export.rs +++ b/necsim/plugins/core/src/export.rs @@ -13,25 +13,24 @@ pub struct ReporterPluginDeclaration { pub rustc_version: &'static str, pub core_version: &'static str, - #[allow(improper_ctypes_definitions)] + #[expect(improper_ctypes_definitions)] pub init: unsafe extern "C" fn(&'static dyn log::Log, log::LevelFilter), - #[allow(improper_ctypes_definitions)] + #[expect(improper_ctypes_definitions)] pub deserialise: unsafe extern "C" fn( &mut dyn erased_serde::Deserializer, ) -> Result, erased_serde::Error>, - #[allow(improper_ctypes_definitions)] + #[expect(improper_ctypes_definitions)] pub library_path: unsafe extern "C" fn() -> Option<::std::path::PathBuf>, - #[allow(improper_ctypes_definitions)] + #[expect(improper_ctypes_definitions)] pub drop: unsafe extern "C" fn(ManuallyDrop), } #[derive(Copy, Clone)] -#[allow(dead_code)] pub struct ReporterPluginFilter { pub(crate) report_speciation: bool, pub(crate) report_dispersal: bool, @@ -96,7 +95,7 @@ impl From for UnsafeReporterPlugin { } #[macro_export] -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] macro_rules! export_plugin { ($($name:ident => $plugin:ty),+$(,)?) => { #[doc(hidden)] @@ -116,7 +115,7 @@ macro_rules! export_plugin { ::std::mem::ManuallyDrop<$crate::export::UnsafeReporterPlugin>, $crate::erased_serde::Error, > { - #[allow(clippy::enum_variant_names)] + #[expect(clippy::enum_variant_names)] #[derive($crate::serde::Deserialize)] #[serde(crate = "::necsim_plugins_core::serde")] enum Reporters { diff --git a/necsim/plugins/core/src/import/combinator.rs b/necsim/plugins/core/src/import/combinator.rs index a99fb5784..b5bed0df7 100644 --- a/necsim/plugins/core/src/import/combinator.rs +++ b/necsim/plugins/core/src/import/combinator.rs @@ -83,7 +83,7 @@ impl { impl_report!(speciation(&mut self, speciation: MaybeUsed) { - for plugin in self.plugins.iter_mut() { + for plugin in &mut self.plugins { if plugin.filter.report_speciation { plugin.reporter.report_speciation(speciation.into()); } @@ -91,7 +91,7 @@ impl) { - for plugin in self.plugins.iter_mut() { + for plugin in &mut self.plugins { if plugin.filter.report_dispersal { plugin.reporter.report_dispersal(dispersal.into()); } @@ -99,7 +99,7 @@ impl) { - for plugin in self.plugins.iter_mut() { + for plugin in &mut self.plugins { if plugin.filter.report_progress { plugin.reporter.report_progress(progress.into()); } @@ -113,7 +113,7 @@ impl Result<(), String> { - for plugin in self.plugins.iter_mut() { + for plugin in &mut self.plugins { plugin.reporter.initialise()?; } diff --git a/necsim/plugins/core/src/import/plugin.rs b/necsim/plugins/core/src/import/plugin.rs index 116a5be51..a7eaae5fa 100644 --- a/necsim/plugins/core/src/import/plugin.rs +++ b/necsim/plugins/core/src/import/plugin.rs @@ -5,7 +5,7 @@ use crate::{ import::serde::PluginLibrary, }; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct ReporterPlugin { pub(crate) library: Rc, diff --git a/necsim/plugins/csv/src/lib.rs b/necsim/plugins/csv/src/lib.rs index a459560f2..36bc77039 100644 --- a/necsim/plugins/csv/src/lib.rs +++ b/necsim/plugins/csv/src/lib.rs @@ -17,7 +17,6 @@ use necsim_core::{ necsim_plugins_core::export_plugin!(Csv => CsvReporter); -#[allow(clippy::module_name_repetitions)] #[derive(Deserialize)] #[serde(try_from = "CsvReporterArgs")] pub struct CsvReporter { diff --git a/necsim/plugins/metacommunity/src/lib.rs b/necsim/plugins/metacommunity/src/lib.rs index 880161551..ebb8edf3b 100644 --- a/necsim/plugins/metacommunity/src/lib.rs +++ b/necsim/plugins/metacommunity/src/lib.rs @@ -13,7 +13,6 @@ use necsim_core::{event::SpeciationEvent, impl_finalise, impl_report, reporter:: necsim_plugins_core::export_plugin!(Metacommunity => MetacommunityMigrationReporter); -#[allow(clippy::module_name_repetitions)] #[derive(Deserialize)] #[serde(from = "MetacommunityMigrationReporterArgs")] pub struct MetacommunityMigrationReporter { diff --git a/necsim/plugins/species/Cargo.toml b/necsim/plugins/species/Cargo.toml index 813ca7036..1c7e62a47 100644 --- a/necsim/plugins/species/Cargo.toml +++ b/necsim/plugins/species/Cargo.toml @@ -17,7 +17,7 @@ necsim-plugins-core = { path = "../core", features = ["export"] } serde = { version = "1.0", features = ["derive"] } log = { version = "0.4" } -rusqlite = "0.31" +rusqlite = "0.32" fnv = "1.0" base32 = "0.5" hex = "0.4" diff --git a/necsim/plugins/species/src/identity.rs b/necsim/plugins/species/src/identity.rs index d6aa2b7bc..7636fa182 100644 --- a/necsim/plugins/species/src/identity.rs +++ b/necsim/plugins/species/src/identity.rs @@ -10,7 +10,7 @@ use necsim_core::{ }; use necsim_core_bond::PositiveF64; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] #[repr(transparent)] pub struct SpeciesIdentity([u8; 24]); @@ -57,7 +57,7 @@ impl SpeciesIdentity { Self::from_raw(lineage, marker, anchor) } - #[allow(dead_code)] + #[cfg_attr(not(test), expect(dead_code))] pub fn try_into_speciation(self) -> Result<(IndexedLocation, PositiveF64), Self> { let (location, index, time) = self.copy_into_raw(); @@ -67,10 +67,10 @@ impl SpeciesIdentity { return Err(self); } - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_possible_truncation)] let x = (location & u64::from(u32::MAX)) as u32; let y = ((location >> 32) & u64::from(u32::MAX)) as u32; - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_possible_truncation)] let i = ((index >> 16) & u64::from(u32::MAX)) as u32; let origin = IndexedLocation::new(Location::new(x, y), i); diff --git a/necsim/plugins/species/src/individual/feather/mod.rs b/necsim/plugins/species/src/individual/feather/mod.rs index 636196d8a..3cb45e704 100644 --- a/necsim/plugins/species/src/individual/feather/mod.rs +++ b/necsim/plugins/species/src/individual/feather/mod.rs @@ -19,7 +19,6 @@ use crate::{LastEventState, SpeciesIdentity}; mod dataframe; mod reporter; -#[allow(clippy::module_name_repetitions)] pub struct IndividualSpeciesFeatherReporter { last_parent_prior_time: Option<(GlobalLineageReference, NonNegativeF64)>, last_speciation_event: Option, @@ -64,7 +63,7 @@ impl serde::Serialize for IndividualSpeciesFeatherReporter { } } -#[allow(clippy::too_many_lines)] +#[expect(clippy::too_many_lines)] impl<'de> Deserialize<'de> for IndividualSpeciesFeatherReporter { fn deserialize>(deserializer: D) -> Result { let args = IndividualSpeciesFeatherReporterArgs::deserialize(deserializer)?; diff --git a/necsim/plugins/species/src/individual/sqlite/database.rs b/necsim/plugins/species/src/individual/sqlite/database.rs index d472111eb..d512083a3 100644 --- a/necsim/plugins/species/src/individual/sqlite/database.rs +++ b/necsim/plugins/species/src/individual/sqlite/database.rs @@ -64,7 +64,7 @@ impl IndividualSpeciesSQLiteReporter { } } - #[allow(clippy::too_many_lines)] + #[expect(clippy::too_many_lines)] pub(super) fn initialise_sqlite_connection(&mut self) -> rusqlite::Result<()> { self.connection .pragma_update(None, "cache_size", self.cache.get())?; diff --git a/necsim/plugins/species/src/individual/sqlite/mod.rs b/necsim/plugins/species/src/individual/sqlite/mod.rs index de16b552b..11b7eada5 100644 --- a/necsim/plugins/species/src/individual/sqlite/mod.rs +++ b/necsim/plugins/species/src/individual/sqlite/mod.rs @@ -16,7 +16,6 @@ use crate::SpeciesIdentity; mod database; mod reporter; -#[allow(clippy::module_name_repetitions)] pub struct IndividualSpeciesSQLiteReporter { last_parent_prior_time: Option<(GlobalLineageReference, NonNegativeF64)>, last_speciation_event: Option, diff --git a/necsim/plugins/species/src/location/feather/dataframe.rs b/necsim/plugins/species/src/location/feather/dataframe.rs index 653472f6d..c028ad1fc 100644 --- a/necsim/plugins/species/src/location/feather/dataframe.rs +++ b/necsim/plugins/species/src/location/feather/dataframe.rs @@ -74,7 +74,7 @@ impl LocationSpeciesFeatherReporter { } } - #[allow(clippy::too_many_lines)] + #[expect(clippy::too_many_lines)] pub(super) fn output_to_dataframe(mut self) -> arrow2::error::Result<()> { let file = File::options() .write(true) diff --git a/necsim/plugins/species/src/location/feather/mod.rs b/necsim/plugins/species/src/location/feather/mod.rs index 106c4f37f..a794eaae5 100644 --- a/necsim/plugins/species/src/location/feather/mod.rs +++ b/necsim/plugins/species/src/location/feather/mod.rs @@ -19,7 +19,6 @@ use crate::{LastEventState, SpeciesIdentity}; mod dataframe; mod reporter; -#[allow(clippy::module_name_repetitions)] pub struct LocationSpeciesFeatherReporter { last_parent_prior_time: Option<(GlobalLineageReference, NonNegativeF64)>, last_speciation_event: Option, @@ -78,7 +77,7 @@ impl serde::Serialize for LocationSpeciesFeatherReporter { } } -#[allow(clippy::too_many_lines)] +#[expect(clippy::too_many_lines)] impl<'de> Deserialize<'de> for LocationSpeciesFeatherReporter { fn deserialize>(deserializer: D) -> Result { let args = LocationSpeciesFeatherReporterArgs::deserialize(deserializer)?; diff --git a/necsim/plugins/species/src/state.rs b/necsim/plugins/species/src/state.rs index 08c7fa185..945ca6005 100644 --- a/necsim/plugins/species/src/state.rs +++ b/necsim/plugins/species/src/state.rs @@ -7,7 +7,7 @@ use necsim_core::{ }; use necsim_core_bond::NonNegativeF64; -#[allow(clippy::module_name_repetitions, clippy::struct_field_names)] +#[expect(clippy::module_name_repetitions, clippy::struct_field_names)] #[derive(Serialize, Deserialize)] pub struct LastEventState { pub last_parent_prior_time: Option<(GlobalLineageReference, NonNegativeF64)>, diff --git a/necsim/plugins/statistics/src/coverage.rs b/necsim/plugins/statistics/src/coverage.rs index b40bbca5d..eaa42b02b 100644 --- a/necsim/plugins/statistics/src/coverage.rs +++ b/necsim/plugins/statistics/src/coverage.rs @@ -10,7 +10,6 @@ use serde::{Deserialize, Serialize}; use necsim_core::{event::DispersalEvent, impl_finalise, impl_report, reporter::Reporter}; -#[allow(clippy::module_name_repetitions)] #[derive(Deserialize)] #[serde(try_from = "GlobalCoverageReporterArgs")] pub struct GlobalCoverageReporter { diff --git a/necsim/plugins/statistics/src/speciation.rs b/necsim/plugins/statistics/src/speciation.rs index e2c7fc9ff..aa412e71b 100644 --- a/necsim/plugins/statistics/src/speciation.rs +++ b/necsim/plugins/statistics/src/speciation.rs @@ -10,7 +10,6 @@ use serde::{Deserialize, Serialize}; use necsim_core::{event::SpeciationEvent, impl_finalise, impl_report, reporter::Reporter}; -#[allow(clippy::module_name_repetitions)] #[derive(Deserialize)] #[serde(try_from = "GlobalSpeciationReporterArgs")] pub struct GlobalSpeciationReporter { diff --git a/necsim/plugins/statistics/src/turnover.rs b/necsim/plugins/statistics/src/turnover.rs index 9d6cd106d..7d88cff07 100644 --- a/necsim/plugins/statistics/src/turnover.rs +++ b/necsim/plugins/statistics/src/turnover.rs @@ -14,7 +14,6 @@ use necsim_core::{ reporter::Reporter, }; -#[allow(clippy::module_name_repetitions)] #[derive(Deserialize)] #[serde(try_from = "GlobalTurnoverReporterArgs")] pub struct GlobalTurnoverReporter { diff --git a/necsim/plugins/tskit/build.rs b/necsim/plugins/tskit/build.rs index 3833ff792..1cd713ac6 100644 --- a/necsim/plugins/tskit/build.rs +++ b/necsim/plugins/tskit/build.rs @@ -19,14 +19,7 @@ use semver::{{BuildMetadata, Prerelease}};\n" writeln!( file, - "#[allow(dead_code)] -/// Returns the `rustc` `SemVer` version. -pub fn version() -> Version {{ - version_meta().semver -}} - -#[allow(dead_code)] -/// Returns the `rustc` `SemVer` version and additional metadata + "/// Returns the `rustc` `SemVer` version and additional metadata /// like the git short hash and build date. pub fn version_meta() -> VersionMeta {{ VersionMeta {{ diff --git a/necsim/plugins/tskit/src/provenance.rs b/necsim/plugins/tskit/src/provenance.rs index fbabdf27b..b40dd3cb7 100644 --- a/necsim/plugins/tskit/src/provenance.rs +++ b/necsim/plugins/tskit/src/provenance.rs @@ -4,7 +4,7 @@ use findshlibs::{SharedLibrary, TargetSharedLibrary}; use serde::Serialize; /// tskit's provenance JSON schema format root for version 1.0.0 -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Serialize)] pub struct TskitProvenance { schema_version: String, @@ -73,7 +73,7 @@ impl TskitProvenanceParameters { #[derive(Serialize)] struct TskitProvenanceEnvironment { os: TskitProvenanceEnvironmentOs, - #[allow(clippy::zero_sized_map_values)] + #[expect(clippy::zero_sized_map_values)] libraries: HashMap, #[serde(with = "self::rustc_version::VersionMetaDef")] rustc: ::rustc_version::VersionMeta, @@ -81,7 +81,7 @@ struct TskitProvenanceEnvironment { impl TskitProvenanceEnvironment { pub fn try_new() -> io::Result { - #[allow(clippy::zero_sized_map_values)] + #[expect(clippy::zero_sized_map_values)] let mut libraries = HashMap::new(); // Create a map of all dynamically loaded libraries @@ -126,7 +126,7 @@ impl TskitProvenanceEnvironmentOs { struct TskitProvenanceEnvironmentLibrary {} impl TskitProvenanceEnvironmentLibrary { - #[allow(clippy::unnecessary_wraps)] + #[expect(clippy::unnecessary_wraps)] pub fn try_new(_library: &std::ffi::OsStr) -> io::Result { // TODO: Future work might deduce version information etc. @@ -156,7 +156,7 @@ mod rustc_version { pub llvm_version: Option, } - #[allow(clippy::trivially_copy_pass_by_ref)] + #[expect(clippy::trivially_copy_pass_by_ref)] fn serialize_channel( channel: &Channel, serializer: S, @@ -168,7 +168,6 @@ mod rustc_version { llvm_version: &Option, serializer: S, ) -> Result { - #[allow(clippy::option_if_let_else)] if let Some(llvm_version) = llvm_version { serializer.collect_str(llvm_version) } else { diff --git a/necsim/plugins/tskit/src/tree/metadata.rs b/necsim/plugins/tskit/src/tree/metadata.rs index bb26bfe0b..a7fe71d09 100644 --- a/necsim/plugins/tskit/src/tree/metadata.rs +++ b/necsim/plugins/tskit/src/tree/metadata.rs @@ -4,7 +4,7 @@ use tskit::metadata::{IndividualMetadata, MetadataError, MetadataRoundtrip, Node use necsim_core::lineage::GlobalLineageReference; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[repr(transparent)] pub struct GlobalLineageMetadata(GlobalLineageReference); diff --git a/necsim/plugins/tskit/src/tree/mod.rs b/necsim/plugins/tskit/src/tree/mod.rs index 852caffcc..94ab77ec8 100644 --- a/necsim/plugins/tskit/src/tree/mod.rs +++ b/necsim/plugins/tskit/src/tree/mod.rs @@ -19,7 +19,6 @@ mod table; const TSK_SEQUENCE_MIN: f64 = 0.0_f64; const TSK_SEQUENCE_MAX: f64 = 1.0_f64; -#[allow(clippy::module_name_repetitions)] #[derive(Deserialize)] #[serde(try_from = "TskitTreeReporterArgs")] pub struct TskitTreeReporter { diff --git a/rust-toolchain b/rust-toolchain index 218c6dd39..ecc358c2f 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1,5 +1,5 @@ [toolchain] -# Pin to final 1.79.0 nightly -channel = "nightly-2024-04-28" +# Pin to final 1.82.0 nightly +channel = "nightly-2024-09-01" components = [ "cargo", "rustfmt", "clippy", "rust-src", "llvm-bitcode-linker", "llvm-tools" ] -targets = [ "x86_64-unknown-linux-gnu", "nvptx64-nvidia-cuda" ] +targets = [ "nvptx64-nvidia-cuda" ] diff --git a/rustcoalescence/Cargo.toml b/rustcoalescence/Cargo.toml index e24b3a8da..b26dfcac6 100644 --- a/rustcoalescence/Cargo.toml +++ b/rustcoalescence/Cargo.toml @@ -24,6 +24,10 @@ almost-infinite-clark2dt-dispersal-scenario = [ "rustcoalescence-scenarios/almost-infinite-clark2dt-dispersal", "rustcoalescence-algorithms-cuda?/almost-infinite-clark2dt-dispersal-scenario", ] +almost-infinite-downscaled-scenario = [ + "rustcoalescence-scenarios/almost-infinite-downscaled", + "rustcoalescence-algorithms-cuda?/almost-infinite-downscaled-scenario", +] non-spatial-scenario = [ "rustcoalescence-scenarios/non-spatial", "rustcoalescence-algorithms-cuda?/non-spatial-scenario", @@ -48,6 +52,7 @@ wrapping-noise-scenario = [ all-scenarios = [ "almost-infinite-normal-dispersal-scenario", "almost-infinite-clark2dt-dispersal-scenario", + "almost-infinite-downscaled-scenario", "non-spatial-scenario", "spatially-explicit-uniform-turnover-scenario", "spatially-explicit-turnover-map-scenario", @@ -82,12 +87,12 @@ rustcoalescence-algorithms-gillespie = { path = "algorithms/gillespie", optional rustcoalescence-algorithms-independent = { path = "algorithms/independent", optional = true } rustcoalescence-algorithms-cuda = { path = "algorithms/cuda", optional = true } -clap = { version = "4.0", features = ["derive"] } +clap = { version = "4.5", features = ["derive"] } anyhow = "1.0" serde = { version = "1.0", features = ["derive"] } ron = { version = "0.8", features = ["integer128"] } log = { version = "0.4", features = ["std"] } -colored = "2.0" +colored = "2.1" thiserror = "1.0" serde_path_to_error = "0.1" serde_state = "0.4" @@ -99,4 +104,3 @@ tiny-keccak = { version = "2.0", features = ["keccak"] } derive_builder = "0.20" fnv = "1.0" adler = "1.0" -either = "1.10" diff --git a/rustcoalescence/algorithms/cuda/Cargo.toml b/rustcoalescence/algorithms/cuda/Cargo.toml index c91617175..a7e889afe 100644 --- a/rustcoalescence/algorithms/cuda/Cargo.toml +++ b/rustcoalescence/algorithms/cuda/Cargo.toml @@ -10,6 +10,7 @@ edition = "2021" [features] almost-infinite-normal-dispersal-scenario = ["rustcoalescence-algorithms-cuda-cpu-kernel/almost-infinite-normal-dispersal-scenario"] almost-infinite-clark2dt-dispersal-scenario = ["rustcoalescence-algorithms-cuda-cpu-kernel/almost-infinite-clark2dt-dispersal-scenario"] +almost-infinite-downscaled-scenario = ["rustcoalescence-algorithms-cuda-cpu-kernel/almost-infinite-downscaled-scenario"] non-spatial-scenario = ["rustcoalescence-algorithms-cuda-cpu-kernel/non-spatial-scenario"] spatially-explicit-uniform-turnover-scenario = ["rustcoalescence-algorithms-cuda-cpu-kernel/spatially-explicit-uniform-turnover-scenario"] spatially-explicit-turnover-map-scenario = ["rustcoalescence-algorithms-cuda-cpu-kernel/spatially-explicit-turnover-map-scenario"] @@ -32,4 +33,4 @@ thiserror = "1.0" serde = { version = "1.0", features = ["derive"] } serde_state = "0.4" serde_derive_state = "0.4" -rust-cuda = { git = "https://github.com/juntyr/rust-cuda", rev = "f2a377d", features = ["host"] } +rust-cuda = { git = "https://github.com/juntyr/rust-cuda", rev = "62e96a9", features = ["host"] } diff --git a/rustcoalescence/algorithms/cuda/cpu-kernel/Cargo.toml b/rustcoalescence/algorithms/cuda/cpu-kernel/Cargo.toml index 19c722abd..80e99de92 100644 --- a/rustcoalescence/algorithms/cuda/cpu-kernel/Cargo.toml +++ b/rustcoalescence/algorithms/cuda/cpu-kernel/Cargo.toml @@ -10,6 +10,7 @@ edition = "2021" [features] almost-infinite-normal-dispersal-scenario = [] almost-infinite-clark2dt-dispersal-scenario = [] +almost-infinite-downscaled-scenario = [] non-spatial-scenario = [] spatially-explicit-uniform-turnover-scenario = [] spatially-explicit-turnover-map-scenario = [] @@ -23,4 +24,4 @@ necsim-impls-no-std = { path = "../../../../necsim/impls/no-std", features = ["c necsim-impls-cuda = { path = "../../../../necsim/impls/cuda" } rustcoalescence-algorithms-cuda-gpu-kernel = { path = "../gpu-kernel" } -rust-cuda = { git = "https://github.com/juntyr/rust-cuda", rev = "f2a377d", features = ["host"] } +rust-cuda = { git = "https://github.com/juntyr/rust-cuda", rev = "62e96a9", features = ["host"] } diff --git a/rustcoalescence/algorithms/cuda/cpu-kernel/src/lib.rs b/rustcoalescence/algorithms/cuda/cpu-kernel/src/lib.rs index 8f206ab43..d0758e45c 100644 --- a/rustcoalescence/algorithms/cuda/cpu-kernel/src/lib.rs +++ b/rustcoalescence/algorithms/cuda/cpu-kernel/src/lib.rs @@ -20,7 +20,7 @@ use rust_cuda::lend::RustToCuda; mod link; mod patch; -#[allow(clippy::type_complexity)] +#[expect(clippy::type_complexity)] pub struct SimulationKernelPtx< M: MathsCore + Sync, H: Habitat + RustToCuda + Sync, diff --git a/rustcoalescence/algorithms/cuda/cpu-kernel/src/link.rs b/rustcoalescence/algorithms/cuda/cpu-kernel/src/link.rs index e232fcd51..bb19c5466 100644 --- a/rustcoalescence/algorithms/cuda/cpu-kernel/src/link.rs +++ b/rustcoalescence/algorithms/cuda/cpu-kernel/src/link.rs @@ -13,7 +13,7 @@ use necsim_impls_no_std::cogs::{ use rust_cuda::lend::RustToCuda; -#[allow(clippy::type_complexity)] +#[expect(clippy::type_complexity)] pub struct SimulationKernelPtx< M: MathsCore + Sync, H: Habitat + RustToCuda + Sync, @@ -48,7 +48,7 @@ pub struct SimulationKernelPtx< )>, ); -#[allow(unused_macros)] +#[allow(unused_macros)] // FIXME: use expect macro_rules! link_kernel { ($habitat:ty, $dispersal:ty, $turnover:ty, $speciation:ty) => { link_kernel! { @@ -289,7 +289,7 @@ link_kernel!( necsim_impls_no_std::cogs::habitat::almost_infinite::AlmostInfiniteHabitat< necsim_impls_cuda::cogs::maths::NvptxMathsCore >, - necsim_impls_no_std::cogs::dispersal_sampler::almost_infinite_normal::AlmostInfiniteNormalDispersalSampler< + necsim_impls_no_std::cogs::dispersal_sampler::almost_infinite::normal::AlmostInfiniteNormalDispersalSampler< necsim_impls_cuda::cogs::maths::NvptxMathsCore, necsim_impls_cuda::cogs::rng::CudaRng< necsim_impls_cuda::cogs::maths::NvptxMathsCore, @@ -307,7 +307,7 @@ link_kernel!( necsim_impls_no_std::cogs::habitat::almost_infinite::AlmostInfiniteHabitat< necsim_impls_cuda::cogs::maths::NvptxMathsCore >, - necsim_impls_no_std::cogs::dispersal_sampler::almost_infinite_clark2dt::AlmostInfiniteClark2DtDispersalSampler< + necsim_impls_no_std::cogs::dispersal_sampler::almost_infinite::clark2dt::AlmostInfiniteClark2DtDispersalSampler< necsim_impls_cuda::cogs::maths::NvptxMathsCore, necsim_impls_cuda::cogs::rng::CudaRng< necsim_impls_cuda::cogs::maths::NvptxMathsCore, @@ -320,6 +320,66 @@ link_kernel!( necsim_impls_no_std::cogs::speciation_probability::uniform::UniformSpeciationProbability ); +#[cfg(all( + feature = "almost-infinite-normal-dispersal-scenario", + feature = "almost-infinite-downscaled-scenario", +))] +link_kernel!( + necsim_impls_no_std::cogs::habitat::almost_infinite::downscaled::AlmostInfiniteDownscaledHabitat< + necsim_impls_cuda::cogs::maths::NvptxMathsCore + >, + necsim_impls_no_std::cogs::dispersal_sampler::almost_infinite::downscaled::AlmostInfiniteDownscaledDispersalSampler< + necsim_impls_cuda::cogs::maths::NvptxMathsCore, + necsim_impls_cuda::cogs::rng::CudaRng< + necsim_impls_cuda::cogs::maths::NvptxMathsCore, + necsim_impls_no_std::cogs::rng::wyhash::WyHash< + necsim_impls_cuda::cogs::maths::NvptxMathsCore + >, + >, + necsim_impls_no_std::cogs::dispersal_sampler::almost_infinite::normal::AlmostInfiniteNormalDispersalSampler< + necsim_impls_cuda::cogs::maths::NvptxMathsCore, + necsim_impls_cuda::cogs::rng::CudaRng< + necsim_impls_cuda::cogs::maths::NvptxMathsCore, + necsim_impls_no_std::cogs::rng::wyhash::WyHash< + necsim_impls_cuda::cogs::maths::NvptxMathsCore + >, + >, + >, + >, + necsim_impls_no_std::cogs::turnover_rate::uniform::UniformTurnoverRate, + necsim_impls_no_std::cogs::speciation_probability::uniform::UniformSpeciationProbability +); + +#[cfg(all( + feature = "almost-infinite-clark2dt-dispersal-scenario", + feature = "almost-infinite-downscaled-scenario", +))] +link_kernel!( + necsim_impls_no_std::cogs::habitat::almost_infinite::downscaled::AlmostInfiniteDownscaledHabitat< + necsim_impls_cuda::cogs::maths::NvptxMathsCore + >, + necsim_impls_no_std::cogs::dispersal_sampler::almost_infinite::downscaled::AlmostInfiniteDownscaledDispersalSampler< + necsim_impls_cuda::cogs::maths::NvptxMathsCore, + necsim_impls_cuda::cogs::rng::CudaRng< + necsim_impls_cuda::cogs::maths::NvptxMathsCore, + necsim_impls_no_std::cogs::rng::wyhash::WyHash< + necsim_impls_cuda::cogs::maths::NvptxMathsCore + >, + >, + necsim_impls_no_std::cogs::dispersal_sampler::almost_infinite::clark2dt::AlmostInfiniteClark2DtDispersalSampler< + necsim_impls_cuda::cogs::maths::NvptxMathsCore, + necsim_impls_cuda::cogs::rng::CudaRng< + necsim_impls_cuda::cogs::maths::NvptxMathsCore, + necsim_impls_no_std::cogs::rng::wyhash::WyHash< + necsim_impls_cuda::cogs::maths::NvptxMathsCore + >, + >, + >, + >, + necsim_impls_no_std::cogs::turnover_rate::uniform::UniformTurnoverRate, + necsim_impls_no_std::cogs::speciation_probability::uniform::UniformSpeciationProbability +); + #[cfg(feature = "spatially-explicit-uniform-turnover-scenario")] link_kernel!( necsim_impls_no_std::cogs::habitat::in_memory::InMemoryHabitat< diff --git a/rustcoalescence/algorithms/cuda/gpu-kernel/Cargo.toml b/rustcoalescence/algorithms/cuda/gpu-kernel/Cargo.toml index 537fcf8de..85c6452f1 100644 --- a/rustcoalescence/algorithms/cuda/gpu-kernel/Cargo.toml +++ b/rustcoalescence/algorithms/cuda/gpu-kernel/Cargo.toml @@ -17,7 +17,7 @@ necsim-impls-no-std = { path = "../../../../necsim/impls/no-std", features = ["c necsim-impls-cuda = { path = "../../../../necsim/impls/cuda" } [target.'cfg(target_os = "cuda")'.dependencies] -rust-cuda = { git = "https://github.com/juntyr/rust-cuda", rev = "f2a377d", features = ["derive", "device", "kernel"] } +rust-cuda = { git = "https://github.com/juntyr/rust-cuda", rev = "62e96a9", features = ["derive", "device", "kernel"] } [target.'cfg(not(target_os = "cuda"))'.dependencies] -rust-cuda = { git = "https://github.com/juntyr/rust-cuda", rev = "f2a377d", features = ["derive", "kernel"] } +rust-cuda = { git = "https://github.com/juntyr/rust-cuda", rev = "62e96a9", features = ["derive", "kernel"] } diff --git a/rustcoalescence/algorithms/cuda/gpu-kernel/src/lib.rs b/rustcoalescence/algorithms/cuda/gpu-kernel/src/lib.rs index afb17efe7..a45a0a9b6 100644 --- a/rustcoalescence/algorithms/cuda/gpu-kernel/src/lib.rs +++ b/rustcoalescence/algorithms/cuda/gpu-kernel/src/lib.rs @@ -42,8 +42,8 @@ use rust_cuda::{ allow(ptx::local_memory_use), // FIXME forbid(ptx::register_spills), )] -#[allow(clippy::too_many_arguments)] -#[allow(clippy::type_complexity)] +#[expect(clippy::type_complexity)] +#[allow(clippy::too_many_arguments)] // FIXME: use expect pub fn simulate< M: MathsCore + Sync, H: Habitat + RustToCuda + Sync, @@ -138,7 +138,7 @@ mod cuda_prelude { #[cfg(debug_assertions)] #[panic_handler] fn panic(info: &::core::panic::PanicInfo) -> ! { - rust_cuda::device::utils::pretty_print_panic_info(info, true, true); + rust_cuda::device::utils::pretty_print_panic_info(info, true); rust_cuda::device::utils::abort() } diff --git a/rustcoalescence/algorithms/cuda/src/arguments.rs b/rustcoalescence/algorithms/cuda/src/arguments.rs index fafc7ef7f..e3de21afe 100644 --- a/rustcoalescence/algorithms/cuda/src/arguments.rs +++ b/rustcoalescence/algorithms/cuda/src/arguments.rs @@ -57,7 +57,7 @@ impl<'de> DeserializeState<'de, PartitionSize> for ParallelismMode { } #[derive(Clone, Debug, Serialize)] -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct CudaArguments { pub device: u32, pub ptx_jit: bool, diff --git a/rustcoalescence/algorithms/cuda/src/cuda.rs b/rustcoalescence/algorithms/cuda/src/cuda.rs index d8222ebb1..36fa903e2 100644 --- a/rustcoalescence/algorithms/cuda/src/cuda.rs +++ b/rustcoalescence/algorithms/cuda/src/cuda.rs @@ -7,7 +7,7 @@ use rust_cuda::host::CudaDropWrapper; use crate::{error::CudaError, info}; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub fn with_initialised_cuda, F: FnOnce() -> Result>( device: u32, inner: F, diff --git a/rustcoalescence/algorithms/cuda/src/error.rs b/rustcoalescence/algorithms/cuda/src/error.rs index f81a9e3c1..085f1ed29 100644 --- a/rustcoalescence/algorithms/cuda/src/error.rs +++ b/rustcoalescence/algorithms/cuda/src/error.rs @@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize}; #[derive(thiserror::Error, Debug, Clone, Serialize, Deserialize)] #[serde(into = "CudaErrorRaw", from = "CudaErrorRaw")] #[error(transparent)] -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct CudaError(#[from] RustaCudaError); #[derive(Serialize, Deserialize)] @@ -25,7 +25,7 @@ impl From for CudaError { fn from(value: CudaErrorRaw) -> Self { type E = RustaCudaError; - #[allow(clippy::wildcard_in_or_patterns)] + #[expect(clippy::wildcard_in_or_patterns)] let code = match value.code { const { E::InvalidValue as u32 } => E::InvalidValue, const { E::OutOfMemory as u32 } => E::OutOfMemory, diff --git a/rustcoalescence/algorithms/cuda/src/initialiser/genesis.rs b/rustcoalescence/algorithms/cuda/src/initialiser/genesis.rs index ce00dc71b..06db5b133 100644 --- a/rustcoalescence/algorithms/cuda/src/initialiser/genesis.rs +++ b/rustcoalescence/algorithms/cuda/src/initialiser/genesis.rs @@ -19,7 +19,7 @@ use crate::CudaError; use super::CudaLineageStoreSampleInitialiser; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct GenesisInitialiser; impl + RustToCuda + Sync, O: Scenario> diff --git a/rustcoalescence/algorithms/cuda/src/initialiser/mod.rs b/rustcoalescence/algorithms/cuda/src/initialiser/mod.rs index 48947d7dd..8ff31f068 100644 --- a/rustcoalescence/algorithms/cuda/src/initialiser/mod.rs +++ b/rustcoalescence/algorithms/cuda/src/initialiser/mod.rs @@ -24,7 +24,7 @@ pub mod fixup; pub mod genesis; pub mod resume; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub trait CudaLineageStoreSampleInitialiser< M: MathsCore, G: PrimeableRng + RustToCuda + Sync, @@ -53,7 +53,7 @@ pub trait CudaLineageStoreSampleInitialiser< >, NeverImmigrationEntry, > + RustToCuda + Sync; - #[allow(clippy::type_complexity)] + #[expect(clippy::type_complexity)] fn init< 'h, T: TrustedOriginSampler<'h, M, Habitat = O::Habitat>, diff --git a/rustcoalescence/algorithms/cuda/src/initialiser/resume.rs b/rustcoalescence/algorithms/cuda/src/initialiser/resume.rs index f48633d76..184492eda 100644 --- a/rustcoalescence/algorithms/cuda/src/initialiser/resume.rs +++ b/rustcoalescence/algorithms/cuda/src/initialiser/resume.rs @@ -22,7 +22,7 @@ use crate::CudaError; use super::CudaLineageStoreSampleInitialiser; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct ResumeInitialiser> { pub lineages: L, pub resume_after: Option, diff --git a/rustcoalescence/algorithms/cuda/src/launch.rs b/rustcoalescence/algorithms/cuda/src/launch.rs index 921da4fc3..693fdbbd3 100644 --- a/rustcoalescence/algorithms/cuda/src/launch.rs +++ b/rustcoalescence/algorithms/cuda/src/launch.rs @@ -48,7 +48,7 @@ use crate::{ parallelisation, }; -#[allow(clippy::too_many_lines)] +#[expect(clippy::too_many_lines)] pub fn initialise_and_simulate< 'p, M: MathsCore + Sync, diff --git a/rustcoalescence/algorithms/cuda/src/lib.rs b/rustcoalescence/algorithms/cuda/src/lib.rs index c19913634..dd8780bc7 100644 --- a/rustcoalescence/algorithms/cuda/src/lib.rs +++ b/rustcoalescence/algorithms/cuda/src/lib.rs @@ -63,7 +63,6 @@ use crate::{ }, }; -#[allow(clippy::module_name_repetitions, clippy::empty_enum)] pub enum CudaAlgorithm {} impl AlgorithmParamters for CudaAlgorithm { diff --git a/rustcoalescence/algorithms/cuda/src/parallelisation/monolithic.rs b/rustcoalescence/algorithms/cuda/src/parallelisation/monolithic.rs index b049d3d9d..2cf4abf9c 100644 --- a/rustcoalescence/algorithms/cuda/src/parallelisation/monolithic.rs +++ b/rustcoalescence/algorithms/cuda/src/parallelisation/monolithic.rs @@ -43,7 +43,7 @@ use crate::error::CudaError; type Result = std::result::Result; -#[allow(clippy::type_complexity, clippy::too_many_lines)] +#[expect(clippy::type_complexity, clippy::too_many_lines)] pub fn simulate< 'l, 'p, @@ -116,7 +116,6 @@ pub fn simulate< let (dedup_cache, step_slice) = config; - #[allow(clippy::or_fun_call)] let intial_max_time = slow_lineages .iter() .map(|(lineage, _)| lineage.last_event_time) @@ -159,7 +158,6 @@ pub fn simulate< let mut min_spec_samples = dedup_cache.construct(slow_lineages.len()); - #[allow(clippy::or_fun_call)] let mut level_time = slow_lineages .iter() .map(|(lineage, _)| lineage.last_event_time) diff --git a/rustcoalescence/algorithms/gillespie/src/arguments.rs b/rustcoalescence/algorithms/gillespie/src/arguments.rs index 910d03f04..dd64e8757 100644 --- a/rustcoalescence/algorithms/gillespie/src/arguments.rs +++ b/rustcoalescence/algorithms/gillespie/src/arguments.rs @@ -9,7 +9,7 @@ use necsim_partitioning_core::{ }; #[derive(Clone, Serialize, Debug)] -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct GillespieArguments { pub parallelism_mode: ParallelismMode, } diff --git a/rustcoalescence/algorithms/gillespie/src/event_skipping/initialiser/genesis.rs b/rustcoalescence/algorithms/gillespie/src/event_skipping/initialiser/genesis.rs index 790ed2bfc..616eed717 100644 --- a/rustcoalescence/algorithms/gillespie/src/event_skipping/initialiser/genesis.rs +++ b/rustcoalescence/algorithms/gillespie/src/event_skipping/initialiser/genesis.rs @@ -18,7 +18,7 @@ use rustcoalescence_scenarios::Scenario; use super::EventSkippingLineageStoreSampleInitialiser; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct GenesisInitialiser; impl, O: Scenario> diff --git a/rustcoalescence/algorithms/gillespie/src/event_skipping/initialiser/mod.rs b/rustcoalescence/algorithms/gillespie/src/event_skipping/initialiser/mod.rs index 70490f920..ce730a994 100644 --- a/rustcoalescence/algorithms/gillespie/src/event_skipping/initialiser/mod.rs +++ b/rustcoalescence/algorithms/gillespie/src/event_skipping/initialiser/mod.rs @@ -19,7 +19,7 @@ pub mod fixup; pub mod genesis; pub mod resume; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub trait EventSkippingLineageStoreSampleInitialiser< M: MathsCore, G: RngCore, @@ -56,7 +56,7 @@ pub trait EventSkippingLineageStoreSampleInitialiser< I, >; - #[allow(clippy::type_complexity)] + #[expect(clippy::type_complexity)] fn init< 'h, 'p, diff --git a/rustcoalescence/algorithms/gillespie/src/event_skipping/initialiser/resume.rs b/rustcoalescence/algorithms/gillespie/src/event_skipping/initialiser/resume.rs index 9f8e10694..ddac0ed21 100644 --- a/rustcoalescence/algorithms/gillespie/src/event_skipping/initialiser/resume.rs +++ b/rustcoalescence/algorithms/gillespie/src/event_skipping/initialiser/resume.rs @@ -21,7 +21,7 @@ use rustcoalescence_scenarios::Scenario; use super::EventSkippingLineageStoreSampleInitialiser; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct ResumeInitialiser> { pub lineages: L, pub resume_after: Option, diff --git a/rustcoalescence/algorithms/gillespie/src/event_skipping/launch.rs b/rustcoalescence/algorithms/gillespie/src/event_skipping/launch.rs index 8e92f15b0..f70c699af 100644 --- a/rustcoalescence/algorithms/gillespie/src/event_skipping/launch.rs +++ b/rustcoalescence/algorithms/gillespie/src/event_skipping/launch.rs @@ -32,7 +32,7 @@ use crate::arguments::{ AveragingParallelismMode, GillespieArguments, OptimisticParallelismMode, ParallelismMode, }; -#[allow(clippy::shadow_unrelated, clippy::too_many_lines)] +#[expect(clippy::too_many_lines)] pub fn initialise_and_simulate< 'p, M: MathsCore, diff --git a/rustcoalescence/algorithms/gillespie/src/event_skipping/mod.rs b/rustcoalescence/algorithms/gillespie/src/event_skipping/mod.rs index b8f68c957..58a6be0e2 100644 --- a/rustcoalescence/algorithms/gillespie/src/event_skipping/mod.rs +++ b/rustcoalescence/algorithms/gillespie/src/event_skipping/mod.rs @@ -33,7 +33,7 @@ use initialiser::{ fixup::FixUpInitialiser, genesis::GenesisInitialiser, resume::ResumeInitialiser, }; -#[allow(clippy::module_name_repetitions, clippy::empty_enum)] +#[expect(clippy::module_name_repetitions)] pub struct EventSkippingAlgorithm {} impl AlgorithmParamters for EventSkippingAlgorithm { diff --git a/rustcoalescence/algorithms/gillespie/src/gillespie/classical/initialiser/genesis.rs b/rustcoalescence/algorithms/gillespie/src/gillespie/classical/initialiser/genesis.rs index 4b64fb6e0..c1ccc6066 100644 --- a/rustcoalescence/algorithms/gillespie/src/gillespie/classical/initialiser/genesis.rs +++ b/rustcoalescence/algorithms/gillespie/src/gillespie/classical/initialiser/genesis.rs @@ -13,7 +13,7 @@ use rustcoalescence_scenarios::Scenario; use super::ClassicalLineageStoreSampleInitialiser; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct GenesisInitialiser; impl, O: Scenario> diff --git a/rustcoalescence/algorithms/gillespie/src/gillespie/classical/initialiser/mod.rs b/rustcoalescence/algorithms/gillespie/src/gillespie/classical/initialiser/mod.rs index 1f2ea44cf..f36d2f427 100644 --- a/rustcoalescence/algorithms/gillespie/src/gillespie/classical/initialiser/mod.rs +++ b/rustcoalescence/algorithms/gillespie/src/gillespie/classical/initialiser/mod.rs @@ -19,7 +19,7 @@ pub mod fixup; pub mod genesis; pub mod resume; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub trait ClassicalLineageStoreSampleInitialiser< M: MathsCore, G: RngCore, @@ -56,7 +56,7 @@ pub trait ClassicalLineageStoreSampleInitialiser< I, >; - #[allow(clippy::type_complexity)] + #[expect(clippy::type_complexity)] fn init< 'h, 'p, diff --git a/rustcoalescence/algorithms/gillespie/src/gillespie/classical/initialiser/resume.rs b/rustcoalescence/algorithms/gillespie/src/gillespie/classical/initialiser/resume.rs index 42002b0ba..de6bd7b0e 100644 --- a/rustcoalescence/algorithms/gillespie/src/gillespie/classical/initialiser/resume.rs +++ b/rustcoalescence/algorithms/gillespie/src/gillespie/classical/initialiser/resume.rs @@ -16,7 +16,7 @@ use rustcoalescence_scenarios::Scenario; use super::ClassicalLineageStoreSampleInitialiser; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct ResumeInitialiser> { pub lineages: L, pub resume_after: Option, diff --git a/rustcoalescence/algorithms/gillespie/src/gillespie/classical/launch.rs b/rustcoalescence/algorithms/gillespie/src/gillespie/classical/launch.rs index 750102da6..9744c7955 100644 --- a/rustcoalescence/algorithms/gillespie/src/gillespie/classical/launch.rs +++ b/rustcoalescence/algorithms/gillespie/src/gillespie/classical/launch.rs @@ -32,7 +32,7 @@ use crate::arguments::{ use super::initialiser::ClassicalLineageStoreSampleInitialiser; -#[allow(clippy::too_many_lines)] +#[expect(clippy::too_many_lines)] pub fn initialise_and_simulate< 'p, M: MathsCore, diff --git a/rustcoalescence/algorithms/gillespie/src/gillespie/mod.rs b/rustcoalescence/algorithms/gillespie/src/gillespie/mod.rs index 4a9f6c08c..cc782bf68 100644 --- a/rustcoalescence/algorithms/gillespie/src/gillespie/mod.rs +++ b/rustcoalescence/algorithms/gillespie/src/gillespie/mod.rs @@ -17,7 +17,7 @@ use crate::arguments::{get_gillespie_logical_partition_size, GillespieArguments} mod classical; mod turnover; -#[allow(clippy::module_name_repetitions, clippy::empty_enum)] +#[expect(clippy::module_name_repetitions, clippy::empty_enum)] pub enum GillespieAlgorithm {} impl AlgorithmParamters for GillespieAlgorithm { diff --git a/rustcoalescence/algorithms/gillespie/src/gillespie/turnover/initialiser/genesis.rs b/rustcoalescence/algorithms/gillespie/src/gillespie/turnover/initialiser/genesis.rs index 7e111a418..17f75d1a3 100644 --- a/rustcoalescence/algorithms/gillespie/src/gillespie/turnover/initialiser/genesis.rs +++ b/rustcoalescence/algorithms/gillespie/src/gillespie/turnover/initialiser/genesis.rs @@ -16,7 +16,7 @@ use rustcoalescence_scenarios::Scenario; use super::GillespieLineageStoreSampleInitialiser; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct GenesisInitialiser; impl, O: Scenario> diff --git a/rustcoalescence/algorithms/gillespie/src/gillespie/turnover/initialiser/mod.rs b/rustcoalescence/algorithms/gillespie/src/gillespie/turnover/initialiser/mod.rs index 4def88e33..19e70b527 100644 --- a/rustcoalescence/algorithms/gillespie/src/gillespie/turnover/initialiser/mod.rs +++ b/rustcoalescence/algorithms/gillespie/src/gillespie/turnover/initialiser/mod.rs @@ -15,7 +15,7 @@ pub mod fixup; pub mod genesis; pub mod resume; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub trait GillespieLineageStoreSampleInitialiser< M: MathsCore, G: RngCore, @@ -44,7 +44,7 @@ pub trait GillespieLineageStoreSampleInitialiser< I, >; - #[allow(clippy::type_complexity)] + #[expect(clippy::type_complexity)] fn init< 'h, 'p, diff --git a/rustcoalescence/algorithms/gillespie/src/gillespie/turnover/initialiser/resume.rs b/rustcoalescence/algorithms/gillespie/src/gillespie/turnover/initialiser/resume.rs index 596c69bb2..498662a9c 100644 --- a/rustcoalescence/algorithms/gillespie/src/gillespie/turnover/initialiser/resume.rs +++ b/rustcoalescence/algorithms/gillespie/src/gillespie/turnover/initialiser/resume.rs @@ -19,7 +19,7 @@ use rustcoalescence_scenarios::Scenario; use super::GillespieLineageStoreSampleInitialiser; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct ResumeInitialiser> { pub lineages: L, pub resume_after: Option, diff --git a/rustcoalescence/algorithms/gillespie/src/gillespie/turnover/launch.rs b/rustcoalescence/algorithms/gillespie/src/gillespie/turnover/launch.rs index e34dbe25f..688ec5265 100644 --- a/rustcoalescence/algorithms/gillespie/src/gillespie/turnover/launch.rs +++ b/rustcoalescence/algorithms/gillespie/src/gillespie/turnover/launch.rs @@ -31,7 +31,7 @@ use crate::arguments::{ use super::initialiser::GillespieLineageStoreSampleInitialiser; -#[allow(clippy::shadow_unrelated, clippy::too_many_lines)] +#[expect(clippy::too_many_lines)] pub fn initialise_and_simulate< 'p, M: MathsCore, diff --git a/rustcoalescence/algorithms/independent/src/arguments.rs b/rustcoalescence/algorithms/independent/src/arguments.rs index 90422ea43..6c9424473 100644 --- a/rustcoalescence/algorithms/independent/src/arguments.rs +++ b/rustcoalescence/algorithms/independent/src/arguments.rs @@ -77,7 +77,7 @@ impl<'de> DeserializeState<'de, PartitionSize> for ParallelismMode { } #[derive(Clone, Debug, Serialize)] -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct IndependentArguments { pub delta_t: PositiveF64, pub step_slice: NonZeroU64, diff --git a/rustcoalescence/algorithms/independent/src/initialiser/genesis.rs b/rustcoalescence/algorithms/independent/src/initialiser/genesis.rs index 07b29ee36..272ab2bb0 100644 --- a/rustcoalescence/algorithms/independent/src/initialiser/genesis.rs +++ b/rustcoalescence/algorithms/independent/src/initialiser/genesis.rs @@ -15,7 +15,7 @@ use rustcoalescence_scenarios::Scenario; use super::IndependentLineageStoreSampleInitialiser; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct GenesisInitialiser; impl, O: Scenario> diff --git a/rustcoalescence/algorithms/independent/src/initialiser/mod.rs b/rustcoalescence/algorithms/independent/src/initialiser/mod.rs index e316b87b5..40d369513 100644 --- a/rustcoalescence/algorithms/independent/src/initialiser/mod.rs +++ b/rustcoalescence/algorithms/independent/src/initialiser/mod.rs @@ -20,7 +20,7 @@ pub mod fixup; pub mod genesis; pub mod resume; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub trait IndependentLineageStoreSampleInitialiser< M: MathsCore, G: PrimeableRng, @@ -42,7 +42,7 @@ pub trait IndependentLineageStoreSampleInitialiser< >, NeverImmigrationEntry, >; - #[allow(clippy::type_complexity)] + #[expect(clippy::type_complexity)] fn init< 'h, T: TrustedOriginSampler<'h, M, Habitat = O::Habitat>, diff --git a/rustcoalescence/algorithms/independent/src/initialiser/resume.rs b/rustcoalescence/algorithms/independent/src/initialiser/resume.rs index 6f12db91f..7d0fe698b 100644 --- a/rustcoalescence/algorithms/independent/src/initialiser/resume.rs +++ b/rustcoalescence/algorithms/independent/src/initialiser/resume.rs @@ -18,7 +18,7 @@ use rustcoalescence_scenarios::Scenario; use super::IndependentLineageStoreSampleInitialiser; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct ResumeInitialiser> { pub lineages: L, pub resume_after: Option, diff --git a/rustcoalescence/algorithms/independent/src/launch.rs b/rustcoalescence/algorithms/independent/src/launch.rs index bc645a6dd..ef2c0d36e 100644 --- a/rustcoalescence/algorithms/independent/src/launch.rs +++ b/rustcoalescence/algorithms/independent/src/launch.rs @@ -41,7 +41,7 @@ use crate::{ initialiser::IndependentLineageStoreSampleInitialiser, }; -#[allow(clippy::too_many_lines)] +#[expect(clippy::too_many_lines)] pub fn initialise_and_simulate< 'p, M: MathsCore, diff --git a/rustcoalescence/algorithms/independent/src/lib.rs b/rustcoalescence/algorithms/independent/src/lib.rs index 026d1f1e5..16508bbeb 100644 --- a/rustcoalescence/algorithms/independent/src/lib.rs +++ b/rustcoalescence/algorithms/independent/src/lib.rs @@ -36,7 +36,7 @@ use initialiser::{ fixup::FixUpInitialiser, genesis::GenesisInitialiser, resume::ResumeInitialiser, }; -#[allow(clippy::module_name_repetitions, clippy::empty_enum)] +#[expect(clippy::empty_enum)] pub enum IndependentAlgorithm {} impl AlgorithmParamters for IndependentAlgorithm { diff --git a/rustcoalescence/algorithms/src/lib.rs b/rustcoalescence/algorithms/src/lib.rs index b668ee5e9..c1d639573 100644 --- a/rustcoalescence/algorithms/src/lib.rs +++ b/rustcoalescence/algorithms/src/lib.rs @@ -82,7 +82,7 @@ pub trait Algorithm< /// /// Returns a `ContinueError` if initialising the resuming /// simulation or running the algorithm failed - #[allow(clippy::type_complexity, clippy::too_many_arguments)] + #[expect(clippy::too_many_arguments)] fn resume_and_simulate, L: ExactSizeIterator>( args: Self::Arguments, rng: G, @@ -98,7 +98,7 @@ pub trait Algorithm< /// /// Returns a `ContinueError` if fixing up the restarting /// simulation (incl. running the algorithm) failed - #[allow(clippy::type_complexity, clippy::too_many_arguments)] + #[expect(clippy::too_many_arguments)] fn fixup_for_restart, L: ExactSizeIterator>( args: Self::Arguments, rng: G, diff --git a/rustcoalescence/algorithms/src/strategy.rs b/rustcoalescence/algorithms/src/strategy.rs index 879560553..1a841e3d3 100644 --- a/rustcoalescence/algorithms/src/strategy.rs +++ b/rustcoalescence/algorithms/src/strategy.rs @@ -1,6 +1,6 @@ use serde::{Deserialize, Serialize}; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Clone, Debug, Serialize, Deserialize)] #[serde(default)] pub struct RestartFixUpStrategy { @@ -22,14 +22,14 @@ impl Default for RestartFixUpStrategy { } } -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Clone, Debug, Serialize, Deserialize)] pub enum OutOfDemeStrategy { Abort, Dispersal, } -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Clone, Debug, Serialize, Deserialize)] pub enum OutOfHabitatStrategy { Abort, @@ -37,7 +37,7 @@ pub enum OutOfHabitatStrategy { UniformDispersal, } -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Clone, Debug, Serialize, Deserialize)] pub enum CoalescenceStrategy { Abort, diff --git a/rustcoalescence/scenarios/Cargo.toml b/rustcoalescence/scenarios/Cargo.toml index 8ecb11b0c..a2aedae2a 100644 --- a/rustcoalescence/scenarios/Cargo.toml +++ b/rustcoalescence/scenarios/Cargo.toml @@ -10,6 +10,7 @@ edition = "2021" [features] almost-infinite-normal-dispersal = [] almost-infinite-clark2dt-dispersal = [] +almost-infinite-downscaled = [] non-spatial = [] spatially-explicit-uniform-turnover = [] spatially-explicit-turnover-map = [] @@ -29,4 +30,3 @@ displaydoc = "0.2" log = "0.4" serde = { version = "1.0", features = ["derive"] } tiff = "0.9" -either = "1.10" diff --git a/rustcoalescence/scenarios/src/almost_infinite/clark2dt.rs b/rustcoalescence/scenarios/src/almost_infinite/clark2dt.rs index 7a77addd9..b09efd71a 100644 --- a/rustcoalescence/scenarios/src/almost_infinite/clark2dt.rs +++ b/rustcoalescence/scenarios/src/almost_infinite/clark2dt.rs @@ -8,7 +8,7 @@ use necsim_partitioning_core::partition::Partition; use necsim_impls_no_std::{ cogs::{ - dispersal_sampler::almost_infinite_clark2dt::AlmostInfiniteClark2DtDispersalSampler, + dispersal_sampler::almost_infinite::clark2dt::AlmostInfiniteClark2DtDispersalSampler, habitat::almost_infinite::AlmostInfiniteHabitat, lineage_store::coherent::globally::singleton_demes::SingletonDemesLineageStore, origin_sampler::{ @@ -24,11 +24,11 @@ use crate::{Scenario, ScenarioCogs, ScenarioParameters}; use super::Sample; -#[allow(clippy::module_name_repetitions, clippy::empty_enum)] +#[expect(clippy::empty_enum)] +#[derive(Debug)] pub enum AlmostInfiniteClark2DtDispersalScenario {} #[derive(Debug, Serialize, Deserialize)] -#[allow(clippy::module_name_repetitions)] #[serde(rename = "AlmostInfiniteClark2DtDispersal")] pub struct AlmostInfiniteClark2DtDispersalArguments { pub sample: Sample, diff --git a/rustcoalescence/scenarios/src/almost_infinite/downscaled.rs b/rustcoalescence/scenarios/src/almost_infinite/downscaled.rs new file mode 100644 index 000000000..4e8909f6a --- /dev/null +++ b/rustcoalescence/scenarios/src/almost_infinite/downscaled.rs @@ -0,0 +1,161 @@ +use std::{marker::PhantomData, num::NonZeroU32}; + +use serde::{Deserialize, Serialize}; + +use necsim_core::cogs::{LineageStore, MathsCore, RngCore, SpeciationProbability, TurnoverRate}; +use necsim_core_bond::OpenClosedUnitF64 as PositiveUnitF64; +use necsim_partitioning_core::partition::Partition; + +use necsim_impls_no_std::{ + cogs::{ + dispersal_sampler::almost_infinite::downscaled::{ + AlmostInfiniteDownscaledDispersalSampler, NonSelfDispersal, + }, + habitat::almost_infinite::{ + downscaled::{AlmostInfiniteDownscaledHabitat, Log2U16}, + AlmostInfiniteHabitat, + }, + origin_sampler::{ + pre_sampler::OriginPreSampler, + singleton_demes::downscaled::AlmostInfiniteDownscaledOriginSampler, + }, + }, + decomposition::Decomposition, +}; + +use crate::{Scenario, ScenarioCogs, ScenarioParameters}; + +pub struct AlmostInfiniteDownscaledScenario< + M: MathsCore, + G: RngCore, + O: Scenario>, +> { + _marker: PhantomData<(M, G, O)>, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct Downscale { + pub x: Log2U16, + pub y: Log2U16, + #[serde(default = "default_downscale_samples")] + pub samples: NonZeroU32, + #[serde(default = "default_non_self_dispersal")] + pub non_self_dispersal: NonSelfDispersal, +} + +fn default_downscale_samples() -> NonZeroU32 { + (NonZeroU32::MIN.saturating_add(1)).saturating_pow(22) +} + +fn default_non_self_dispersal() -> NonSelfDispersal { + NonSelfDispersal::AccurateRejectionSampling +} + +#[derive(Debug, Serialize, Deserialize)] +#[serde(rename = "AlmostInfiniteDownscaled")] +#[serde(bound = "O::Arguments: serde::Serialize + serde::de::DeserializeOwned")] +pub struct AlmostInfiniteDownscaledArguments { + #[serde(flatten)] + pub args: O::Arguments, + pub downscale: Downscale, +} + +impl< + M: MathsCore, + G: RngCore, + O: Scenario< + M, + G, + Habitat = AlmostInfiniteHabitat, + Decomposition: Decomposition>, + SpeciationProbability: SpeciationProbability>, + TurnoverRate: TurnoverRate>, + >, + > ScenarioParameters for AlmostInfiniteDownscaledScenario +{ + type Arguments = AlmostInfiniteDownscaledArguments; + type Error = O::Error; +} + +impl< + M: MathsCore, + G: RngCore, + O: Scenario< + M, + G, + Habitat = AlmostInfiniteHabitat, + Decomposition: Decomposition>, + SpeciationProbability: SpeciationProbability>, + TurnoverRate: TurnoverRate>, + >, + > Scenario for AlmostInfiniteDownscaledScenario +{ + type Decomposition = O::Decomposition; + type DecompositionAuxiliary = O::DecompositionAuxiliary; + type DispersalSampler = AlmostInfiniteDownscaledDispersalSampler; + type Habitat = AlmostInfiniteDownscaledHabitat; + type LineageStore> = L; + type OriginSampler<'h, I: Iterator> = AlmostInfiniteDownscaledOriginSampler<'h, M, O::OriginSampler<'h, I>> where G: 'h, O: 'h; + type OriginSamplerAuxiliary = O::OriginSamplerAuxiliary; + type SpeciationProbability = O::SpeciationProbability; + type TurnoverRate = O::TurnoverRate; + + fn new( + args: Self::Arguments, + speciation_probability_per_generation: PositiveUnitF64, + ) -> Result, Self::Error> { + let ScenarioCogs { + habitat, + dispersal_sampler, + turnover_rate, + speciation_probability, + origin_sampler_auxiliary, + decomposition_auxiliary, + _marker, + } = O::new(args.args, speciation_probability_per_generation)?; + + let habitat = AlmostInfiniteDownscaledHabitat::new_with_habitat( + habitat, + args.downscale.x, + args.downscale.y, + ); + let dispersal_sampler = AlmostInfiniteDownscaledDispersalSampler::new( + &habitat, + dispersal_sampler, + args.downscale.samples, + args.downscale.non_self_dispersal, + ); + + Ok(ScenarioCogs { + habitat, + dispersal_sampler, + turnover_rate, + speciation_probability, + origin_sampler_auxiliary, + decomposition_auxiliary, + _marker: PhantomData::<(M, G, Self)>, + }) + } + + fn sample_habitat<'h, I: Iterator>( + habitat: &'h Self::Habitat, + pre_sampler: OriginPreSampler, + auxiliary: Self::OriginSamplerAuxiliary, + ) -> Self::OriginSampler<'h, I> + where + G: 'h, + { + AlmostInfiniteDownscaledOriginSampler::new( + O::sample_habitat(habitat.unscaled(), pre_sampler, auxiliary), + habitat, + ) + } + + fn decompose( + habitat: &Self::Habitat, + subdomain: Partition, + auxiliary: Self::DecompositionAuxiliary, + ) -> Self::Decomposition { + O::decompose(habitat.unscaled(), subdomain, auxiliary) + } +} diff --git a/rustcoalescence/scenarios/src/almost_infinite/mod.rs b/rustcoalescence/scenarios/src/almost_infinite/mod.rs index ddff85528..3e021b562 100644 --- a/rustcoalescence/scenarios/src/almost_infinite/mod.rs +++ b/rustcoalescence/scenarios/src/almost_infinite/mod.rs @@ -1,4 +1,3 @@ -use either::Either; use necsim_impls_no_std::cogs::{ habitat::almost_infinite::AlmostInfiniteHabitat, origin_sampler::{ @@ -22,46 +21,107 @@ use necsim_core_bond::PositiveF64; #[cfg(feature = "almost-infinite-clark2dt-dispersal")] pub mod clark2dt; +#[cfg(feature = "almost-infinite-downscaled")] +pub mod downscaled; #[cfg(feature = "almost-infinite-normal-dispersal")] pub mod normal; +#[expect(clippy::module_name_repetitions)] #[derive(Debug, Serialize, Deserialize)] -#[allow(clippy::module_name_repetitions)] #[serde(deny_unknown_fields)] #[serde(rename = "AlmostInfinite")] pub struct AlmostInfiniteArguments { sample: Sample, dispersal: Dispersal, + #[cfg(feature = "almost-infinite-downscaled")] + #[serde(default)] + downscale: Option, } -#[cfg(feature = "almost-infinite-normal-dispersal")] -type NormalDispersalArguments = normal::AlmostInfiniteNormalDispersalArguments; -#[cfg(not(feature = "almost-infinite-normal-dispersal"))] -type NormalDispersalArguments = !; - -#[cfg(feature = "almost-infinite-clark2dt-dispersal")] -type Clark2DtDispersalArguments = clark2dt::AlmostInfiniteClark2DtDispersalArguments; -#[cfg(not(feature = "almost-infinite-clark2dt-dispersal"))] -type Clark2DtDispersalArguments = !; +#[expect(clippy::module_name_repetitions)] +pub enum AlmostInfiniteArgumentVariants { + #[cfg(feature = "almost-infinite-normal-dispersal")] + Normal(normal::AlmostInfiniteNormalDispersalArguments), + #[cfg(feature = "almost-infinite-clark2dt-dispersal")] + Clark2Dt(clark2dt::AlmostInfiniteClark2DtDispersalArguments), + #[cfg(all( + feature = "almost-infinite-downscaled", + feature = "almost-infinite-normal-dispersal" + ))] + DownscaledNormal( + downscaled::AlmostInfiniteDownscaledArguments< + normal::AlmostInfiniteNormalDispersalScenario, + >, + ), + #[cfg(all( + feature = "almost-infinite-downscaled", + feature = "almost-infinite-clark2dt-dispersal" + ))] + DownscaledClark2Dt( + downscaled::AlmostInfiniteDownscaledArguments< + clark2dt::AlmostInfiniteClark2DtDispersalScenario, + >, + ), +} impl AlmostInfiniteArguments { #[must_use] - pub fn load(self) -> Either { + pub fn load(self) -> AlmostInfiniteArgumentVariants { match self { #[cfg(feature = "almost-infinite-normal-dispersal")] Self { sample, dispersal: Dispersal::Normal { sigma }, - } => Either::Left(normal::AlmostInfiniteNormalDispersalArguments { sample, sigma }), + #[cfg(feature = "almost-infinite-downscaled")] + downscale: None, + } => AlmostInfiniteArgumentVariants::Normal( + normal::AlmostInfiniteNormalDispersalArguments { sample, sigma }, + ), #[cfg(feature = "almost-infinite-clark2dt-dispersal")] Self { sample, dispersal: Dispersal::Clark2Dt { shape_u, tail_p }, - } => Either::Right(clark2dt::AlmostInfiniteClark2DtDispersalArguments { + #[cfg(feature = "almost-infinite-downscaled")] + downscale: None, + } => AlmostInfiniteArgumentVariants::Clark2Dt( + clark2dt::AlmostInfiniteClark2DtDispersalArguments { + sample, + shape_u, + tail_p, + }, + ), + #[cfg(all( + feature = "almost-infinite-downscaled", + feature = "almost-infinite-normal-dispersal" + ))] + Self { sample, - shape_u, - tail_p, - }), + dispersal: Dispersal::Normal { sigma }, + downscale: Some(downscale), + } => AlmostInfiniteArgumentVariants::DownscaledNormal( + downscaled::AlmostInfiniteDownscaledArguments { + args: normal::AlmostInfiniteNormalDispersalArguments { sample, sigma }, + downscale, + }, + ), + #[cfg(all( + feature = "almost-infinite-downscaled", + feature = "almost-infinite-clark2dt-dispersal" + ))] + Self { + sample, + dispersal: Dispersal::Clark2Dt { shape_u, tail_p }, + downscale: Some(downscale), + } => AlmostInfiniteArgumentVariants::DownscaledClark2Dt( + downscaled::AlmostInfiniteDownscaledArguments { + args: clark2dt::AlmostInfiniteClark2DtDispersalArguments { + sample, + shape_u, + tail_p, + }, + downscale, + }, + ), } } @@ -71,6 +131,8 @@ impl AlmostInfiniteArguments { Self { sample: args.sample.clone(), dispersal: Dispersal::Normal { sigma: args.sigma }, + #[cfg(feature = "almost-infinite-downscaled")] + downscale: None, } } @@ -83,6 +145,47 @@ impl AlmostInfiniteArguments { shape_u: args.shape_u, tail_p: args.tail_p, }, + #[cfg(feature = "almost-infinite-downscaled")] + downscale: None, + } + } + + #[cfg(all( + feature = "almost-infinite-downscaled", + feature = "almost-infinite-normal-dispersal" + ))] + #[must_use] + pub fn from_downscaled_normal( + args: &downscaled::AlmostInfiniteDownscaledArguments< + normal::AlmostInfiniteNormalDispersalScenario, + >, + ) -> Self { + Self { + sample: args.args.sample.clone(), + dispersal: Dispersal::Normal { + sigma: args.args.sigma, + }, + downscale: Some(args.downscale.clone()), + } + } + + #[cfg(all( + feature = "almost-infinite-downscaled", + feature = "almost-infinite-clark2dt-dispersal" + ))] + #[must_use] + pub fn from_downscaled_clark2dt( + args: &downscaled::AlmostInfiniteDownscaledArguments< + clark2dt::AlmostInfiniteClark2DtDispersalScenario, + >, + ) -> Self { + Self { + sample: args.args.sample.clone(), + dispersal: Dispersal::Clark2Dt { + shape_u: args.args.shape_u, + tail_p: args.args.tail_p, + }, + downscale: Some(args.downscale.clone()), } } } diff --git a/rustcoalescence/scenarios/src/almost_infinite/normal.rs b/rustcoalescence/scenarios/src/almost_infinite/normal.rs index d9b3ce13e..d76fd6653 100644 --- a/rustcoalescence/scenarios/src/almost_infinite/normal.rs +++ b/rustcoalescence/scenarios/src/almost_infinite/normal.rs @@ -8,7 +8,7 @@ use necsim_partitioning_core::partition::Partition; use necsim_impls_no_std::{ cogs::{ - dispersal_sampler::almost_infinite_normal::AlmostInfiniteNormalDispersalSampler, + dispersal_sampler::almost_infinite::normal::AlmostInfiniteNormalDispersalSampler, habitat::almost_infinite::AlmostInfiniteHabitat, lineage_store::coherent::globally::singleton_demes::SingletonDemesLineageStore, origin_sampler::{ @@ -24,11 +24,11 @@ use crate::{Scenario, ScenarioCogs, ScenarioParameters}; use super::Sample; -#[allow(clippy::module_name_repetitions, clippy::empty_enum)] +#[expect(clippy::empty_enum)] +#[derive(Debug)] pub enum AlmostInfiniteNormalDispersalScenario {} #[derive(Debug, Serialize, Deserialize)] -#[allow(clippy::module_name_repetitions)] #[serde(rename = "AlmostInfiniteNormalDispersal")] pub struct AlmostInfiniteNormalDispersalArguments { pub sample: Sample, diff --git a/rustcoalescence/scenarios/src/lib.rs b/rustcoalescence/scenarios/src/lib.rs index 3f8f48b3f..2868f26a0 100644 --- a/rustcoalescence/scenarios/src/lib.rs +++ b/rustcoalescence/scenarios/src/lib.rs @@ -1,7 +1,7 @@ #![deny(clippy::pedantic)] #![feature(never_type)] -#[allow(unused_imports)] +#[allow(unused_imports)] // FIXME: use expect #[macro_use] extern crate log; diff --git a/rustcoalescence/scenarios/src/non_spatial.rs b/rustcoalescence/scenarios/src/non_spatial.rs index 3becbd0a7..b4ead8f5a 100644 --- a/rustcoalescence/scenarios/src/non_spatial.rs +++ b/rustcoalescence/scenarios/src/non_spatial.rs @@ -19,11 +19,11 @@ use necsim_impls_no_std::{ use crate::{Scenario, ScenarioCogs, ScenarioParameters}; -#[allow(clippy::module_name_repetitions, clippy::empty_enum)] +#[expect(clippy::module_name_repetitions, clippy::empty_enum)] pub enum NonSpatialScenario {} #[derive(Clone, Debug, Serialize, Deserialize)] -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[serde(deny_unknown_fields)] #[serde(rename = "NonSpatial")] pub struct NonSpatialArguments { diff --git a/rustcoalescence/scenarios/src/spatially_explicit/maps/mod.rs b/rustcoalescence/scenarios/src/spatially_explicit/maps/mod.rs index 0817cbaed..592f8418e 100644 --- a/rustcoalescence/scenarios/src/spatially_explicit/maps/mod.rs +++ b/rustcoalescence/scenarios/src/spatially_explicit/maps/mod.rs @@ -107,7 +107,7 @@ fn fix_habitat_map( if h_before <= 1 { // If there is no turnover, there cannot be habitat at this location // If there is any dispersal from this location, it must be habitat - #[allow(clippy::bool_to_int_with_if)] + #[expect(clippy::bool_to_int_with_if)] let h_fixed = if turnover.map_or(false, |turnover| turnover[(y, x)] == 0.0_f64) { 0 } else if dispersal diff --git a/rustcoalescence/scenarios/src/spatially_explicit/maps/tiff/data_type.rs b/rustcoalescence/scenarios/src/spatially_explicit/maps/tiff/data_type.rs index 19a09d29e..6b2284852 100644 --- a/rustcoalescence/scenarios/src/spatially_explicit/maps/tiff/data_type.rs +++ b/rustcoalescence/scenarios/src/spatially_explicit/maps/tiff/data_type.rs @@ -1,6 +1,6 @@ use tiff::{decoder::DecodingResult, tags::SampleFormat}; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub trait TiffDataType: Clone + std::fmt::Debug diff --git a/rustcoalescence/scenarios/src/spatially_explicit/maps/tiff/mod.rs b/rustcoalescence/scenarios/src/spatially_explicit/maps/tiff/mod.rs index fb32932a3..f72c89a18 100644 --- a/rustcoalescence/scenarios/src/spatially_explicit/maps/tiff/mod.rs +++ b/rustcoalescence/scenarios/src/spatially_explicit/maps/tiff/mod.rs @@ -10,11 +10,11 @@ use necsim_impls_no_std::array2d::Array2D; mod data_type; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub trait TiffDataType: data_type::TiffDataType {} impl TiffDataType for T {} -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] /// Loads a 2D map from TIFF file at `path` with the data type `D`. /// /// This function assumes that normal, non-sparse TIFF files are read. diff --git a/rustcoalescence/scenarios/src/spatially_explicit/mod.rs b/rustcoalescence/scenarios/src/spatially_explicit/mod.rs index 25b38ec51..fcd92238e 100644 --- a/rustcoalescence/scenarios/src/spatially_explicit/mod.rs +++ b/rustcoalescence/scenarios/src/spatially_explicit/mod.rs @@ -5,8 +5,8 @@ mod turnover; feature = "spatially-explicit-uniform-turnover", feature = "spatially-explicit-turnover-map", ))] -#[allow(clippy::module_name_repetitions)] -pub use turnover::SpatiallyExplicitArguments; +#[allow(clippy::module_name_repetitions)] // FIXME: use expect +pub use turnover::{SpatiallyExplicitArgumentVariants, SpatiallyExplicitArguments}; #[cfg(feature = "spatially-explicit-turnover-map")] pub use turnover::map; diff --git a/rustcoalescence/scenarios/src/spatially_explicit/turnover/map.rs b/rustcoalescence/scenarios/src/spatially_explicit/turnover/map.rs index 32a929b7c..031fd7384 100644 --- a/rustcoalescence/scenarios/src/spatially_explicit/turnover/map.rs +++ b/rustcoalescence/scenarios/src/spatially_explicit/turnover/map.rs @@ -29,7 +29,6 @@ use crate::{Scenario, ScenarioCogs, ScenarioParameters}; use super::super::maps::{self, MapLoadingMode}; -#[allow(clippy::module_name_repetitions, clippy::enum_variant_names)] #[derive(thiserror::Error, displaydoc::Display, Debug)] pub enum SpatiallyExplicitTurnoverMapScenarioError { /// invalid habitat map: no habitable locations @@ -40,7 +39,7 @@ pub enum SpatiallyExplicitTurnoverMapScenarioError { TurnoverMap(InMemoryTurnoverRateError), } -#[allow(clippy::module_name_repetitions, clippy::empty_enum)] +#[expect(clippy::empty_enum)] pub enum SpatiallyExplicitTurnoverMapScenario {} impl ScenarioParameters for SpatiallyExplicitTurnoverMapScenario { @@ -121,7 +120,6 @@ impl> Scenario for SpatiallyExplicitTurnoverMa #[derive(Debug, Deserialize)] #[serde(try_from = "SpatiallyExplicitTurnoverMapArgumentsRaw")] -#[allow(clippy::module_name_repetitions)] pub struct SpatiallyExplicitTurnoverMapArguments { pub habitat_path: PathBuf, pub habitat_map: Array2D, @@ -133,7 +131,7 @@ pub struct SpatiallyExplicitTurnoverMapArguments { } impl SpatiallyExplicitTurnoverMapArguments { - #[allow(clippy::missing_errors_doc)] + #[expect(clippy::missing_errors_doc)] pub fn try_load( habitat_path: PathBuf, dispersal_path: PathBuf, @@ -222,7 +220,6 @@ impl TryFrom for SpatiallyExplicitTurn } #[derive(Debug, Serialize, Deserialize)] -#[allow(clippy::module_name_repetitions)] #[serde(deny_unknown_fields)] #[serde(rename = "SpatiallyExplicitTurnoverMap")] struct SpatiallyExplicitTurnoverMapArgumentsRaw { diff --git a/rustcoalescence/scenarios/src/spatially_explicit/turnover/mod.rs b/rustcoalescence/scenarios/src/spatially_explicit/turnover/mod.rs index 07c3ec704..47187cb91 100644 --- a/rustcoalescence/scenarios/src/spatially_explicit/turnover/mod.rs +++ b/rustcoalescence/scenarios/src/spatially_explicit/turnover/mod.rs @@ -1,6 +1,5 @@ use std::path::PathBuf; -use either::Either; use serde::{Deserialize, Serialize}; use super::maps::MapLoadingMode; @@ -9,7 +8,6 @@ pub mod map; pub mod uniform; #[derive(Debug, Serialize, Deserialize)] -#[allow(clippy::module_name_repetitions)] #[serde(deny_unknown_fields)] #[serde(rename = "SpatiallyExplicit")] pub struct SpatiallyExplicitArguments { @@ -27,21 +25,16 @@ pub struct SpatiallyExplicitArguments { loading_mode: MapLoadingMode, } -#[cfg(feature = "spatially-explicit-uniform-turnover")] -type UniformTurnoverArguments = uniform::SpatiallyExplicitUniformTurnoverArguments; -#[cfg(not(feature = "spatially-explicit-uniform-turnover"))] -type UniformTurnoverArguments = !; - -#[cfg(feature = "spatially-explicit-turnover-map")] -type TurnoverMapArguments = map::SpatiallyExplicitTurnoverMapArguments; -#[cfg(not(feature = "spatially-explicit-turnover-map"))] -type TurnoverMapArguments = !; +pub enum SpatiallyExplicitArgumentVariants { + #[cfg(feature = "spatially-explicit-uniform-turnover")] + UniformTurnover(uniform::SpatiallyExplicitUniformTurnoverArguments), + #[cfg(feature = "spatially-explicit-turnover-map")] + TurnoverMap(map::SpatiallyExplicitTurnoverMapArguments), +} impl SpatiallyExplicitArguments { - #[allow(clippy::missing_errors_doc)] - pub fn try_load( - self, - ) -> Result, String> { + #[expect(clippy::missing_errors_doc)] + pub fn try_load(self) -> Result { match self { #[cfg(feature = "spatially-explicit-uniform-turnover")] Self { @@ -55,7 +48,7 @@ impl SpatiallyExplicitArguments { turnover_rate, loading_mode, ) - .map(Either::Left), + .map(SpatiallyExplicitArgumentVariants::UniformTurnover), #[cfg(feature = "spatially-explicit-turnover-map")] Self { habitat_map, @@ -68,7 +61,7 @@ impl SpatiallyExplicitArguments { turnover_map, loading_mode, ) - .map(Either::Right), + .map(SpatiallyExplicitArgumentVariants::TurnoverMap), } } diff --git a/rustcoalescence/scenarios/src/spatially_explicit/turnover/uniform.rs b/rustcoalescence/scenarios/src/spatially_explicit/turnover/uniform.rs index 1b7538cfb..030da3b6e 100644 --- a/rustcoalescence/scenarios/src/spatially_explicit/turnover/uniform.rs +++ b/rustcoalescence/scenarios/src/spatially_explicit/turnover/uniform.rs @@ -29,7 +29,6 @@ use crate::{Scenario, ScenarioCogs, ScenarioParameters}; use super::super::maps::{self, MapLoadingMode}; -#[allow(clippy::module_name_repetitions, clippy::enum_variant_names)] #[derive(thiserror::Error, displaydoc::Display, Debug)] pub enum SpatiallyExplicitUniformTurnoverScenarioError { /// invalid habitat map: no habitable locations @@ -38,7 +37,7 @@ pub enum SpatiallyExplicitUniformTurnoverScenarioError { DispersalMap(InMemoryDispersalSamplerError), } -#[allow(clippy::module_name_repetitions, clippy::empty_enum)] +#[expect(clippy::empty_enum)] pub enum SpatiallyExplicitUniformTurnoverScenario {} impl ScenarioParameters for SpatiallyExplicitUniformTurnoverScenario { @@ -118,7 +117,6 @@ impl> Scenario for SpatiallyExplicitUniformTur #[derive(Debug, Deserialize)] #[serde(try_from = "SpatiallyExplicitUniformTurnoverArgumentsRaw")] -#[allow(clippy::module_name_repetitions)] pub struct SpatiallyExplicitUniformTurnoverArguments { pub habitat_path: PathBuf, pub habitat_map: Array2D, @@ -129,7 +127,7 @@ pub struct SpatiallyExplicitUniformTurnoverArguments { } impl SpatiallyExplicitUniformTurnoverArguments { - #[allow(clippy::missing_errors_doc)] + #[expect(clippy::missing_errors_doc)] pub fn try_load( habitat_path: PathBuf, dispersal_path: PathBuf, @@ -203,7 +201,6 @@ impl TryFrom } #[derive(Debug, Serialize, Deserialize)] -#[allow(clippy::module_name_repetitions)] #[serde(deny_unknown_fields)] #[serde(rename = "SpatiallyExplicitUniformTurnover")] struct SpatiallyExplicitUniformTurnoverArgumentsRaw { diff --git a/rustcoalescence/scenarios/src/spatially_implicit.rs b/rustcoalescence/scenarios/src/spatially_implicit.rs index a919b318b..6f7b761ff 100644 --- a/rustcoalescence/scenarios/src/spatially_implicit.rs +++ b/rustcoalescence/scenarios/src/spatially_implicit.rs @@ -21,11 +21,11 @@ use necsim_impls_no_std::{ use crate::{Scenario, ScenarioCogs, ScenarioParameters}; -#[allow(clippy::module_name_repetitions, clippy::empty_enum)] +#[expect(clippy::module_name_repetitions, clippy::empty_enum)] pub enum SpatiallyImplicitScenario {} #[derive(Clone, Debug, Serialize, Deserialize)] -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[serde(deny_unknown_fields)] #[serde(rename = "SpatiallyImplicit")] pub struct SpatiallyImplicitArguments { diff --git a/rustcoalescence/scenarios/src/wrapping_noise.rs b/rustcoalescence/scenarios/src/wrapping_noise.rs index b04cd597d..7253cdb5a 100644 --- a/rustcoalescence/scenarios/src/wrapping_noise.rs +++ b/rustcoalescence/scenarios/src/wrapping_noise.rs @@ -26,12 +26,12 @@ use necsim_impls_no_std::{ use crate::{Scenario, ScenarioCogs, ScenarioParameters}; -#[allow(clippy::module_name_repetitions, clippy::empty_enum)] +#[expect(clippy::module_name_repetitions, clippy::empty_enum)] #[derive(Clone)] pub enum WrappingNoiseScenario {} #[derive(Clone, Debug, Serialize, Deserialize)] -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[serde(deny_unknown_fields)] #[serde(rename = "WrappingNoise")] pub struct WrappingNoiseArguments { diff --git a/rustcoalescence/src/args/cli/replay.rs b/rustcoalescence/src/args/cli/replay.rs index 5b650149d..4ebacaa60 100644 --- a/rustcoalescence/src/args/cli/replay.rs +++ b/rustcoalescence/src/args/cli/replay.rs @@ -6,7 +6,7 @@ use necsim_plugins_core::import::{AnyReporterPluginVec, ReporterPluginLibrary}; #[derive(Serialize, Debug)] #[serde(rename = "Replay")] -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct ReplayArgs { #[serde(rename = "log", alias = "event_log")] pub event_log: EventLogReplay, @@ -15,7 +15,7 @@ pub struct ReplayArgs { } #[derive(Copy, Clone, Debug, Serialize, Deserialize)] -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[serde(deny_unknown_fields)] pub enum ReplayMode { Strict, @@ -96,7 +96,6 @@ impl<'de> Deserialize<'de> for ReplayArgs { } #[derive(Deserialize)] -#[allow(clippy::module_name_repetitions)] #[serde(deny_unknown_fields)] #[serde(rename = "Replay")] struct ReplayArgsRaw { diff --git a/rustcoalescence/src/args/config/algorithm.rs b/rustcoalescence/src/args/config/algorithm.rs index 280bf3298..969998b1d 100644 --- a/rustcoalescence/src/args/config/algorithm.rs +++ b/rustcoalescence/src/args/config/algorithm.rs @@ -35,7 +35,7 @@ pub enum Algorithm { impl Serialize for Algorithm { fn serialize(&self, serializer: S) -> Result { - #[allow(unreachable_patterns, clippy::single_match_else)] + #[allow(unreachable_patterns)] // FIXME: use expect match self { #[cfg(feature = "gillespie-algorithms")] Self::Gillespie(args) => { diff --git a/rustcoalescence/src/args/config/pause.rs b/rustcoalescence/src/args/config/pause.rs index 80a057457..e656d723a 100644 --- a/rustcoalescence/src/args/config/pause.rs +++ b/rustcoalescence/src/args/config/pause.rs @@ -21,7 +21,7 @@ pub struct Pause { pub mode: PauseMode, } -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug, Serialize, Deserialize)] pub enum PauseMode { Resume, @@ -49,7 +49,7 @@ pub struct ResumeConfig { temp: bool, } -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug, Serialize)] #[serde(rename = "Pause")] pub struct FuturePause { @@ -85,7 +85,7 @@ impl<'de> DeserializeState<'de, PartitionSize> for Pause { } } -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug, Deserialize)] #[serde(deny_unknown_fields)] #[serde(rename = "Pause")] diff --git a/rustcoalescence/src/args/config/rng/base32.rs b/rustcoalescence/src/args/config/rng/base32.rs index f65a45f19..6d953379f 100644 --- a/rustcoalescence/src/args/config/rng/base32.rs +++ b/rustcoalescence/src/args/config/rng/base32.rs @@ -2,14 +2,13 @@ use std::{fmt, ops::Deref}; use serde::{Deserialize, Deserializer, Serialize, Serializer}; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Clone)] #[repr(transparent)] pub struct Base32String(Box<[u8]>); impl Base32String { #[must_use] - #[allow(dead_code)] pub fn new(bytes: &[u8]) -> Self { Self(bytes.to_vec().into_boxed_slice()) } diff --git a/rustcoalescence/src/args/config/rng/mod.rs b/rustcoalescence/src/args/config/rng/mod.rs index de660dcfa..13e20d068 100644 --- a/rustcoalescence/src/args/config/rng/mod.rs +++ b/rustcoalescence/src/args/config/rng/mod.rs @@ -18,7 +18,6 @@ pub enum Rng> { State(Base32RngState), } -#[allow(dead_code)] pub struct Base32RngState> { rng: G, marker: PhantomData, @@ -83,8 +82,8 @@ impl> From for Base32RngState { } impl> Base32RngState { + #[allow(dead_code)] // FIXME: use expect #[must_use] - #[allow(dead_code)] pub fn into(self) -> G { self.rng } diff --git a/rustcoalescence/src/args/config/sample/mod.rs b/rustcoalescence/src/args/config/sample/mod.rs index 4ae056376..a7159105b 100644 --- a/rustcoalescence/src/args/config/sample/mod.rs +++ b/rustcoalescence/src/args/config/sample/mod.rs @@ -30,7 +30,7 @@ impl Default for Sample { } } -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Clone, Serialize)] pub enum SampleOrigin { Habitat, @@ -38,7 +38,7 @@ pub enum SampleOrigin { Bincode(LineageFileLoader), } -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Debug, Clone, Serialize, Deserialize)] pub enum SampleMode { Genesis, @@ -53,7 +53,7 @@ impl Default for SampleMode { } } -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] #[derive(Clone, Debug, Serialize, Deserialize)] pub struct SampleModeRestart { pub after: NonNegativeF64, diff --git a/rustcoalescence/src/args/config/scenario.rs b/rustcoalescence/src/args/config/scenario.rs index 40b093217..061f519e4 100644 --- a/rustcoalescence/src/args/config/scenario.rs +++ b/rustcoalescence/src/args/config/scenario.rs @@ -18,12 +18,22 @@ pub enum Scenario { AlmostInfiniteNormalDispersal(rustcoalescence_scenarios::almost_infinite::normal::AlmostInfiniteNormalDispersalArguments), #[cfg(feature = "almost-infinite-clark2dt-dispersal-scenario")] AlmostInfiniteClark2DtDispersal(rustcoalescence_scenarios::almost_infinite::clark2dt::AlmostInfiniteClark2DtDispersalArguments), + #[cfg(all( + feature = "almost-infinite-normal-dispersal-scenario", + feature = "almost-infinite-downscaled-scenario", + ))] + AlmostInfiniteDownscaledNormalDispersal(rustcoalescence_scenarios::almost_infinite::downscaled::AlmostInfiniteDownscaledArguments), + #[cfg(all( + feature = "almost-infinite-clark2dt-dispersal-scenario", + feature = "almost-infinite-downscaled-scenario", + ))] + AlmostInfiniteDownscaledClark2DtDispersal(rustcoalescence_scenarios::almost_infinite::downscaled::AlmostInfiniteDownscaledArguments), #[cfg(feature = "wrapping-noise-scenario")] WrappingNoise(rustcoalescence_scenarios::wrapping_noise::WrappingNoiseArguments), } impl Serialize for Scenario { - #[allow(unused_variables)] + #[allow(unused_variables)] // FIXME: use expect fn serialize(&self, serializer: S) -> Result { let scenario: ScenarioRaw = match *self { #[cfg(feature = "spatially-explicit-uniform-turnover-scenario")] @@ -46,11 +56,25 @@ impl Serialize for Scenario { Self::AlmostInfiniteClark2DtDispersal(ref args) => ScenarioRaw::AlmostInfinite( rustcoalescence_scenarios::almost_infinite::AlmostInfiniteArguments::from_clark2dt(args), ), + #[cfg(all( + feature = "almost-infinite-normal-dispersal-scenario", + feature = "almost-infinite-downscaled-scenario", + ))] + Self::AlmostInfiniteDownscaledNormalDispersal(ref args) => ScenarioRaw::AlmostInfinite( + rustcoalescence_scenarios::almost_infinite::AlmostInfiniteArguments::from_downscaled_normal(args), + ), + #[cfg(all( + feature = "almost-infinite-clark2dt-dispersal-scenario", + feature = "almost-infinite-downscaled-scenario", + ))] + Self::AlmostInfiniteDownscaledClark2DtDispersal(ref args) => ScenarioRaw::AlmostInfinite( + rustcoalescence_scenarios::almost_infinite::AlmostInfiniteArguments::from_downscaled_clark2dt(args), + ), #[cfg(feature = "wrapping-noise-scenario")] Self::WrappingNoise(ref args) => ScenarioRaw::WrappingNoise(args.clone()), }; - #[allow(unreachable_code)] + #[allow(unreachable_code)] // FIXME: use expect scenario.serialize(serializer) } } @@ -62,19 +86,11 @@ impl<'de> Deserialize<'de> for Scenario { feature = "spatially-explicit-uniform-turnover-scenario", feature = "spatially-explicit-turnover-map-scenario", ))] - ScenarioRaw::SpatiallyExplicit(args) => { - match args.try_load().map_err(serde::de::Error::custom)? { - #[allow(clippy::match_single_binding)] - either::Either::Left(args) => match args { - #[cfg(feature = "spatially-explicit-uniform-turnover-scenario")] - args => Ok(Self::SpatiallyExplicitUniformTurnover(args)), - }, - #[allow(clippy::match_single_binding)] - either::Either::Right(args) => match args { - #[cfg(feature = "spatially-explicit-turnover-map-scenario")] - args => Ok(Self::SpatiallyExplicitTurnoverMap(args)), - }, - } + ScenarioRaw::SpatiallyExplicit(args) => match args.try_load().map_err(serde::de::Error::custom)? { + #[cfg(feature = "spatially-explicit-uniform-turnover-scenario")] + rustcoalescence_scenarios::spatially_explicit::SpatiallyExplicitArgumentVariants::UniformTurnover(args) => Ok(Self::SpatiallyExplicitUniformTurnover(args)), + #[cfg(feature = "spatially-explicit-turnover-map-scenario")] + rustcoalescence_scenarios::spatially_explicit::SpatiallyExplicitArgumentVariants::TurnoverMap(args) => Ok(Self::SpatiallyExplicitTurnoverMap(args)), }, #[cfg(feature = "non-spatial-scenario")] ScenarioRaw::NonSpatial(args) => Ok(Self::NonSpatial(args)), @@ -85,16 +101,20 @@ impl<'de> Deserialize<'de> for Scenario { feature = "almost-infinite-clark2dt-dispersal-scenario", ))] ScenarioRaw::AlmostInfinite(args) => match args.load() { - #[allow(clippy::match_single_binding)] - either::Either::Left(args) => match args { - #[cfg(feature = "almost-infinite-normal-dispersal-scenario")] - args => Ok(Self::AlmostInfiniteNormalDispersal(args)), - }, - #[allow(clippy::match_single_binding)] - either::Either::Right(args) => match args { - #[cfg(feature = "almost-infinite-clark2dt-dispersal-scenario")] - args => Ok(Self::AlmostInfiniteClark2DtDispersal(args)), - }, + #[cfg(feature = "almost-infinite-normal-dispersal-scenario")] + rustcoalescence_scenarios::almost_infinite::AlmostInfiniteArgumentVariants::Normal(args) => Ok(Self::AlmostInfiniteNormalDispersal(args)), + #[cfg(feature = "almost-infinite-clark2dt-dispersal-scenario")] + rustcoalescence_scenarios::almost_infinite::AlmostInfiniteArgumentVariants::Clark2Dt(args) => Ok(Self::AlmostInfiniteClark2DtDispersal(args)), + #[cfg(all( + feature = "almost-infinite-normal-dispersal-scenario", + feature = "almost-infinite-downscaled-scenario", + ))] + rustcoalescence_scenarios::almost_infinite::AlmostInfiniteArgumentVariants::DownscaledNormal(args) => Ok(Self::AlmostInfiniteDownscaledNormalDispersal(args)), + #[cfg(all( + feature = "almost-infinite-clark2dt-dispersal-scenario", + feature = "almost-infinite-downscaled-scenario", + ))] + rustcoalescence_scenarios::almost_infinite::AlmostInfiniteArgumentVariants::DownscaledClark2Dt(args) => Ok(Self::AlmostInfiniteDownscaledClark2DtDispersal(args)), }, #[cfg(feature = "wrapping-noise-scenario")] ScenarioRaw::WrappingNoise(args) => Ok(Self::WrappingNoise(args)), diff --git a/rustcoalescence/src/args/utils/parse.rs b/rustcoalescence/src/args/utils/parse.rs index 9ca6670f6..9406f3687 100644 --- a/rustcoalescence/src/args/utils/parse.rs +++ b/rustcoalescence/src/args/utils/parse.rs @@ -3,7 +3,7 @@ use ron::{extensions::Extensions, ser::PrettyConfig, Options}; use serde::{Deserialize, Serialize}; use serde_state::DeserializeState; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub fn try_parse<'de, D: Deserialize<'de>>(subcommand: &str, ron_args: &'de str) -> Result { try_parse_inner(subcommand, ron_args, |de| D::deserialize(de)) } diff --git a/rustcoalescence/src/args/utils/ser/impl.rs b/rustcoalescence/src/args/utils/ser/impl.rs index 05aef6293..2534b6703 100644 --- a/rustcoalescence/src/args/utils/ser/impl.rs +++ b/rustcoalescence/src/args/utils/ser/impl.rs @@ -520,7 +520,7 @@ impl Serializer for BufferingSerializer { } impl Serialize for BufferingSerialize { - #[allow(clippy::too_many_lines)] + #[expect(clippy::too_many_lines)] fn serialize(&self, serializer: S) -> Result { match self { Self::Bool(v) => serializer.serialize_bool(*v), @@ -558,7 +558,7 @@ impl Serialize for BufferingSerialize { Self::Seq { len, elements } => { let mut seq = serializer.serialize_seq(*len)?; - for element in elements.iter() { + for element in elements { seq.serialize_element(element)?; } @@ -567,7 +567,7 @@ impl Serialize for BufferingSerialize { Self::Tuple { len, fields } => { let mut tuple = serializer.serialize_tuple(*len)?; - for field in fields.iter() { + for field in fields { tuple.serialize_element(field)?; } @@ -576,7 +576,7 @@ impl Serialize for BufferingSerialize { Self::TupleStruct { name, len, fields } => { let mut tuple_struct = serializer.serialize_tuple_struct(name, *len)?; - for field in fields.iter() { + for field in fields { tuple_struct.serialize_field(field)?; } @@ -592,7 +592,7 @@ impl Serialize for BufferingSerialize { let mut tuple_variant = serializer.serialize_tuple_variant(name, *variant_index, variant, *len)?; - for field in fields.iter() { + for field in fields { tuple_variant.serialize_field(field)?; } @@ -601,7 +601,7 @@ impl Serialize for BufferingSerialize { Self::Map { len, entries } => { let mut map = serializer.serialize_map(*len)?; - for (key, value) in entries.iter() { + for (key, value) in entries { match (key, value) { (None, None) => (), (Some(key), None) => map.serialize_key(key)?, @@ -615,7 +615,7 @@ impl Serialize for BufferingSerialize { Self::Struct { name, len, fields } => { let mut r#struct = serializer.serialize_struct(name, *len)?; - for (key, value) in fields.iter() { + for (key, value) in fields { if let Some(value) = value { r#struct.serialize_field(key, value)?; } else { @@ -635,7 +635,7 @@ impl Serialize for BufferingSerialize { let mut struct_variant = serializer.serialize_struct_variant(name, *variant_index, variant, *len)?; - for (key, value) in fields.iter() { + for (key, value) in fields { if let Some(value) = value { struct_variant.serialize_field(key, value)?; } else { diff --git a/rustcoalescence/src/cli/replay.rs b/rustcoalescence/src/cli/replay.rs index c7b7d09c7..7a8dd66ca 100644 --- a/rustcoalescence/src/cli/replay.rs +++ b/rustcoalescence/src/cli/replay.rs @@ -10,7 +10,7 @@ use crate::args::{ utils::parse::{try_parse, try_print}, }; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub fn replay_with_logger(replay_args: CommandArgs) -> Result<()> { log::set_max_level(LevelFilter::Info); diff --git a/rustcoalescence/src/cli/simulate/dispatch/fallback.rs b/rustcoalescence/src/cli/simulate/dispatch/fallback.rs index 08ba424e8..0db45828f 100644 --- a/rustcoalescence/src/cli/simulate/dispatch/fallback.rs +++ b/rustcoalescence/src/cli/simulate/dispatch/fallback.rs @@ -11,7 +11,7 @@ use crate::{ use super::super::BufferingSimulateArgsBuilder; -#[allow(clippy::too_many_arguments, clippy::needless_pass_by_value)] +#[expect(clippy::too_many_arguments, clippy::needless_pass_by_value)] pub(in super::super) fn dispatch( _partitioning: Partitioning, _event_log: Option, diff --git a/rustcoalescence/src/cli/simulate/dispatch/valid/algorithm_scenario.rs b/rustcoalescence/src/cli/simulate/dispatch/valid/algorithm_scenario.rs index af937924c..6053e63aa 100644 --- a/rustcoalescence/src/cli/simulate/dispatch/valid/algorithm_scenario.rs +++ b/rustcoalescence/src/cli/simulate/dispatch/valid/algorithm_scenario.rs @@ -1,4 +1,9 @@ -use necsim_core::reporter::Reporter; +use std::marker::PhantomData; + +use necsim_core::{ + cogs::{MathsCore, RngCore}, + reporter::Reporter, +}; use necsim_core_bond::{NonNegativeF64, OpenClosedUnitF64 as PositiveUnitF64}; use necsim_impls_std::event_log::recorder::EventLogConfig; use necsim_partitioning_core::reporter::ReporterContext; @@ -16,6 +21,14 @@ use rustcoalescence_algorithms_independent::IndependentAlgorithm; #[cfg(feature = "almost-infinite-clark2dt-dispersal-scenario")] use rustcoalescence_scenarios::almost_infinite::clark2dt::AlmostInfiniteClark2DtDispersalScenario; +#[cfg(all( + any( + feature = "almost-infinite-clark2dt-dispersal-scenario", + feature = "almost-infinite-normal-dispersal-scenario", + ), + feature = "almost-infinite-downscaled-scenario", +))] +use rustcoalescence_scenarios::almost_infinite::downscaled::AlmostInfiniteDownscaledScenario; #[cfg(feature = "almost-infinite-normal-dispersal-scenario")] use rustcoalescence_scenarios::almost_infinite::normal::AlmostInfiniteNormalDispersalScenario; #[cfg(feature = "non-spatial-scenario")] @@ -44,16 +57,16 @@ macro_rules! match_scenario_algorithm { ( ($algorithm:expr, $scenario:expr => $algscen:ident : $algscenty:ident) { $($(#[$algmeta:meta])* $algpat:pat => $algcode:block),* - <=> - $($(#[$scenmeta:meta])* $scenpat:pat => $scencode:block => $scenty:ident),* + [<=>] + $($(#[$scenmeta:meta])* $scenpat:pat => $scencode:block => $scenty:ty),* } ) => { match_scenario_algorithm! { impl ($algorithm, $scenario => $algscen : $algscenty) { $($(#[$algmeta])* $algpat => $algcode),* - <=> + [<=>] $($(#[$scenmeta])* $scenpat => $scencode => $scenty),* - <=> + [<=>] } } }; @@ -61,23 +74,23 @@ macro_rules! match_scenario_algorithm { impl ($algorithm:expr, $scenario:expr => $algscen:ident : $algscenty:ident) { $(#[$algmeta:meta])* $algpat:pat => $algcode:block, $($(#[$algmetarem:meta])* $algpatrem:pat => $algcoderem:block),+ - <=> - $($(#[$scenmeta:meta])* $scenpat:pat => $scencode:block => $scenty:ident),* - <=> + [<=>] + $($(#[$scenmeta:meta])* $scenpat:pat => $scencode:block => $scenty:ty),* + [<=>] $($tail:tt)* } ) => { match_scenario_algorithm! { impl ($algorithm, $scenario => $algscen : $algscenty) { $($(#[$algmetarem])* $algpatrem => $algcoderem),+ - <=> + [<=>] $($(#[$scenmeta])* $scenpat => $scencode => $scenty),* - <=> + [<=>] $($tail)* $(#[$algmeta])* $algpat => { match $scenario { $($(#[$scenmeta])* $scenpat => { - type $algscenty = $scenty; + type $algscenty = PhantomData<(M, G, $scenty)>; let $algscen = $scencode; $algcode }),* @@ -89,9 +102,9 @@ macro_rules! match_scenario_algorithm { ( impl ($algorithm:expr, $scenario:expr => $algscen:ident : $algscenty:ident) { $(#[$algmeta:meta])* $algpat:pat => $algcode:block - <=> - $($(#[$scenmeta:meta])* $scenpat:pat => $scencode:block => $scenty:ident),* - <=> + [<=>] + $($(#[$scenmeta:meta])* $scenpat:pat => $scencode:block => $scenty:ty),* + [<=>] $($tail:tt)* } ) => { @@ -100,7 +113,7 @@ macro_rules! match_scenario_algorithm { $(#[$algmeta])* $algpat => { match $scenario { $($(#[$scenmeta])* $scenpat => { - type $algscenty = $scenty; + type $algscenty = PhantomData<(M, G, $scenty)>; let $algscen = $scencode; $algcode }),* @@ -110,7 +123,7 @@ macro_rules! match_scenario_algorithm { }; } -#[allow(clippy::too_many_arguments, clippy::too_many_lines)] +#[expect(clippy::too_many_arguments, clippy::too_many_lines)] pub(super) fn dispatch>( partitioning: Partitioning, event_log: Option, @@ -133,7 +146,10 @@ pub(super) fn dispatch>( rng::dispatch::< ::MathsCore, ::Rng<_>, - GillespieAlgorithm, ScenarioTy, R, P, + GillespieAlgorithm, ::MathsCore, + ::Rng<_>, + > as ScenarioDispatch>::Scenario, R, P, >( partitioning, event_log, reporter_context, sample, algorithm_args, scenario, @@ -145,7 +161,10 @@ pub(super) fn dispatch>( rng::dispatch::< ::MathsCore, ::Rng<_>, - EventSkippingAlgorithm, ScenarioTy, R, P, + EventSkippingAlgorithm, ::MathsCore, + ::Rng<_>, + > as ScenarioDispatch>::Scenario, R, P, >( partitioning, event_log, reporter_context, sample, algorithm_args, scenario, @@ -157,7 +176,10 @@ pub(super) fn dispatch>( rng::dispatch::< ::MathsCore, ::Rng<_>, - IndependentAlgorithm, ScenarioTy, R, P, + IndependentAlgorithm, ::MathsCore, + ::Rng<_>, + > as ScenarioDispatch>::Scenario, R, P, >( partitioning, event_log, reporter_context, sample, algorithm_args, scenario, @@ -169,14 +191,17 @@ pub(super) fn dispatch>( rng::dispatch::< ::MathsCore, ::Rng<_>, - CudaAlgorithm, ScenarioTy, R, P, + CudaAlgorithm, ::MathsCore, + ::Rng<_>, + > as ScenarioDispatch>::Scenario, R, P, >( partitioning, event_log, reporter_context, sample, algorithm_args, scenario, pause_before, ron_args, normalised_args, ) } - <=> + [<=>] #[cfg(feature = "spatially-explicit-uniform-turnover-scenario")] ScenarioArgs::SpatiallyExplicitUniformTurnover(scenario_args) => { SpatiallyExplicitUniformTurnoverScenario::new( @@ -215,6 +240,28 @@ pub(super) fn dispatch>( ) .into_ok() } => AlmostInfiniteClark2DtDispersalScenario, + #[cfg(all( + feature = "almost-infinite-normal-dispersal-scenario", + feature = "almost-infinite-downscaled-scenario", + ))] + ScenarioArgs::AlmostInfiniteDownscaledNormalDispersal(scenario_args) => { + AlmostInfiniteDownscaledScenario::new( + scenario_args, + speciation_probability_per_generation, + ) + .into_ok() + } => AlmostInfiniteDownscaledScenario, + #[cfg(all( + feature = "almost-infinite-clark2dt-dispersal-scenario", + feature = "almost-infinite-downscaled-scenario", + ))] + ScenarioArgs::AlmostInfiniteDownscaledClark2DtDispersal(scenario_args) => { + AlmostInfiniteDownscaledScenario::new( + scenario_args, + speciation_probability_per_generation, + ) + .into_ok() + } => AlmostInfiniteDownscaledScenario, #[cfg(feature = "spatially-implicit-scenario")] ScenarioArgs::SpatiallyImplicit(scenario_args) => { SpatiallyImplicitScenario::new( @@ -233,3 +280,11 @@ pub(super) fn dispatch>( } => WrappingNoiseScenario }) } + +trait ScenarioDispatch { + type Scenario; +} + +impl, O: Scenario> ScenarioDispatch for PhantomData<(M, G, O)> { + type Scenario = O; +} diff --git a/rustcoalescence/src/cli/simulate/dispatch/valid/info.rs b/rustcoalescence/src/cli/simulate/dispatch/valid/info.rs index 14468e05a..da2d569d4 100644 --- a/rustcoalescence/src/cli/simulate/dispatch/valid/info.rs +++ b/rustcoalescence/src/cli/simulate/dispatch/valid/info.rs @@ -24,8 +24,7 @@ use crate::args::{ use super::{super::super::BufferingSimulateArgsBuilder, partitioning}; -#[allow(dead_code)] -#[allow(clippy::too_many_arguments, clippy::too_many_lines)] +#[expect(clippy::too_many_arguments, clippy::too_many_lines)] pub(super) fn dispatch< M: MathsCore, G: RngCore, diff --git a/rustcoalescence/src/cli/simulate/dispatch/valid/mod.rs b/rustcoalescence/src/cli/simulate/dispatch/valid/mod.rs index eafd3e412..3c6acfb51 100644 --- a/rustcoalescence/src/cli/simulate/dispatch/valid/mod.rs +++ b/rustcoalescence/src/cli/simulate/dispatch/valid/mod.rs @@ -18,7 +18,7 @@ mod partitioning; mod reporter; mod rng; -#[allow(clippy::too_many_arguments)] +#[expect(clippy::too_many_arguments)] pub(in super::super) fn dispatch( partitioning: Partitioning, event_log: Option, diff --git a/rustcoalescence/src/cli/simulate/dispatch/valid/partitioning.rs b/rustcoalescence/src/cli/simulate/dispatch/valid/partitioning.rs index 2d47aff09..883e46ef9 100644 --- a/rustcoalescence/src/cli/simulate/dispatch/valid/partitioning.rs +++ b/rustcoalescence/src/cli/simulate/dispatch/valid/partitioning.rs @@ -19,7 +19,7 @@ use crate::{ use super::launch; -#[allow(clippy::too_many_arguments)] +#[expect(clippy::too_many_arguments)] pub(super) fn dispatch< M: MathsCore, G: RngCore, diff --git a/rustcoalescence/src/cli/simulate/dispatch/valid/reporter.rs b/rustcoalescence/src/cli/simulate/dispatch/valid/reporter.rs index 4f30bdc81..5010d95ef 100644 --- a/rustcoalescence/src/cli/simulate/dispatch/valid/reporter.rs +++ b/rustcoalescence/src/cli/simulate/dispatch/valid/reporter.rs @@ -12,7 +12,7 @@ use crate::{ use super::{super::super::BufferingSimulateArgsBuilder, algorithm_scenario}; -#[allow(clippy::too_many_arguments)] +#[expect(clippy::too_many_arguments)] pub(super) fn dispatch( partitioning: Partitioning, event_log: Option, diff --git a/rustcoalescence/src/cli/simulate/dispatch/valid/rng.rs b/rustcoalescence/src/cli/simulate/dispatch/valid/rng.rs index a1fa2343b..9a39af8d4 100644 --- a/rustcoalescence/src/cli/simulate/dispatch/valid/rng.rs +++ b/rustcoalescence/src/cli/simulate/dispatch/valid/rng.rs @@ -28,7 +28,7 @@ use super::{ info, }; -#[allow(clippy::too_many_arguments)] +#[expect(clippy::too_many_arguments)] pub(super) fn dispatch< M: MathsCore, G: RngCore, diff --git a/rustcoalescence/src/cli/simulate/mod.rs b/rustcoalescence/src/cli/simulate/mod.rs index 604f8c0ce..fd388a152 100644 --- a/rustcoalescence/src/cli/simulate/mod.rs +++ b/rustcoalescence/src/cli/simulate/mod.rs @@ -13,7 +13,7 @@ mod pause; use dispatch::dispatch; -#[allow(dead_code)] +#[allow(dead_code)] // FIXME: use expect enum SimulationOutcome { Done { time: NonNegativeF64, @@ -26,7 +26,7 @@ enum SimulationOutcome { }, } -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub fn simulate_with_logger(simulate_args: CommandArgs) -> anyhow::Result<()> { log::set_max_level(LevelFilter::Info); diff --git a/rustcoalescence/src/cli/simulate/parse/algorithm.rs b/rustcoalescence/src/cli/simulate/parse/algorithm.rs index ec647e02c..47193c802 100644 --- a/rustcoalescence/src/cli/simulate/parse/algorithm.rs +++ b/rustcoalescence/src/cli/simulate/parse/algorithm.rs @@ -12,7 +12,7 @@ pub(in super::super) fn parse_and_normalise( normalised_args: &mut BufferingSimulateArgsBuilder, partitioning: &Partitioning, ) -> anyhow::Result { - let SimulateArgsAlgorithmOnly { algorithm } = + let lint::SimulateArgsAlgorithmOnly { algorithm } = try_parse_state("simulate", ron_args, &mut partitioning.get_size())?; normalised_args.algorithm(&algorithm); @@ -20,10 +20,15 @@ pub(in super::super) fn parse_and_normalise( Ok(algorithm) } -#[derive(DeserializeState)] -#[serde(deserialize_state = "PartitionSize")] -#[serde(rename = "Simulate")] -struct SimulateArgsAlgorithmOnly { - #[serde(deserialize_state)] - algorithm: Algorithm, +#[allow(unreachable_patterns)] // FIXME: use expect +mod lint { + use super::{Algorithm, PartitionSize}; + + #[derive(DeserializeState)] + #[serde(deserialize_state = "PartitionSize")] + #[serde(rename = "Simulate")] + pub struct SimulateArgsAlgorithmOnly { + #[serde(deserialize_state)] + pub algorithm: Algorithm, + } } diff --git a/rustcoalescence/src/cli/simulate/parse/event_log.rs b/rustcoalescence/src/cli/simulate/parse/event_log.rs index e93e63ca1..2b736d7d5 100644 --- a/rustcoalescence/src/cli/simulate/parse/event_log.rs +++ b/rustcoalescence/src/cli/simulate/parse/event_log.rs @@ -1,5 +1,3 @@ -use std::path::Path; - use serde::{Deserialize, Deserializer}; use serde_state::DeserializeState; @@ -38,7 +36,9 @@ pub(in super::super) fn parse_and_normalise( let event_log = match event_log { Some(event_log) - if event_log.directory() == Path::new("I-solemnly-swear-that-I-am-up-to-no-good") => + if event_log + .directory() + .ends_with("I-solemnly-swear-that-I-am-up-to-no-good") => { None }, diff --git a/rustcoalescence/src/cli/simulate/parse/fields.rs b/rustcoalescence/src/cli/simulate/parse/fields.rs index 2949ef5a9..c59812f43 100644 --- a/rustcoalescence/src/cli/simulate/parse/fields.rs +++ b/rustcoalescence/src/cli/simulate/parse/fields.rs @@ -14,7 +14,7 @@ pub fn parse_and_normalise(ron_args: &str) -> anyhow::Result<()> { #[derive(Deserialize)] #[serde(deny_unknown_fields)] #[serde(rename = "Simulate")] -#[allow(dead_code)] +#[expect(dead_code)] struct SimulateArgsFields { #[serde(alias = "speciation_probability_per_generation")] speciation: IgnoredAny, diff --git a/rustcoalescence/src/cli/simulate/parse/rng.rs b/rustcoalescence/src/cli/simulate/parse/rng.rs index 96d165663..815ab09a5 100644 --- a/rustcoalescence/src/cli/simulate/parse/rng.rs +++ b/rustcoalescence/src/cli/simulate/parse/rng.rs @@ -5,7 +5,7 @@ use crate::args::{config::rng::Rng, utils::parse::try_parse_state}; use super::super::BufferingSimulateArgsBuilder; -#[allow(dead_code)] +#[allow(dead_code)] // FIXME: use expect pub(in super::super) fn parse_and_normalise>( ron_args: &str, normalised_args: &mut BufferingSimulateArgsBuilder, diff --git a/rustcoalescence/src/main.rs b/rustcoalescence/src/main.rs index 3c50d5b69..765ab5b7f 100644 --- a/rustcoalescence/src/main.rs +++ b/rustcoalescence/src/main.rs @@ -1,7 +1,6 @@ #![deny(clippy::pedantic)] #![feature(unwrap_infallible)] #![feature(split_array)] -#![feature(result_flattening)] #[macro_use] extern crate serde_derive_state; diff --git a/rustcoalescence/src/reporter.rs b/rustcoalescence/src/reporter.rs index d3490b627..fe2011105 100644 --- a/rustcoalescence/src/reporter.rs +++ b/rustcoalescence/src/reporter.rs @@ -27,7 +27,7 @@ impl DynamicReporterContext { - #[allow(dead_code)] + #[allow(dead_code)] // FIXME: use expect pub fn new( reporter: ReporterPluginVec, ) -> Self { @@ -63,7 +63,7 @@ impl { Monolithic(::FinalisableReporter), #[cfg(feature = "mpi-partitioning")]