From 233c6888eb8d7bb48640c2432074fc9bc3c519cc Mon Sep 17 00:00:00 2001 From: David Walschots Date: Fri, 22 Oct 2021 03:26:09 +0200 Subject: [PATCH] build: upgrade to rust toolchain 1.55 and MSFS SDK 0.15 (#6052) * chore: update dev-env with latest rustc * chore: fix clippy errors * docs: llvm 12 * chore: line ending * chore(unrelated): fix package version * fix: separate build and linking of wasm Restores compatibility with sdk 0.14.0 * fix: indendation and comments * chore: update dev-env with sdk 0.15.0 Co-authored-by: Saschl Co-authored-by: Andreas Guther --- .gitignore | 1 + Cargo.lock | 224 ++++++++++-------- package.json | 2 +- rust-toolchain.toml | 3 + scripts/dev-env/run.cmd | 2 +- scripts/dev-env/run.sh | 2 +- src/fadec/build.sh | 26 +- src/fadec/src/common.h | 1 + src/fbw/build.sh | 45 ++-- src/systems/README.md | 2 +- .../src/main.rs | 26 +- src/systems/a320_systems/src/hydraulic.rs | 26 +- .../systems/src/apu/air_intake_flap.rs | 4 +- .../systems/src/apu/electronic_control_box.rs | 2 +- src/systems/systems/src/apu/mod.rs | 76 +++--- .../src/electrical/engine_generator.rs | 15 +- src/systems/systems/src/electrical/mod.rs | 47 ++-- src/systems/systems/src/engine/mod.rs | 8 +- src/systems/systems/src/hydraulic/mod.rs | 2 +- src/systems/systems/src/navigation/adirs.rs | 48 ++-- src/systems/systems/src/shared/mod.rs | 34 +-- 21 files changed, 303 insertions(+), 293 deletions(-) create mode 100644 rust-toolchain.toml diff --git a/.gitignore b/.gitignore index b0ee753424e..7faf3760994 100644 --- a/.gitignore +++ b/.gitignore @@ -27,6 +27,7 @@ !manifest-base.json !Cargo.lock !Cargo.toml +!rust-toolchain.toml !/.cargo/config.toml !jest.config.js !/jest/** diff --git a/Cargo.lock b/Cargo.lock index 8dd8869aefb..a484ae9b562 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -54,9 +54,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "aho-corasick" -version = "0.7.18" +version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" +checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" dependencies = [ "memchr", ] @@ -98,13 +98,13 @@ checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "backtrace" -version = "0.3.60" +version = "0.3.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7815ea54e4d821e791162e078acbebfd6d8c8939cd559c9335dceb1c8ca7282" +checksum = "4717cfcbfaa661a0fd48f8453951837ae7e8f81e481fbb136e3202d72805a744" dependencies = [ "addr2line", "cc", - "cfg-if 1.0.0", + "cfg-if", "libc", "miniz_oxide", "object", @@ -113,13 +113,12 @@ dependencies = [ [[package]] name = "bindgen" -version = "0.55.1" +version = "0.59.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75b13ce559e6433d360c26305643803cb52cfbabbc2b9c47ce04a58493dfb443" +checksum = "453c49e5950bb0eb63bb3df640e31618846c89d5b7faa54040d76e98e0134375" dependencies = [ "bitflags", "cexpr", - "cfg-if 0.1.10", "clang-sys", "clap", "env_logger", @@ -137,9 +136,21 @@ dependencies = [ [[package]] name = "bitflags" -version = "1.2.1" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitvec" +version = "0.19.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8942c8d352ae1838c9dda0b0ca2ab657696ef2232a20147cf1b30ae1a9cb4321" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] [[package]] name = "byteorder" @@ -149,25 +160,19 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "cc" -version = "1.0.69" +version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e70cc2f62c6ce1868963827bd677764c62d07c3d9a3e1fb1177ee1a9ab199eb2" +checksum = "79c2681d6594606957bbb8631c4b90a7fcaaa72cdb714743a437b156d6a7eedd" [[package]] name = "cexpr" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4aedb84272dbe89af497cf81375129abda4fc0a9e7c5d317498c15cc30c0d27" +checksum = "db507a7679252d2276ed0dd8113c6875ec56d3089f9225b2b42c30cc1f8e5c89" dependencies = [ "nom", ] -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -176,9 +181,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clang-sys" -version = "1.2.0" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "853eda514c284c2287f4bf20ae614f8781f40a81d32ecda6e91449304dfe077c" +checksum = "10612c0ec0e0a1ff0e97980647cb058a6e7aedb913d01d009c406b8b7d0b26ee" dependencies = [ "glob", "libc", @@ -202,9 +207,9 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.7.1" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" +checksum = "a19187fea3ac7e84da7dacf48de0c45d63c6a76f9490dae389aead16c243fce3" dependencies = [ "atty", "humantime", @@ -235,11 +240,17 @@ dependencies = [ "synstructure", ] +[[package]] +name = "funty" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7" + [[package]] name = "futures" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e7e43a803dae2fa37c1f6a8fe121e1f7bf9548b4dfc0522a42f34145dadfc27" +checksum = "a12aa0eb539080d55c3f2d45a67c3b58b6b0773c1a3ca2dfec66d58c97fd66ca" dependencies = [ "futures-channel", "futures-core", @@ -252,9 +263,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e682a68b29a882df0545c143dc3646daefe80ba479bcdede94d5a703de2871e2" +checksum = "5da6ba8c3bb3c165d3c7319fc1cc8304facf1fb8db99c5de877183c08a273888" dependencies = [ "futures-core", "futures-sink", @@ -262,15 +273,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0402f765d8a89a26043b889b26ce3c4679d268fa6bb22cd7c6aad98340e179d1" +checksum = "88d1c26957f23603395cd326b0ffe64124b818f4449552f960d815cfba83a53d" [[package]] name = "futures-executor" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "badaa6a909fac9e7236d0620a2f57f7664640c56575b71a7552fbd68deafab79" +checksum = "45025be030969d763025784f7f355043dc6bc74093e4ecc5000ca4dc50d8745c" dependencies = [ "futures-core", "futures-task", @@ -279,15 +290,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acc499defb3b348f8d8f3f66415835a9131856ff7714bf10dadfc4ec4bdb29a1" +checksum = "522de2a0fe3e380f1bc577ba0474108faf3f6b18321dbf60b3b9c39a75073377" [[package]] name = "futures-macro" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c40298486cdf52cc00cd6d6987892ba502c7656a16a4192a9992b1ccedd121" +checksum = "18e4a4b95cea4b4ccbcf1c5675ca7c4ee4e9e75eb79944d07defde18068f79bb" dependencies = [ "autocfg", "proc-macro-hack", @@ -298,21 +309,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a57bead0ceff0d6dde8f465ecd96c9338121bb7717d3e7b108059531870c4282" +checksum = "36ea153c13024fe480590b3e3d4cad89a0cfacecc24577b68f86c6ced9c2bc11" [[package]] name = "futures-task" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a16bef9fc1a4dddb5bee51c989e3fbba26569cbb0e31f5b303c184e3dd33dae" +checksum = "1d3d00f4eddb73e498a54394f228cd55853bdf059259e8e7bc6e69d408892e99" [[package]] name = "futures-util" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "feb5c238d27e2bf94ffdfd27b2c29e3df4a68c4193bb6427384259e2bf191967" +checksum = "36568465210a3a6ee45e1f165136d68671471a501e632e9a98d96872222b5481" dependencies = [ "autocfg", "futures-channel", @@ -354,7 +365,7 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "wasi", ] @@ -382,12 +393,9 @@ dependencies = [ [[package]] name = "humantime" -version = "1.3.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" -dependencies = [ - "quick-error", -] +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "lazy_static" @@ -403,17 +411,17 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.98" +version = "0.2.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "320cfe77175da3a483efed4bc0adc1968ca050b098ce4f2f1c13a56626128790" +checksum = "7b2f96d100e1cf1929e7719b7edb3b90ab5298072638fccd77be9ce942ecdfce" [[package]] name = "libloading" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f84d96438c15fcd6c3f244c8fce01d1e2b9c6b5623e9c711dc9286d8fc92d6a" +checksum = "c0cf036d15402bea3c5d4de17b3fce76b3e4a56ebc1f577be0e7a72f7c607cf0" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "winapi", ] @@ -423,7 +431,7 @@ version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -437,9 +445,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.4.0" +version = "2.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc" +checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" [[package]] name = "miniz_oxide" @@ -453,21 +461,20 @@ dependencies = [ [[package]] name = "msfs" -version = "0.0.1-alpha.2" -source = "git+https://github.com/flybywiresim/msfs-rs?branch=main#b55dd8ca84ad80b4e914282bd95a664bafa05fc8" +version = "0.1.0" +source = "git+https://github.com/flybywiresim/msfs-rs?branch=main#c0fe06caad7c70ac79d4ecf2a81cecd79887e515" dependencies = [ "bindgen", "cc", "futures", "msfs_derive", "msfs_sdk", - "wasi", ] [[package]] name = "msfs_derive" -version = "0.0.1-alpha.2" -source = "git+https://github.com/flybywiresim/msfs-rs?branch=main#b55dd8ca84ad80b4e914282bd95a664bafa05fc8" +version = "0.1.0" +source = "git+https://github.com/flybywiresim/msfs-rs?branch=main#c0fe06caad7c70ac79d4ecf2a81cecd79887e515" dependencies = [ "msfs_sdk", "quote", @@ -476,8 +483,8 @@ dependencies = [ [[package]] name = "msfs_sdk" -version = "0.0.1-alpha.2" -source = "git+https://github.com/flybywiresim/msfs-rs?branch=main#b55dd8ca84ad80b4e914282bd95a664bafa05fc8" +version = "0.1.0" +source = "git+https://github.com/flybywiresim/msfs-rs?branch=main#c0fe06caad7c70ac79d4ecf2a81cecd79887e515" [[package]] name = "nalgebra" @@ -498,10 +505,12 @@ dependencies = [ [[package]] name = "nom" -version = "5.1.2" +version = "6.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb4262d26ed83a1c0a33a38fe2bb15797329c85770da05e6b828ddb782627af" +checksum = "9c5c51b9083a3c620fa67a2a635d1ce7d95b897e957d6b28ff9a5da960a103a6" dependencies = [ + "bitvec", + "funty", "memchr", "version_check", ] @@ -599,12 +608,9 @@ dependencies = [ [[package]] name = "object" -version = "0.25.3" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a38f2be3697a57b4060074ff41b44c16870d916ad7877c17696e063257482bc7" -dependencies = [ - "memchr", -] +checksum = "1a5b3dd1c072ee7963717671d1ca129f1048fda25edea6b752bfc71ac8854170" [[package]] name = "paste" @@ -651,9 +657,9 @@ dependencies = [ [[package]] name = "ppv-lite86" -version = "0.2.10" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" +checksum = "c3ca011bd0129ff4ae15cd04c4eef202cadf6c51c21e47aba319b4e0501db741" [[package]] name = "proc-macro-crate" @@ -678,28 +684,28 @@ checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" [[package]] name = "proc-macro2" -version = "1.0.27" +version = "1.0.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0d8caf72986c1a598726adc988bb5984792ef84f5ee5aa50209145ee8077038" +checksum = "edc3358ebc67bc8b7fa0c007f945b0b18226f78437d61bec735a9eb96b61ee70" dependencies = [ "unicode-xid", ] -[[package]] -name = "quick-error" -version = "1.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" - [[package]] name = "quote" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" +checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05" dependencies = [ "proc-macro2", ] +[[package]] +name = "radium" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "941ba9d78d8e2f7ce474c015eea4d9c6d25b6a3327f9832ee29a4de27f91bbb8" + [[package]] name = "rand" version = "0.8.4" @@ -748,9 +754,9 @@ checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" [[package]] name = "regex" -version = "1.5.4" +version = "1.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" +checksum = "2a26af418b574bd56588335b3a3659a65725d4e636eb1016c2f9e3b38c7cc759" dependencies = [ "aho-corasick", "memchr", @@ -769,7 +775,7 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "041bb0202c14f6a158bbbf086afb03d0c6e975c2dec7d4912f8061ed44f290af" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "proc-macro2", "quote", "rustc_version", @@ -778,9 +784,9 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.20" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dead70b0b5e03e9c814bcb6b01e03e68f7c57a80aa48c72ec92152ab3e818d49" +checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" [[package]] name = "rustc-hash" @@ -823,18 +829,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.126" +version = "1.0.130" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec7505abeacaec74ae4778d9d9328fe5a5d04253220a85c4ee022239fc996d03" +checksum = "f12d06de37cf59146fbdecab66aa99f9fe4f78722e3607577a5375d66bd0c913" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.126" +version = "1.0.130" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "963a7dbc9895aeac7ac90e74f34a5d5261828f79df35cbed41e10189d3804d43" +checksum = "d7bc1a1ab1961464eae040d96713baa5a724a8152c1222492465b54322ec508b" dependencies = [ "proc-macro2", "quote", @@ -843,9 +849,9 @@ dependencies = [ [[package]] name = "shlex" -version = "0.1.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2" +checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" [[package]] name = "simba" @@ -861,9 +867,9 @@ dependencies = [ [[package]] name = "slab" -version = "0.4.3" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f173ac3d1a7e3b28003f40de0b5ce7fe2710f9b9dc3fc38664cebee46b3b6527" +checksum = "9def91fd1e018fe007022791f865d0ccc9b3a0d5001e01aabb8b40e46000afb5" [[package]] name = "strsim" @@ -879,9 +885,9 @@ checksum = "3685c82a045a6af0c488f0550b0f52b4c77d2a52b0ca8aba719f9d268fa96965" [[package]] name = "syn" -version = "1.0.73" +version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f71489ff30030d2ae598524f61326b902466f72a0fb1a8564c001cc63425bcc7" +checksum = "d010a1623fbd906d51d650a9916aaefc05ffa0e4053ff7fe601167f3e715d194" dependencies = [ "proc-macro2", "quote", @@ -890,9 +896,9 @@ dependencies = [ [[package]] name = "synstructure" -version = "0.12.5" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "474aaa926faa1603c40b7885a9eaea29b444d1cb2850cb7c0e37bb1a4182f4fa" +checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" dependencies = [ "proc-macro2", "quote", @@ -924,6 +930,12 @@ dependencies = [ "uom", ] +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + [[package]] name = "termcolor" version = "1.1.2" @@ -953,9 +965,9 @@ dependencies = [ [[package]] name = "typenum" -version = "1.13.0" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" +checksum = "b63708a265f51345575b27fe43f9500ad611579e764c79edbc2037b1121959ec" [[package]] name = "ucd-trie" @@ -965,9 +977,9 @@ checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" [[package]] name = "unicode-width" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" +checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" [[package]] name = "unicode-xid" @@ -1042,3 +1054,9 @@ name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "wyz" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214" diff --git a/package.json b/package.json index 4f3b1a3c0ee..9caeb9befc1 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "@rollup/plugin-replace": "^2.3.3", "@rollup/plugin-sucrase": "^3.1.0", "@rollup/plugin-typescript": "~8.0.0", - "@types/jest": "^26.0.24", + "@types/jest": "^27.0.2", "@types/react": "~17.0.0", "@types/react-dom": "~17.0.0", "@types/react-router-dom": "~5.1.6", diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 00000000000..e84b1d92f51 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,3 @@ +[toolchain] +channel = "1.55" +targets = [ "wasm32-wasi" ] diff --git a/scripts/dev-env/run.cmd b/scripts/dev-env/run.cmd index 296497f798e..83413a1d92a 100755 --- a/scripts/dev-env/run.cmd +++ b/scripts/dev-env/run.cmd @@ -1,6 +1,6 @@ @echo off -set image="ghcr.io/flybywiresim/dev-env@sha256:626f12e8f5ca0517f39fc2b046eb91036998803b7cd483482581447d07e4ae7d" +set image="ghcr.io/flybywiresim/dev-env@sha256:b7c1230b06425d2c3499545cef1ca831455845ec05e40d105969ae50f6074013" docker image inspect %image% 1> nul || docker system prune --filter label=flybywiresim=true -f docker run --rm -it -v "%cd%:/external" %image% %* diff --git a/scripts/dev-env/run.sh b/scripts/dev-env/run.sh index 6135e7d09d5..6740e9025e1 100755 --- a/scripts/dev-env/run.sh +++ b/scripts/dev-env/run.sh @@ -1,6 +1,6 @@ #!/bin/bash -IMAGE="ghcr.io/flybywiresim/dev-env@sha256:626f12e8f5ca0517f39fc2b046eb91036998803b7cd483482581447d07e4ae7d" +IMAGE="ghcr.io/flybywiresim/dev-env@sha256:b7c1230b06425d2c3499545cef1ca831455845ec05e40d105969ae50f6074013" # only set `-it` if there is a tty if [ -t 0 ] && [ -t 1 ]; diff --git a/src/fadec/build.sh b/src/fadec/build.sh index cd1bead4e34..4fdbd47205d 100755 --- a/src/fadec/build.sh +++ b/src/fadec/build.sh @@ -9,6 +9,7 @@ set -ex # compile c++ code clang++ \ + -c \ -Wno-unused-command-line-argument \ -Wno-ignored-attributes \ -Wno-macro-redefined \ @@ -24,15 +25,26 @@ clang++ \ -fno-exceptions \ -fms-extensions \ -fvisibility=hidden \ - -Wl,--strip-debug \ - -Wl,--no-entry \ - -Wl,--export=malloc \ - -Wl,--export=free \ - -Wl,--export=__wasm_call_ctors \ - -Wl,--export-table \ - -Wl,--allow-undefined \ -I "${MSFS_SDK}/WASM/include" \ -I "${MSFS_SDK}/SimConnect SDK/include" \ -I "${DIR}/src" \ "${DIR}/src/FadecGauge.cpp" \ + -o fadec.o + +wasm-ld \ + --no-entry \ + --allow-undefined \ + -L "${MSFS_SDK}/WASM/wasi-sysroot/lib/wasm32-wasi" \ + -lc "${MSFS_SDK}/WASM/wasi-sysroot/lib/wasm32-wasi/libclang_rt.builtins-wasm32.a" \ + --export __wasm_call_ctors \ + --strip-debug \ + --export-dynamic \ + --export malloc \ + --export free \ + --export __wasm_call_ctors \ + --export-table \ + --gc-sections \ + -O3 --lto-O3 \ + -lc++ -lc++abi \ + fadec.o \ -o $OUTPUT diff --git a/src/fadec/src/common.h b/src/fadec/src/common.h index f07f61b7411..d95890415b4 100644 --- a/src/fadec/src/common.h +++ b/src/fadec/src/common.h @@ -1,4 +1,5 @@ #pragma once +#include class SimVars; diff --git a/src/fbw/build.sh b/src/fbw/build.sh index 1f6406acf17..8053d542b8b 100755 --- a/src/fbw/build.sh +++ b/src/fbw/build.sh @@ -44,11 +44,9 @@ clang \ "${DIR}/src/zlib/trees.c" \ "${DIR}/src/zlib/zutil.c" -# restore directory -popd - # compile c++ code clang++ \ + -c \ -Wno-unused-command-line-argument \ -Wno-ignored-attributes \ -Wno-macro-redefined \ @@ -64,13 +62,6 @@ clang++ \ -fno-exceptions \ -fms-extensions \ -fvisibility=hidden \ - -Wl,--strip-debug \ - -Wl,--no-entry \ - -Wl,--export=malloc \ - -Wl,--export=free \ - -Wl,--export=__wasm_call_ctors \ - -Wl,--export-table \ - -Wl,--allow-undefined \ -I "${MSFS_SDK}/WASM/include" \ -I "${MSFS_SDK}/SimConnect SDK/include" \ -I "${DIR}/src/inih" \ @@ -109,17 +100,25 @@ clang++ \ "${DIR}/src/SpoilersHandler.cpp" \ "${DIR}/src/ThrottleAxisMapping.cpp" \ "${DIR}/src/main.cpp" \ - "${DIR}/obj/adler32.o" \ - "${DIR}/obj/crc32.o" \ - "${DIR}/obj/deflate.o" \ - "${DIR}/obj/gzclose.o" \ - "${DIR}/obj/gzlib.o" \ - "${DIR}/obj/gzread.o" \ - "${DIR}/obj/gzwrite.o" \ - "${DIR}/obj/infback.o" \ - "${DIR}/obj/inffast.o" \ - "${DIR}/obj/inflate.o" \ - "${DIR}/obj/inftrees.o" \ - "${DIR}/obj/trees.o" \ - "${DIR}/obj/zutil.o" \ + +# restore directory +popd + +# link modules +wasm-ld \ + --no-entry \ + --allow-undefined \ + -L "${MSFS_SDK}/WASM/wasi-sysroot/lib/wasm32-wasi" \ + -lc "${MSFS_SDK}/WASM/wasi-sysroot/lib/wasm32-wasi/libclang_rt.builtins-wasm32.a" \ + --export __wasm_call_ctors \ + --strip-debug \ + --export-dynamic \ + --export malloc \ + --export free \ + --export __wasm_call_ctors \ + --export-table \ + --gc-sections \ + -O3 --lto-O3 \ + -lc++ -lc++abi \ + ${DIR}/obj/*.o \ -o $OUTPUT diff --git a/src/systems/README.md b/src/systems/README.md index b3f86e0706a..35f0a529f56 100644 --- a/src/systems/README.md +++ b/src/systems/README.md @@ -5,7 +5,7 @@ This folder contains code for simulating Airbus aircraft systems. Please read th Follow the steps below if you want to build the content of this folder without using the repository's standard build process. 1. Install the `wasm32-wasi` target by running: `rustup target add wasm32-wasi`. -2. Install LLVM 11 which can be found [here](https://releases.llvm.org/download.html), ensure to add it to your PATH. +2. Install LLVM 12 which can be found [here](https://releases.llvm.org/download.html), ensure to add it to your PATH. 3. Run `cargo build --target wasm32-wasi` in the console at the top-level of the a32nx repository. You must have the SDK installed and have the 'Samples' folder of the SDK downloaded (this must be acquired seperately from the core) in order to build `msfs-rs`. 4. The `lib.rs` file is built as `target/wasm32-wasi/debug/a320.wasm`. diff --git a/src/systems/a320_hydraulic_simulation_graphs/src/main.rs b/src/systems/a320_hydraulic_simulation_graphs/src/main.rs index 6547dfae9f4..02f984e09db 100644 --- a/src/systems/a320_hydraulic_simulation_graphs/src/main.rs +++ b/src/systems/a320_hydraulic_simulation_graphs/src/main.rs @@ -114,7 +114,7 @@ fn make_figure(h: &History) -> Figure { let mut curr_axis = Axes2D::new() .add( Line2D::new(h.name_vector[idx].as_str()) - .data(&h.time_vector, &cur_data) + .data(&h.time_vector, cur_data) .color("blue") // .marker("x") // .linestyle("--") @@ -201,7 +201,7 @@ impl History { /// Builds a graph using matplotlib python backend. PYTHON REQUIRED AS WELL AS MATPLOTLIB PACKAGE fn show_matplotlib(&self, figure_title: &str, path: &str) { - let fig = make_figure(&self); + let fig = make_figure(self); use rustplotlib::backend::Matplotlib; use rustplotlib::Backend; @@ -350,9 +350,9 @@ fn green_loop_edp_simulation(path: &str) { ); } - green_loop_history.show_matplotlib("green_loop_edp_simulation_press", &path); - edp1_history.show_matplotlib("green_loop_edp_simulation_EDP1 data", &path); - accu_green_history.show_matplotlib("green_loop_edp_simulation_Green Accum data", &path); + green_loop_history.show_matplotlib("green_loop_edp_simulation_press", path); + edp1_history.show_matplotlib("green_loop_edp_simulation_EDP1 data", path); + accu_green_history.show_matplotlib("green_loop_edp_simulation_Green Accum data", path); } fn yellow_green_ptu_loop_simulation(path: &str) { @@ -614,11 +614,11 @@ fn yellow_green_ptu_loop_simulation(path: &str) { } } - loop_history.show_matplotlib("yellow_green_ptu_loop_simulation()_Loop_press", &path); - ptu_history.show_matplotlib("yellow_green_ptu_loop_simulation()_PTU", &path); + loop_history.show_matplotlib("yellow_green_ptu_loop_simulation()_Loop_press", path); + ptu_history.show_matplotlib("yellow_green_ptu_loop_simulation()_PTU", path); - accu_green_history.show_matplotlib("yellow_green_ptu_loop_simulation()_Green_acc", &path); - accu_yellow_history.show_matplotlib("yellow_green_ptu_loop_simulation()_Yellow_acc", &path); + accu_green_history.show_matplotlib("yellow_green_ptu_loop_simulation()_Green_acc", path); + accu_yellow_history.show_matplotlib("yellow_green_ptu_loop_simulation()_Yellow_acc", path); } fn yellow_epump_plus_edp2_with_ptu(path: &str) { @@ -798,11 +798,11 @@ fn yellow_epump_plus_edp2_with_ptu(path: &str) { ); } - loop_history.show_matplotlib("yellow_epump_plus_edp2_with_ptu()_Loop_press", &path); - ptu_history.show_matplotlib("yellow_epump_plus_edp2_with_ptu()_PTU", &path); + loop_history.show_matplotlib("yellow_epump_plus_edp2_with_ptu()_Loop_press", path); + ptu_history.show_matplotlib("yellow_epump_plus_edp2_with_ptu()_PTU", path); - accu_green_history.show_matplotlib("yellow_epump_plus_edp2_with_ptu()_Green_acc", &path); - accu_yellow_history.show_matplotlib("yellow_epump_plus_edp2_with_ptu()_Yellow_acc", &path); + accu_green_history.show_matplotlib("yellow_epump_plus_edp2_with_ptu()_Green_acc", path); + accu_yellow_history.show_matplotlib("yellow_epump_plus_edp2_with_ptu()_Yellow_acc", path); } fn hydraulic_loop(context: &mut InitContext, loop_color: &str) -> HydraulicLoop { diff --git a/src/systems/a320_systems/src/hydraulic.rs b/src/systems/a320_systems/src/hydraulic.rs index 13f6caab22c..be4caa7008a 100644 --- a/src/systems/a320_systems/src/hydraulic.rs +++ b/src/systems/a320_systems/src/hydraulic.rs @@ -365,9 +365,9 @@ impl A320Hydraulic { } self.update_with_sim_rate( - &context, - &overhead_panel, - &autobrake_panel, + context, + overhead_panel, + autobrake_panel, rat_and_emer_gen_man_on, emergency_elec_state, lgciu1, @@ -497,13 +497,13 @@ impl A320Hydraulic { fn update_fast_physics(&mut self, context: &UpdateContext) { self.forward_cargo_door.update( &self.forward_cargo_door_controller, - &context, + context, self.yellow_loop.pressure(), ); self.aft_cargo_door.update( &self.aft_cargo_door_controller, - &context, + context, self.yellow_loop.pressure(), ); @@ -528,7 +528,7 @@ impl A320Hydraulic { &self.braking_circuit_altn, lgciu1, lgciu2, - &autobrake_panel, + autobrake_panel, ); // Updating rat stowed pos on all frames in case it's used for graphics @@ -536,7 +536,7 @@ impl A320Hydraulic { // Uses external conditions and momentary button: better to check each frame self.ram_air_turbine_controller.update( - &overhead_panel, + overhead_panel, rat_and_emer_gen_man_on, emergency_elec_state, ); @@ -545,7 +545,7 @@ impl A320Hydraulic { self.pushback_tug.update(); self.braking_force.update_forces( - &context, + context, &self.braking_circuit_norm, &self.braking_circuit_altn, ); @@ -1407,8 +1407,8 @@ impl A320HydraulicBrakeComputerUnit { self.update_brake_pressure_limitation(); self.autobrake_controller.update( - &context, - &autobrake_panel, + context, + autobrake_panel, self.allow_autobrake_arming(), self.left_brake_pilot_input, self.right_brake_pilot_input, @@ -2099,20 +2099,20 @@ impl A320AutobrakeController { lgciu2: &impl LgciuInterface, ) { self.update_input_conditions( - &context, + context, allow_arming, pedal_input_left, pedal_input_right, lgciu1, lgciu2, ); - self.mode = self.determine_mode(&autobrake_panel); + self.mode = self.determine_mode(autobrake_panel); self.deceleration_governor .engage_when(self.should_engage_deceleration_governor()); self.target = self.calculate_target(); - self.deceleration_governor.update(&context, self.target); + self.deceleration_governor.update(context, self.target); } } impl SimulationElement for A320AutobrakeController { diff --git a/src/systems/systems/src/apu/air_intake_flap.rs b/src/systems/systems/src/apu/air_intake_flap.rs index bbbf9837925..7c821ef1d04 100644 --- a/src/systems/systems/src/apu/air_intake_flap.rs +++ b/src/systems/systems/src/apu/air_intake_flap.rs @@ -322,7 +322,7 @@ mod air_intake_flap_tests { fn is_fully_open_returns_false_when_closed() { let test_bed = SimulationTestBed::new(|electricity| TestAircraft::new(electricity)); - assert_eq!(test_bed.query(|a| a.flap_is_fully_open()), false) + assert!(!test_bed.query(|a| a.flap_is_fully_open())) } #[test] @@ -332,7 +332,7 @@ mod air_intake_flap_tests { test_bed.command(|a| a.command_flap_open()); test_bed.run_with_delta(Duration::from_secs(1_000)); - assert_eq!(test_bed.query(|a| a.flap_is_fully_open()), true) + assert!(test_bed.query(|a| a.flap_is_fully_open())) } #[test] diff --git a/src/systems/systems/src/apu/electronic_control_box.rs b/src/systems/systems/src/apu/electronic_control_box.rs index a675f30bf70..fdcc50ddbbf 100644 --- a/src/systems/systems/src/apu/electronic_control_box.rs +++ b/src/systems/systems/src/apu/electronic_control_box.rs @@ -118,7 +118,7 @@ impl ElectronicControlBox { self.start_motor_is_powered = start_motor.is_powered(); if matches!( - >::signal(&self), + >::signal(self), Some(ContactorSignal::Close) ) && !self.start_motor_is_powered { diff --git a/src/systems/systems/src/apu/mod.rs b/src/systems/systems/src/apu/mod.rs index b0b9ae72ad4..4e709838064 100644 --- a/src/systems/systems/src/apu/mod.rs +++ b/src/systems/systems/src/apu/mod.rs @@ -950,13 +950,10 @@ pub mod tests { fn when_apu_master_sw_turned_on_air_intake_flap_opens() { let mut test_bed = test_bed_with().master_on().run(Duration::from_secs(20)); - assert_eq!( - test_bed - .is_air_intake_flap_fully_open() - .normal_value() - .unwrap(), - true - ) + assert!(test_bed + .is_air_intake_flap_fully_open() + .normal_value() + .unwrap()) } #[test] @@ -1536,13 +1533,13 @@ pub mod tests { } if n < 55. { - assert_eq!(test_bed.should_close_start_contactors_commanded(), true); + assert!(test_bed.should_close_start_contactors_commanded()); } else { // The start contactor state is set before the turbine is updated, // thus this needs another run to update the start contactor after the // turbine reaches n >= 55. test_bed = test_bed.run(Duration::from_millis(0)); - assert_eq!(test_bed.should_close_start_contactors_commanded(), false); + assert!(!test_bed.should_close_start_contactors_commanded()); } if (n - 100.).abs() < f64::EPSILON { @@ -1554,7 +1551,7 @@ pub mod tests { #[test] fn should_close_start_contactors_not_commanded_when_shutdown() { let test_bed = test_bed().run(Duration::from_secs(1_000)); - assert_eq!(test_bed.should_close_start_contactors_commanded(), false); + assert!(!test_bed.should_close_start_contactors_commanded()); } #[test] @@ -1563,7 +1560,7 @@ pub mod tests { loop { test_bed = test_bed.run(Duration::from_millis(50)); - assert_eq!(test_bed.should_close_start_contactors_commanded(), false); + assert!(!test_bed.should_close_start_contactors_commanded()); if test_bed.turbine_is_shutdown() { break; @@ -1576,7 +1573,7 @@ pub mod tests { let test_bed = test_bed_with() .running_apu() .run(Duration::from_secs(1_000)); - assert_eq!(test_bed.should_close_start_contactors_commanded(), false); + assert!(!test_bed.should_close_start_contactors_commanded()); } #[test] @@ -1609,7 +1606,7 @@ pub mod tests { while n > 0. { // Assert before running, because otherwise we capture the Starting state which begins when at n = 0 // with the master and start switches on. - assert_eq!(test_bed.should_close_start_contactors_commanded(), false); + assert!(!test_bed.should_close_start_contactors_commanded()); test_bed = test_bed.run(Duration::from_secs(1)); n = test_bed.n().value().get::(); @@ -1680,14 +1677,11 @@ pub mod tests { .starting_apu() .run_until_n_decreases(Duration::from_millis(50)); - assert_eq!(test_bed.apu_is_available(), false); - assert_eq!( - test_bed - .has_fuel_low_pressure_fault() - .normal_value() - .unwrap(), - true - ); + assert!(!test_bed.apu_is_available()); + assert!(test_bed + .has_fuel_low_pressure_fault() + .normal_value() + .unwrap()); assert!(test_bed.master_has_fault()); assert!(!test_bed.start_is_on()); } @@ -1701,14 +1695,11 @@ pub mod tests { .no_fuel_available() .run_until_n_decreases(Duration::from_millis(50)); - assert_eq!(test_bed.apu_is_available(), false); - assert_eq!( - test_bed - .has_fuel_low_pressure_fault() - .normal_value() - .unwrap(), - true - ); + assert!(!test_bed.apu_is_available()); + assert!(test_bed + .has_fuel_low_pressure_fault() + .normal_value() + .unwrap()); assert!(test_bed.master_has_fault()); assert!(!test_bed.start_is_on()); } @@ -1725,7 +1716,7 @@ pub mod tests { test_bed = test_bed.run(Duration::from_secs(10)); } - assert_eq!(test_bed.apu_is_available(), false); + assert!(!test_bed.apu_is_available()); assert!(test_bed.master_has_fault()); assert!(!test_bed.start_is_on()); } @@ -1819,14 +1810,11 @@ pub mod tests { .no_fuel_available() .run_until_n_decreases(Duration::from_millis(50)); - assert_eq!(test_bed.apu_is_available(), false); - assert_eq!( - test_bed - .has_fuel_low_pressure_fault() - .normal_value() - .unwrap(), - true - ); + assert!(!test_bed.apu_is_available()); + assert!(test_bed + .has_fuel_low_pressure_fault() + .normal_value() + .unwrap()); assert!(test_bed.master_has_fault()); assert!(!test_bed.start_is_on()); } @@ -1839,7 +1827,7 @@ pub mod tests { .no_fuel_available() .run_until_n_decreases(Duration::from_millis(50)); - assert_eq!(test_bed.is_auto_shutdown(), true); + assert!(test_bed.is_auto_shutdown()); } #[test] @@ -1848,7 +1836,7 @@ pub mod tests { .no_fuel_available() .run(Duration::from_secs(10)); - assert_eq!(test_bed.is_auto_shutdown(), false); + assert!(!test_bed.is_auto_shutdown()); } #[test] @@ -1859,7 +1847,7 @@ pub mod tests { .no_fuel_available() .run(Duration::from_secs(10)); - assert_eq!(test_bed.is_inoperable(), true); + assert!(test_bed.is_inoperable()); } #[test] @@ -1868,14 +1856,14 @@ pub mod tests { .no_fuel_available() .run(Duration::from_secs(10)); - assert_eq!(test_bed.is_inoperable(), false); + assert!(!test_bed.is_inoperable()); } #[test] fn running_apu_is_inoperable_is_false() { let mut test_bed = test_bed_with().running_apu().run(Duration::from_secs(10)); - assert_eq!(test_bed.is_inoperable(), false) + assert!(!test_bed.is_inoperable()) } #[test] @@ -1884,7 +1872,7 @@ pub mod tests { .released_apu_fire_pb() .run(Duration::from_secs(1)); - assert_eq!(test_bed.is_inoperable(), true); + assert!(test_bed.is_inoperable()); } #[test] diff --git a/src/systems/systems/src/electrical/engine_generator.rs b/src/systems/systems/src/electrical/engine_generator.rs index a0f7618eeef..4d778abe86a 100644 --- a/src/systems/systems/src/electrical/engine_generator.rs +++ b/src/systems/systems/src/electrical/engine_generator.rs @@ -822,10 +822,7 @@ mod tests { test_bed.run_with_delta(Duration::from_millis(500)); - assert_eq!( - test_bed.query_element(|e| e.provides_stable_power_output()), - true - ); + assert!(test_bed.query_element(|e| e.provides_stable_power_output())); } #[test] @@ -842,10 +839,7 @@ mod tests { test_bed.run_with_delta(Duration::from_millis(499)); - assert_eq!( - test_bed.query_element(|e| e.provides_stable_power_output()), - false - ); + assert!(!test_bed.query_element(|e| e.provides_stable_power_output())); } #[test] @@ -873,10 +867,7 @@ mod tests { test_bed.run_with_delta(Duration::from_millis(500)); - assert_eq!( - test_bed.query_element(|e| e.provides_stable_power_output()), - false - ); + assert!(!test_bed.query_element(|e| e.provides_stable_power_output())); } #[test] diff --git a/src/systems/systems/src/electrical/mod.rs b/src/systems/systems/src/electrical/mod.rs index ffcbf29eaa5..59e562efc8a 100644 --- a/src/systems/systems/src/electrical/mod.rs +++ b/src/systems/systems/src/electrical/mod.rs @@ -484,7 +484,7 @@ impl Electricity { } pub fn distribute_to(&self, element: &mut impl SimulationElement, _: &UpdateContext) { - let mut visitor = ReceivePowerVisitor::new(&self); + let mut visitor = ReceivePowerVisitor::new(self); element.accept(&mut visitor); } @@ -501,7 +501,7 @@ impl Electricity { context: &UpdateContext, element: &mut impl SimulationElement, ) { - let mut visitor = ProcessPowerConsumptionReportVisitor::new(context, &self); + let mut visitor = ProcessPowerConsumptionReportVisitor::new(context, self); element.accept(&mut visitor); } @@ -710,7 +710,7 @@ impl Potential { } fn origin_count(&self) -> usize { - self.origins.iter().count() + self.origins.len() } fn origins(&self) -> impl Iterator + '_ { @@ -869,10 +869,9 @@ impl PotentialCollection { } fn get(&self, identifier: ElectricalElementIdentifier) -> Option> { - match self.items.get(&identifier) { - Some(potential) => Some(potential.as_ref().borrow()), - None => None, - } + self.items + .get(&identifier) + .map(|potential| potential.as_ref().borrow()) } fn consume_from(&mut self, identifier: ElectricalElementIdentifier, power: Power) { @@ -1044,13 +1043,12 @@ mod tests { test_bed.command(|a| a.powered_by_battery_at(ElectricPotential::new::(25.))); test_bed.run(); - assert_eq!( - ReadByName::, bool>::read_by_name( - &mut test_bed, - "ELEC_DC_BAT_BUS_POTENTIAL_NORMAL" - ), - false - ); + assert!(!ReadByName::< + SimulationTestBed, + bool, + >::read_by_name( + &mut test_bed, "ELEC_DC_BAT_BUS_POTENTIAL_NORMAL" + )); } #[test] @@ -1062,13 +1060,12 @@ mod tests { test_bed.command(|a| a.powered_by_battery_at(ElectricPotential::new::(25.01))); test_bed.run(); - assert_eq!( - ReadByName::, bool>::read_by_name( - &mut test_bed, - "ELEC_DC_BAT_BUS_POTENTIAL_NORMAL" - ), - true - ); + assert!(ReadByName::< + SimulationTestBed, + bool, + >::read_by_name( + &mut test_bed, "ELEC_DC_BAT_BUS_POTENTIAL_NORMAL" + )); } #[test] @@ -1349,22 +1346,22 @@ mod tests { #[test] fn some_potential_is_powered() { - assert_eq!(some_potential().is_powered(), true); + assert!(some_potential().is_powered()); } #[test] fn some_potential_is_not_unpowered() { - assert_eq!(some_potential().is_unpowered(), false); + assert!(!some_potential().is_unpowered()); } #[test] fn none_potential_is_not_powered() { - assert_eq!(none_potential().is_powered(), false); + assert!(!none_potential().is_powered()); } #[test] fn none_potential_is_unpowered() { - assert_eq!(none_potential().is_unpowered(), true); + assert!(none_potential().is_unpowered()); } #[test] diff --git a/src/systems/systems/src/engine/mod.rs b/src/systems/systems/src/engine/mod.rs index 63cc159da78..09110bd62cf 100644 --- a/src/systems/systems/src/engine/mod.rs +++ b/src/systems/systems/src/engine/mod.rs @@ -52,8 +52,8 @@ mod engine_fire_overhead_panel_tests { fn after_construction_fire_push_buttons_are_not_released() { let test_bed = SimulationTestBed::from(ElementCtorFn(EngineFireOverheadPanel::new)); - assert_eq!(test_bed.query_element(|e| e.is_released(1)), false); - assert_eq!(test_bed.query_element(|e| e.is_released(2)), false); + assert!(!test_bed.query_element(|e| e.is_released(1))); + assert!(!test_bed.query_element(|e| e.is_released(2))); } #[test] @@ -62,7 +62,7 @@ mod engine_fire_overhead_panel_tests { test_bed.write_by_name("FIRE_BUTTON_ENG1", false); test_bed.run(); - assert_eq!(test_bed.query_element(|e| e.is_released(1)), false); + assert!(!test_bed.query_element(|e| e.is_released(1))); } #[test] @@ -71,6 +71,6 @@ mod engine_fire_overhead_panel_tests { test_bed.write_by_name("FIRE_BUTTON_ENG1", true); test_bed.run(); - assert_eq!(test_bed.query_element(|e| e.is_released(1)), true); + assert!(test_bed.query_element(|e| e.is_released(1))); } } diff --git a/src/systems/systems/src/hydraulic/mod.rs b/src/systems/systems/src/hydraulic/mod.rs index c85330474a7..b172db867a4 100644 --- a/src/systems/systems/src/hydraulic/mod.rs +++ b/src/systems/systems/src/hydraulic/mod.rs @@ -1078,7 +1078,7 @@ impl RamAirTurbine { // Calculate the ratio of current displacement vs max displacement as an image of the load of the pump let displacement_ratio = self.delta_vol_max().get::() / self.max_displacement; self.wind_turbine.update( - &delta_time, + delta_time, indicated_airspeed, self.position, displacement_ratio, diff --git a/src/systems/systems/src/navigation/adirs.rs b/src/systems/systems/src/navigation/adirs.rs index ae0bcfca3bb..24e393a8ec7 100644 --- a/src/systems/systems/src/navigation/adirs.rs +++ b/src/systems/systems/src/navigation/adirs.rs @@ -466,11 +466,11 @@ struct AdirsData { } impl AdirsData { fn new_adr(context: &mut InitContext, number: usize, name: &str) -> Self { - Self::new(context, OutputDataType::ADR, number, name) + Self::new(context, OutputDataType::Adr, number, name) } fn new_ir(context: &mut InitContext, number: usize, name: &str) -> Self { - Self::new(context, OutputDataType::IR, number, name) + Self::new(context, OutputDataType::Ir, number, name) } fn new( @@ -506,14 +506,14 @@ impl AdirsData { #[derive(Clone, Copy)] enum OutputDataType { - ADR, - IR, + Adr, + Ir, } impl Display for OutputDataType { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { - OutputDataType::ADR => write!(f, "ADR"), - OutputDataType::IR => write!(f, "IR"), + OutputDataType::Adr => write!(f, "ADR"), + OutputDataType::Ir => write!(f, "IR"), } } } @@ -1237,7 +1237,7 @@ mod tests { fn altitude(&mut self, adiru_number: usize) -> Arinc429Word { self.read_arinc429_by_name(&output_data_id( - OutputDataType::ADR, + OutputDataType::Adr, adiru_number, AirDataReference::ALTITUDE, )) @@ -1245,7 +1245,7 @@ mod tests { fn computed_airspeed(&mut self, adiru_number: usize) -> Arinc429Word { self.read_arinc429_by_name(&output_data_id( - OutputDataType::ADR, + OutputDataType::Adr, adiru_number, AirDataReference::COMPUTED_AIRSPEED, )) @@ -1253,7 +1253,7 @@ mod tests { fn mach(&mut self, adiru_number: usize) -> Arinc429Word { self.read_arinc429_by_name(&output_data_id( - OutputDataType::ADR, + OutputDataType::Adr, adiru_number, AirDataReference::MACH, )) @@ -1261,7 +1261,7 @@ mod tests { fn barometric_vertical_speed(&mut self, adiru_number: usize) -> Arinc429Word { let vertical_speed: Arinc429Word = self.read_arinc429_by_name(&output_data_id( - OutputDataType::ADR, + OutputDataType::Adr, adiru_number, AirDataReference::BAROMETRIC_VERTICAL_SPEED, )); @@ -1273,7 +1273,7 @@ mod tests { fn true_airspeed(&mut self, adiru_number: usize) -> Arinc429Word { self.read_arinc429_by_name(&output_data_id( - OutputDataType::ADR, + OutputDataType::Adr, adiru_number, AirDataReference::TRUE_AIRSPEED, )) @@ -1284,7 +1284,7 @@ mod tests { adiru_number: usize, ) -> Arinc429Word { self.read_arinc429_by_name(&output_data_id( - OutputDataType::ADR, + OutputDataType::Adr, adiru_number, AirDataReference::STATIC_AIR_TEMPERATURE, )) @@ -1295,7 +1295,7 @@ mod tests { adiru_number: usize, ) -> Arinc429Word { self.read_arinc429_by_name(&output_data_id( - OutputDataType::ADR, + OutputDataType::Adr, adiru_number, AirDataReference::TOTAL_AIR_TEMPERATURE, )) @@ -1306,7 +1306,7 @@ mod tests { adiru_number: usize, ) -> Arinc429Word { self.read_arinc429_by_name(&output_data_id( - OutputDataType::ADR, + OutputDataType::Adr, adiru_number, AirDataReference::INTERNATIONAL_STANDARD_ATMOSPHERE_DELTA, )) @@ -1314,7 +1314,7 @@ mod tests { fn pitch(&mut self, adiru_number: usize) -> Arinc429Word { self.read_arinc429_by_name(&output_data_id( - OutputDataType::IR, + OutputDataType::Ir, adiru_number, InertialReference::PITCH, )) @@ -1322,7 +1322,7 @@ mod tests { fn roll(&mut self, adiru_number: usize) -> Arinc429Word { self.read_arinc429_by_name(&output_data_id( - OutputDataType::IR, + OutputDataType::Ir, adiru_number, InertialReference::ROLL, )) @@ -1330,7 +1330,7 @@ mod tests { fn heading(&mut self, adiru_number: usize) -> Arinc429Word { self.read_arinc429_by_name(&output_data_id( - OutputDataType::IR, + OutputDataType::Ir, adiru_number, InertialReference::HEADING, )) @@ -1338,7 +1338,7 @@ mod tests { fn track(&mut self, adiru_number: usize) -> Arinc429Word { self.read_arinc429_by_name(&output_data_id( - OutputDataType::IR, + OutputDataType::Ir, adiru_number, InertialReference::TRACK, )) @@ -1346,7 +1346,7 @@ mod tests { fn ground_speed(&mut self, adiru_number: usize) -> Arinc429Word { self.read_arinc429_by_name(&output_data_id( - OutputDataType::IR, + OutputDataType::Ir, adiru_number, InertialReference::GROUND_SPEED, )) @@ -1354,7 +1354,7 @@ mod tests { fn wind_direction(&mut self, adiru_number: usize) -> Arinc429Word { self.read_arinc429_by_name(&output_data_id( - OutputDataType::IR, + OutputDataType::Ir, adiru_number, InertialReference::WIND_DIRECTION, )) @@ -1362,7 +1362,7 @@ mod tests { fn wind_velocity(&mut self, adiru_number: usize) -> Arinc429Word { self.read_arinc429_by_name(&output_data_id( - OutputDataType::IR, + OutputDataType::Ir, adiru_number, InertialReference::WIND_VELOCITY, )) @@ -1370,7 +1370,7 @@ mod tests { fn inertial_vertical_speed(&mut self, adiru_number: usize) -> Arinc429Word { let vertical_speed: Arinc429Word = self.read_arinc429_by_name(&output_data_id( - OutputDataType::IR, + OutputDataType::Ir, adiru_number, InertialReference::VERTICAL_SPEED, )); @@ -1382,7 +1382,7 @@ mod tests { fn longitude(&mut self, adiru_number: usize) -> Arinc429Word { self.read_arinc429_by_name(&output_data_id( - OutputDataType::IR, + OutputDataType::Ir, adiru_number, InertialReference::LONGITUDE, )) @@ -1390,7 +1390,7 @@ mod tests { fn latitude(&mut self, adiru_number: usize) -> Arinc429Word { self.read_arinc429_by_name(&output_data_id( - OutputDataType::IR, + OutputDataType::Ir, adiru_number, InertialReference::LATITUDE, )) diff --git a/src/systems/systems/src/shared/mod.rs b/src/systems/systems/src/shared/mod.rs index aa5a1696eaf..975d8d884c6 100644 --- a/src/systems/systems/src/shared/mod.rs +++ b/src/systems/systems/src/shared/mod.rs @@ -272,7 +272,7 @@ impl DelayedPulseTrueLogicGate { } pub fn update(&mut self, context: &UpdateContext, expression_result: bool) { - self.true_delayed_gate.update(&context, expression_result); + self.true_delayed_gate.update(context, expression_result); let gate_out = self.true_delayed_gate.output(); @@ -436,7 +436,7 @@ mod delayed_true_logic_gate_tests { test_bed.run_with_delta(Duration::from_millis(0)); test_bed.run(); - assert_eq!(test_bed.query(|a| a.gate_output()), false); + assert!(!test_bed.query(|a| a.gate_output())); } #[test] @@ -450,7 +450,7 @@ mod delayed_true_logic_gate_tests { test_bed.run_with_delta(Duration::from_millis(0)); test_bed.run(); - assert_eq!(test_bed.query(|a| a.gate_output()), false); + assert!(!test_bed.query(|a| a.gate_output())); } #[test] @@ -464,7 +464,7 @@ mod delayed_true_logic_gate_tests { test_bed.run_with_delta(Duration::from_millis(0)); test_bed.run(); - assert_eq!(test_bed.query(|a| a.gate_output()), true); + assert!(test_bed.query(|a| a.gate_output())); } #[test] @@ -482,7 +482,7 @@ mod delayed_true_logic_gate_tests { test_bed.run_with_delta(Duration::from_millis(100)); test_bed.run_with_delta(Duration::from_millis(200)); - assert_eq!(test_bed.query(|a| a.gate_output()), false); + assert!(!test_bed.query(|a| a.gate_output())); } } @@ -532,7 +532,7 @@ mod delayed_false_logic_gate_tests { test_bed.run(); - assert_eq!(test_bed.query(|a| a.gate_output()), false); + assert!(!test_bed.query(|a| a.gate_output())); } #[test] @@ -544,7 +544,7 @@ mod delayed_false_logic_gate_tests { test_bed.command(|a| a.set_expression(true)); test_bed.run(); - assert_eq!(test_bed.query(|a| a.gate_output()), true); + assert!(test_bed.query(|a| a.gate_output())); } #[test] @@ -559,7 +559,7 @@ mod delayed_false_logic_gate_tests { test_bed.command(|a| a.set_expression(false)); test_bed.run(); - assert_eq!(test_bed.query(|a| a.gate_output()), true); + assert!(test_bed.query(|a| a.gate_output())); } #[test] @@ -574,7 +574,7 @@ mod delayed_false_logic_gate_tests { test_bed.command(|a| a.set_expression(false)); test_bed.run(); - assert_eq!(test_bed.query(|a| a.gate_output()), false); + assert!(!test_bed.query(|a| a.gate_output())); } #[test] @@ -592,7 +592,7 @@ mod delayed_false_logic_gate_tests { test_bed.run_with_delta(Duration::from_millis(100)); test_bed.run_with_delta(Duration::from_millis(200)); - assert_eq!(test_bed.query(|a| a.gate_output()), true); + assert!(test_bed.query(|a| a.gate_output())); } } @@ -642,7 +642,7 @@ mod delayed_pulse_true_logic_gate_tests { test_bed.run(); - assert_eq!(test_bed.query(|a| a.gate_output()), false); + assert!(!test_bed.query(|a| a.gate_output())); } #[test] @@ -654,7 +654,7 @@ mod delayed_pulse_true_logic_gate_tests { test_bed.command(|a| a.set_expression(true)); test_bed.run_with_delta(Duration::from_millis(0)); - assert_eq!(test_bed.query(|a| a.gate_output()), false); + assert!(!test_bed.query(|a| a.gate_output())); } #[test] @@ -666,7 +666,7 @@ mod delayed_pulse_true_logic_gate_tests { test_bed.command(|a| a.set_expression(false)); test_bed.run(); - assert_eq!(test_bed.query(|a| a.gate_output()), false); + assert!(!test_bed.query(|a| a.gate_output())); } #[test] @@ -682,7 +682,7 @@ mod delayed_pulse_true_logic_gate_tests { test_bed.command(|a| a.set_expression(false)); test_bed.run_with_delta(Duration::from_millis(300)); - assert_eq!(test_bed.query(|a| a.gate_output()), false); + assert!(!test_bed.query(|a| a.gate_output())); } #[test] @@ -695,15 +695,15 @@ mod delayed_pulse_true_logic_gate_tests { test_bed.command(|a| a.set_expression(true)); test_bed.run_with_delta(Duration::from_millis(1200)); - assert_eq!(test_bed.query(|a| a.gate_output()), true); + assert!(test_bed.query(|a| a.gate_output())); test_bed.run_with_delta(Duration::from_millis(100)); - assert_eq!(test_bed.query(|a| a.gate_output()), false); + assert!(!test_bed.query(|a| a.gate_output())); test_bed.run_with_delta(Duration::from_millis(1200)); - assert_eq!(test_bed.query(|a| a.gate_output()), false); + assert!(!test_bed.query(|a| a.gate_output())); } } #[cfg(test)]