From d4aa9b835bd2b1cee86e41662710256167868071 Mon Sep 17 00:00:00 2001 From: tyranron Date: Fri, 6 Oct 2023 20:07:57 +0300 Subject: [PATCH] Upgrade to 1.73 Rust - update Cargo deps - make Clippy happy with new lints - upgrade Chrome and Firefox versions --- .clippy.toml | 12 + Cargo.lock | 392 +++++++++--------- Makefile | 8 +- crates/medea-macro/src/lib.rs | 7 +- crates/medea-macro/src/watchers.rs | 6 +- .../src/collections/hash_map.rs | 26 +- .../src/collections/hash_set.rs | 20 +- crates/medea-reactive/src/collections/vec.rs | 16 +- crates/medea-reactive/src/field/cell.rs | 7 +- crates/medea-reactive/src/field/mod.rs | 6 +- .../src/field/progressable_cell.rs | 7 +- crates/medea-reactive/src/lib.rs | 10 +- e2e/src/browser/mod.rs | 1 + e2e/src/lib.rs | 10 +- e2e/tests/control.rs | 1 + e2e/tests/world/member.rs | 1 + e2e/tests/world/mod.rs | 1 + mock/control-api/src/client.rs | 2 +- mock/control-api/src/lib.rs | 13 +- mock/control-api/src/main.rs | 7 +- proto/client-api/src/lib.rs | 12 +- proto/control-api/build.rs | 7 +- proto/control-api/src/grpc/client.rs | 3 +- proto/control-api/src/grpc/mod.rs | 2 +- proto/control-api/src/grpc/server.rs | 3 +- proto/control-api/src/lib.rs | 10 +- src/api/dart/mod.rs | 3 +- src/lib.rs | 10 +- src/peer/component/mod.rs | 9 +- src/peer/component/watchers.rs | 2 +- src/peer/media/mod.rs | 36 +- src/peer/media/receiver/component.rs | 8 +- src/peer/media/receiver/mod.rs | 2 +- src/peer/media/sender/mod.rs | 6 +- src/peer/mod.rs | 10 +- src/platform/dart/ice_candidate.rs | 4 +- src/platform/dart/media_devices.rs | 2 +- src/platform/dart/media_track.rs | 2 +- src/platform/dart/peer_connection.rs | 59 +-- src/platform/dart/transport.rs | 6 +- src/platform/dart/utils/dart_api.rs | 8 +- src/platform/peer_connection.rs | 22 +- src/platform/rtc_stats.rs | 2 +- src/platform/transceiver.rs | 2 +- src/platform/wasm/media_device_info.rs | 15 +- src/platform/wasm/media_devices.rs | 2 + src/platform/wasm/peer_connection.rs | 75 ++-- src/platform/wasm/rtc_stats.rs | 4 +- src/platform/wasm/transceiver.rs | 4 +- src/platform/wasm/transport.rs | 10 +- src/room.rs | 4 +- src/rpc/heartbeat.rs | 2 + src/rpc/rpc_session.rs | 2 +- src/utils/errors.rs | 4 +- 54 files changed, 489 insertions(+), 416 deletions(-) diff --git a/.clippy.toml b/.clippy.toml index 0a5317286..b9d909399 100644 --- a/.clippy.toml +++ b/.clippy.toml @@ -1,6 +1,18 @@ # See full lints list at: # https://rust-lang.github.io/rust-clippy/master/index.html +absolute-paths-allowed-crates = [ + "backoff", + "fantoccini", + "log", + "proto", + "reqwest", + "syn", + "time", + "tonic", + "web_sys", +] + doc-valid-idents = [ "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "DirectX", "ECMAScript", diff --git a/Cargo.lock b/Cargo.lock index e60d00fa7..9cf1718b9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -80,7 +80,7 @@ dependencies = [ "actix-service", "actix-utils", "ahash", - "base64 0.21.3", + "base64 0.21.4", "bitflags 2.4.0", "brotli", "bytes", @@ -115,7 +115,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb" dependencies = [ "quote", - "syn 2.0.31", + "syn 2.0.38", ] [[package]] @@ -153,7 +153,7 @@ dependencies = [ "futures-core", "futures-util", "mio", - "socket2 0.5.3", + "socket2 0.5.4", "tokio", "tracing", ] @@ -214,7 +214,7 @@ dependencies = [ "serde_json", "serde_urlencoded", "smallvec", - "socket2 0.5.3", + "socket2 0.5.4", "time", "url", ] @@ -246,18 +246,18 @@ dependencies = [ "actix-router", "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.38", ] [[package]] name = "actix_derive" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d44b8fee1ced9671ba043476deddef739dd0959bf77030b26b738cc591737a7" +checksum = "7c7db3d5a9718568e4cf4a537cfd7070e6e6ff7481510d0237fb529ac850f6d3" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.38", ] [[package]] @@ -289,18 +289,18 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.0.5" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c378d78423fdad8089616f827526ee33c19f2fddbd5de1629152c9593ba4783" +checksum = "ea5d730647d4fadd988536d06fecce94b7b4f2a7efdae548f1cf4b63205518ab" dependencies = [ "memchr", ] [[package]] name = "allo-isolate" -version = "0.1.18" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71441b1911974f09ca413fc93fb2e3bfc60f4a284fdc7fd51e5a81b6afc61727" +checksum = "f56b7997817c178b853573e8bdfb6c3afe02810b43f17d766d6703560074b0c3" dependencies = [ "anyhow", "atomic", @@ -356,9 +356,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.5.0" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f58811cfac344940f1a400b6e6231ce35171f614f26439e80f8c1465c5cc0c" +checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44" dependencies = [ "anstyle", "anstyle-parse", @@ -370,15 +370,15 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.2" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15c4c2c83f81532e5845a733998b6971faca23490340a418e9b72a3ec9de12ea" +checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" [[package]] name = "anstyle-parse" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" +checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140" dependencies = [ "utf8parse", ] @@ -394,9 +394,9 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "2.1.0" +version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58f54d10c6dfa51283a066ceab3ec1ab78d13fae00aa49243a45e4571fb79dfd" +checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" dependencies = [ "anstyle", "windows-sys 0.48.0", @@ -422,7 +422,7 @@ checksum = "5fd55a5ba1179988837d24ab4c7cc8ed6efdeff578ede0416b4225a5fca35bd0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.38", ] [[package]] @@ -444,7 +444,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.38", ] [[package]] @@ -455,7 +455,7 @@ checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.38", ] [[package]] @@ -562,9 +562,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.3" +version = "0.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "414dcefbc63d77c526a76b3afcf6fbb9b5e2791c19c3aa2297733208750c6e53" +checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2" [[package]] name = "bitflags" @@ -589,9 +589,9 @@ dependencies = [ [[package]] name = "brotli" -version = "3.3.4" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1a0b1dbcc8ae29329621f8d4f0d835787c1c38bb1401979b49d13b0b305ff68" +checksum = "516074a47ef4bce09577a3b379392300159ce5b1ba2e501ff1c819950066100f" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -600,9 +600,9 @@ dependencies = [ [[package]] name = "brotli-decompressor" -version = "2.3.4" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b6561fd3f895a11e8f72af2cb7d22e08366bebc2b6b57f7744c4bda27034744" +checksum = "da74e2b81409b1b743f8f0c62cc6254afefb8b8e50bbfe3735550f7aeefa3448" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -626,15 +626,15 @@ checksum = "832133bbabbbaa9fbdba793456a2827627a7d2b8fb96032fa1e7666d7895832b" [[package]] name = "bumpalo" -version = "3.13.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" [[package]] name = "bytecount" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c676a478f63e9fa2dd5368a42f28bba0d6c560b775f38583c8bbaa7fcd67c9c" +checksum = "ad152d03a2c813c80bb94fedbf3a3f02b28f793e39e7c214c8a0bcc196343de7" [[package]] name = "bytemuck" @@ -681,9 +681,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.29" +version = "0.4.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d87d9d13be47a5b7c3907137f1290b0459a7f80efb26be8c52afb11963bccb02" +checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" dependencies = [ "android-tzdata", "iana-time-zone", @@ -694,9 +694,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.2" +version = "4.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a13b88d2c62ff462f88e4a121f17a82c1af05693a2f192b5c38d14de73c19f6" +checksum = "d04704f56c2cde07f43e8e2c154b43f216dc5c92fc98ada720177362f953b956" dependencies = [ "clap_builder", "clap_derive", @@ -704,9 +704,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.2" +version = "4.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bb9faaa7c2ef94b2743a21f5a29e6f0010dff4caa69ac8e9d6cf8b6fa74da08" +checksum = "0e231faeaca65ebd1ea3c737966bf858971cd38c3849107aa3ea7de90a804e45" dependencies = [ "anstream", "anstyle", @@ -724,7 +724,7 @@ dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.38", ] [[package]] @@ -897,7 +897,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.31", + "syn 2.0.38", "synthez", ] @@ -936,7 +936,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.31", + "syn 2.0.38", ] [[package]] @@ -947,7 +947,7 @@ checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ "darling_core", "quote", - "syn 2.0.31", + "syn 2.0.38", ] [[package]] @@ -1086,9 +1086,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "136526188508e25c6fef639d7927dfb3e0e3084488bf202267829cf7fc23dbdd" +checksum = "add4f07d43996f76ef320709726a556a9d4f965d9410d8d0271132d2f8293480" dependencies = [ "errno-dragonfly", "libc", @@ -1129,9 +1129,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "fixedbitset" @@ -1183,9 +1183,9 @@ dependencies = [ [[package]] name = "flutter_rust_bridge_macros" -version = "1.81.0" +version = "1.82.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "949f115a15199789eb73bc7ed7dd8f5b0cb0e035b77d2197a284857c5ca93aff" +checksum = "0ef4736aac920ca50be2c7747a46494d3740ca88bc49a6654b031d6f396282f3" [[package]] name = "fnv" @@ -1279,7 +1279,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.38", ] [[package]] @@ -1409,9 +1409,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -version = "0.14.0" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" +checksum = "7dfda62a12f55daeae5015f81b0baea145391cb4520f86c248fc615d72640d12" [[package]] name = "heck" @@ -1439,9 +1439,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" [[package]] name = "hex" @@ -1641,12 +1641,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.0.0" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897" dependencies = [ "equivalent", - "hashbrown 0.14.0", + "hashbrown 0.14.1", "serde", ] @@ -1674,17 +1674,6 @@ version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1be380c410bf0595e94992a648ea89db4dd3f3354ba54af206fd2a68cf5ac8e" -[[package]] -name = "io-lifetimes" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" -dependencies = [ - "hermit-abi 0.3.2", - "libc", - "windows-sys 0.48.0", -] - [[package]] name = "ipnet" version = "2.8.0" @@ -1697,8 +1686,8 @@ version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ - "hermit-abi 0.3.2", - "rustix 0.38.11", + "hermit-abi 0.3.3", + "rustix", "windows-sys 0.48.0", ] @@ -1752,9 +1741,9 @@ checksum = "d4345964bb142484797b161f473a503a434de77149dd8c7427788c6e13379388" [[package]] name = "lazy-regex" -version = "3.0.1" +version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57451d19ad5e289ff6c3d69c2a2424652995c42b79dafa11e9c4d5508c913c01" +checksum = "e723bd417b2df60a0f6a2b6825f297ea04b245d4ba52b5a22cb679bdf58b05fa" dependencies = [ "lazy-regex-proc_macros", "once_cell", @@ -1770,7 +1759,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.31", + "syn 2.0.38", ] [[package]] @@ -1781,9 +1770,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.147" +version = "0.2.148" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b" [[package]] name = "linked-hash-map" @@ -1793,25 +1782,18 @@ checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" [[package]] name = "linux-raw-sys" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" - -[[package]] -name = "linux-raw-sys" -version = "0.4.5" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" +checksum = "3852614a3bd9ca9804678ba6be5e3b8ce76dfc902cae004e3e0c44051b6e88db" [[package]] name = "local-channel" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f303ec0e94c6c54447f84f3b0ef7af769858a9c4ef56ef2a986d3dcd4c3fc9c" +checksum = "e0a493488de5f18c8ffcba89eebb8532ffc562dc400490eb65b84893fae0b178" dependencies = [ "futures-core", "futures-sink", - "futures-util", "local-waker", ] @@ -1839,9 +1821,9 @@ checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "matchit" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed1202b2a6f884ae56f04cff409ab315c5ce26b5e58d7412e484f01fd52f52ef" +checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" [[package]] name = "medea-client-api-proto" @@ -1880,7 +1862,7 @@ dependencies = [ [[package]] name = "medea-control-api-proto" -version = "0.10.0-dev" +version = "0.10.0" dependencies = [ "async-trait", "derive_more", @@ -1965,7 +1947,7 @@ dependencies = [ "medea-jason", "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.38", "synstructure", ] @@ -1979,9 +1961,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.6.3" +version = "2.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" [[package]] name = "memory_units" @@ -2115,7 +2097,7 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.3.2", + "hermit-abi 0.3.3", "libc", ] @@ -2166,7 +2148,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.38", ] [[package]] @@ -2256,7 +2238,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" dependencies = [ "fixedbitset", - "indexmap 2.0.0", + "indexmap 2.0.2", ] [[package]] @@ -2276,7 +2258,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.38", ] [[package]] @@ -2335,28 +2317,28 @@ dependencies = [ [[package]] name = "prettyplease" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8832c0f9be7e3cae60727e6256cfd2cd3c3e2b6cd5dad4190ecb2fd658c9030b" +checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" dependencies = [ "proc-macro2", - "syn 2.0.31", + "syn 2.0.38", ] [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "5b1106fec09662ec6dd98ccac0f81cef56984d0b49f75c92d8cbad76e20c005c" dependencies = [ "unicode-ident", ] [[package]] name = "prost" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa8473a65b88506c106c28ae905ca4a2b83a2993640467a41bb3080627ddfd2c" +checksum = "f4fdd22f3b9c31b53c060df4a0613a1c7f062d4115a2b984dd15b1858f7e340d" dependencies = [ "bytes", "prost-derive", @@ -2364,9 +2346,9 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30d3e647e9eb04ddfef78dfee2d5b3fefdf94821c84b710a3d8ebc89ede8b164" +checksum = "8bdf592881d821b83d471f8af290226c8d51402259e9bb5be7f9f8bdebbb11ac" dependencies = [ "bytes", "heck 0.4.1", @@ -2379,29 +2361,29 @@ dependencies = [ "prost", "prost-types", "regex", - "syn 2.0.31", + "syn 2.0.38", "tempfile", "which", ] [[package]] name = "prost-derive" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56075c27b20ae524d00f247b8a4dc333e5784f889fe63099f8e626bc8d73486c" +checksum = "265baba7fabd416cf5078179f7d2cbeca4ce7a9041111900675ea7c4cb8a4c32" dependencies = [ "anyhow", "itertools 0.11.0", "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.38", ] [[package]] name = "prost-types" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cebe0a918c97f86c217b0f76fd754e966f8b9f41595095cf7d74cb4e59d730f6" +checksum = "e081b29f63d83a4bc75cfc9f3fe424f9156cf92d8a4f0c9407cce9a1b67327cf" dependencies = [ "prost", ] @@ -2491,14 +2473,14 @@ checksum = "7f7473c2cfcf90008193dd0e3e16599455cb601a9fce322b5bb55de799664925" dependencies = [ "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.38", ] [[package]] name = "regex" -version = "1.9.5" +version = "1.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "697061221ea1b4a94a624f67d0ae2bfe4e22b8a17b6a192afb11046542cc8c47" +checksum = "ebee201405406dbf528b8b672104ae6d6d63e6d118cb10e4d51abbc7b58044ff" dependencies = [ "aho-corasick", "memchr", @@ -2508,9 +2490,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2f401f4955220693b56f8ec66ee9c78abffd8d1c4f23dc41a23839eb88f0795" +checksum = "59b23e92ee4318893fa3fe3e6fb365258efbfe6ac6ab30f090cdcbb7aa37efa9" dependencies = [ "aho-corasick", "memchr", @@ -2525,11 +2507,11 @@ checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" [[package]] name = "reqwest" -version = "0.11.20" +version = "0.11.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e9ad3fe7488d7e34558a2033d45a0c90b72d97b4f80705666fea71472e2e6a1" +checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" dependencies = [ - "base64 0.21.3", + "base64 0.21.4", "bytes", "encoding_rs", "futures-core", @@ -2550,6 +2532,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", + "system-configuration", "tokio", "tokio-native-tls", "tower-service", @@ -2592,28 +2575,14 @@ dependencies = [ [[package]] name = "rustix" -version = "0.37.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d69718bf81c6127a49dc64e44a742e8bb9213c0ff8869a22c308f84c1d4ab06" -dependencies = [ - "bitflags 1.3.2", - "errno", - "io-lifetimes", - "libc", - "linux-raw-sys 0.3.8", - "windows-sys 0.48.0", -] - -[[package]] -name = "rustix" -version = "0.38.11" +version = "0.38.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0c3dde1fc030af041adc40e79c0e7fbcf431dd24870053d187d7c66e4b87453" +checksum = "f25469e9ae0f3d0047ca8b93fc56843f38e6774f0914a107ff8b41be8be8e0b7" dependencies = [ "bitflags 2.4.0", "errno", "libc", - "linux-raw-sys 0.4.5", + "linux-raw-sys", "windows-sys 0.48.0", ] @@ -2647,7 +2616,7 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" dependencies = [ - "base64 0.21.3", + "base64 0.21.4", ] [[package]] @@ -2723,7 +2692,7 @@ dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.38", ] [[package]] @@ -2751,9 +2720,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.18" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" +checksum = "ad977052201c6de01a8ef2aa3378c4bd23217a056337d1d6da40468d267a4fb0" [[package]] name = "serde" @@ -2772,14 +2741,14 @@ checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.38", ] [[package]] name = "serde_json" -version = "1.0.105" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360" +checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" dependencies = [ "itoa", "ryu", @@ -2804,11 +2773,11 @@ version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ca3b16a3d82c4088f343b7480a93550b3eabe1a358569c2dfe38bbcead07237" dependencies = [ - "base64 0.21.3", + "base64 0.21.4", "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.0.0", + "indexmap 2.0.2", "serde", "serde_json", "serde_with_macros", @@ -2824,7 +2793,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.38", ] [[package]] @@ -2833,7 +2802,7 @@ version = "0.9.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a49e178e4452f45cb61d0cd8cebc1b0fafd3e41929e996cef79aa3aca91f574" dependencies = [ - "indexmap 2.0.0", + "indexmap 2.0.2", "itoa", "ryu", "serde", @@ -2842,9 +2811,9 @@ dependencies = [ [[package]] name = "sha1" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if 1.0.0", "cpufeatures", @@ -2951,9 +2920,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" +checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" [[package]] name = "smart-default" @@ -2963,14 +2932,14 @@ checksum = "0eb01866308440fc64d6c44d9e86c5cc17adfe33c4d6eed55da9145044d0ffc1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.38", ] [[package]] name = "smawk" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f67ad224767faa3c7d8b6d91985b78e70a1324408abcb1cfcc2be4c06bc06043" +checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c" [[package]] name = "socket2" @@ -2984,9 +2953,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.3" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877" +checksum = "4031e820eb552adee9295814c0ced9e5cf38ddf1e8b7d566d6de8e2538ea989e" dependencies = [ "libc", "windows-sys 0.48.0", @@ -3017,9 +2986,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.31" +version = "2.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "718fa2415bcb8d8bd775917a1bf12a7931b6dfa890753378538118181e0cb398" +checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" dependencies = [ "proc-macro2", "quote", @@ -3040,7 +3009,7 @@ checksum = "285ba80e733fac80aa4270fbcdf83772a79b80aa35c97075320abfee4a915b06" dependencies = [ "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.38", "unicode-xid", ] @@ -3050,7 +3019,7 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3d2c2202510a1e186e63e596d9318c91a8cbe85cd1a56a7be0c333e5f59ec8d" dependencies = [ - "syn 2.0.31", + "syn 2.0.38", "synthez-codegen", "synthez-core", ] @@ -3061,7 +3030,7 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f724aa6d44b7162f3158a57bccd871a77b39a4aef737e01bcdff41f4772c7746" dependencies = [ - "syn 2.0.31", + "syn 2.0.38", "synthez-core", ] @@ -3074,7 +3043,28 @@ dependencies = [ "proc-macro2", "quote", "sealed 0.5.0", - "syn 2.0.31", + "syn 2.0.38", +] + +[[package]] +name = "system-configuration" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +dependencies = [ + "core-foundation-sys", + "libc", ] [[package]] @@ -3092,7 +3082,7 @@ dependencies = [ "cfg-if 1.0.0", "fastrand", "redox_syscall 0.3.5", - "rustix 0.38.11", + "rustix", "windows-sys 0.48.0", ] @@ -3109,11 +3099,11 @@ dependencies = [ [[package]] name = "terminal_size" -version = "0.2.6" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e6bf6f19e9f8ed8d4048dc22981458ebcf406d67e94cd422e5ecd73d63b3237" +checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" dependencies = [ - "rustix 0.37.23", + "rustix", "windows-sys 0.48.0", ] @@ -3136,22 +3126,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.48" +version = "1.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d6d7a740b8a666a7e828dd00da9c0dc290dff53154ea77ac109281de90589b7" +checksum = "1177e8c6d7ede7afde3585fd2513e611227efd6481bd78d2e82ba1ce16557ed4" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.48" +version = "1.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35" +checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.38", ] [[package]] @@ -3175,9 +3165,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17f6bb557fd245c28e6411aa56b6403c689ad95061f50e4be16c274e70a17e48" +checksum = "426f806f4089c493dcac0d24c29c01e2c38baf8e30f1b716ee37e83d200b18fe" dependencies = [ "deranged", "itoa", @@ -3190,15 +3180,15 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a942f44339478ef67935ab2bbaec2fb0322496cf3cbe84b261e06ac3814c572" +checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" dependencies = [ "time-core", ] @@ -3232,7 +3222,7 @@ dependencies = [ "parking_lot", "pin-project-lite", "signal-hook-registry", - "socket2 0.5.3", + "socket2 0.5.4", "tokio-macros", "windows-sys 0.48.0", ] @@ -3255,7 +3245,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.38", ] [[package]] @@ -3292,9 +3282,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.8" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" +checksum = "1d68074620f57a0b21594d9735eb2e98ab38b17f80d3fcb189fca266771ca60d" dependencies = [ "bytes", "futures-core", @@ -3306,14 +3296,14 @@ dependencies = [ [[package]] name = "tonic" -version = "0.10.0" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5469afaf78a11265c343a88969045c1568aa8ecc6c787dbf756e92e70f199861" +checksum = "d560933a0de61cf715926b9cac824d4c883c2c43142f787595e48280c40a1d0e" dependencies = [ "async-stream", "async-trait", "axum", - "base64 0.21.3", + "base64 0.21.4", "bytes", "h2", "http", @@ -3333,15 +3323,15 @@ dependencies = [ [[package]] name = "tonic-build" -version = "0.10.0" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b477abbe1d18c0b08f56cd01d1bc288668c5b5cfd19b2ae1886bbf599c546f1" +checksum = "9d021fc044c18582b9a2408cd0dd05b1596e3ecdb5c4df822bb0183545683889" dependencies = [ "prettyplease", "proc-macro2", "prost-build", "quote", - "syn 2.0.31", + "syn 2.0.38", ] [[package]] @@ -3407,7 +3397,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.38", ] [[package]] @@ -3438,9 +3428,9 @@ dependencies = [ [[package]] name = "typenum" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "unicode-bidi" @@ -3450,9 +3440,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-linebreak" @@ -3477,9 +3467,9 @@ checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" [[package]] name = "unicode-width" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" [[package]] name = "unicode-xid" @@ -3584,7 +3574,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.38", "wasm-bindgen-shared", ] @@ -3618,7 +3608,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.38", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -3695,9 +3685,9 @@ dependencies = [ [[package]] name = "webpki" -version = "0.22.1" +version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0e74f82d49d545ad128049b7e88f6576df2da6b02e9ce565c6f533be576957e" +checksum = "07ecc0cd7cac091bf682ec5efa18b1cff79d617b84181f38b3951dbe135f607f" dependencies = [ "ring", "untrusted", @@ -3724,7 +3714,7 @@ dependencies = [ "either", "home", "once_cell", - "rustix 0.38.11", + "rustix", ] [[package]] @@ -3745,9 +3735,9 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" dependencies = [ "winapi", ] diff --git a/Makefile b/Makefile index 65640e5da..6bc806633 100644 --- a/Makefile +++ b/Makefile @@ -20,11 +20,11 @@ IMAGE_NAME := $(strip \ $(if $(call eq,$(image),medea-demo-edge),medea-demo,\ $(or $(image),medea-control-api-mock))) -RUST_VER := 1.72 -CHROME_VERSION := 116.0 -FIREFOX_VERSION := 117.0-driver0.33.0 +RUST_VER := 1.73 +CHROME_VERSION := 117.0 +FIREFOX_VERSION := 118.0.1-driver0.33.0 -CARGO_NDK_VER := 3.3.0-ndkr25c-rust$(RUST_VER) +CARGO_NDK_VER := 3.4.0-ndkr26-rust$(RUST_VER) ANDROID_TARGETS := aarch64-linux-android \ armv7-linux-androideabi \ i686-linux-android \ diff --git a/crates/medea-macro/src/lib.rs b/crates/medea-macro/src/lib.rs index 8547990db..521f1d032 100644 --- a/crates/medea-macro/src/lib.rs +++ b/crates/medea-macro/src/lib.rs @@ -9,6 +9,7 @@ )] #![forbid(non_ascii_idents, unsafe_code)] #![warn( + clippy::absolute_paths, clippy::as_conversions, clippy::as_ptr_cast_mut, clippy::assertions_on_result_states, @@ -57,6 +58,7 @@ clippy::mutex_atomic, clippy::mutex_integer, clippy::needless_collect, + clippy::needless_pass_by_ref_mut, clippy::needless_raw_strings, clippy::nonstandard_macro_braces, clippy::option_if_let_else, @@ -69,6 +71,7 @@ clippy::pub_without_shorthand, clippy::rc_buffer, clippy::rc_mutex, + clippy::readonly_write_lock, clippy::redundant_clone, clippy::redundant_type_annotations, clippy::ref_patterns, @@ -81,6 +84,7 @@ clippy::str_to_string, clippy::string_add, clippy::string_lit_as_bytes, + clippy::string_lit_chars_any, clippy::string_slice, clippy::string_to_string, clippy::suboptimal_flops, @@ -92,7 +96,6 @@ clippy::transmute_undefined_repr, clippy::trivial_regex, clippy::try_err, - clippy::tuple_array_conversions, clippy::undocumented_unsafe_blocks, clippy::unimplemented, clippy::unnecessary_safety_comment, @@ -109,13 +112,11 @@ clippy::verbose_file_reads, clippy::wildcard_enum_match_arm, future_incompatible, - invalid_reference_casting, let_underscore_drop, meta_variable_misuse, missing_copy_implementations, missing_debug_implementations, missing_docs, - noop_method_call, semicolon_in_expressions_from_macros, unreachable_pub, unused_crate_dependencies, diff --git a/crates/medea-macro/src/watchers.rs b/crates/medea-macro/src/watchers.rs index b35e48a81..ea42f53e9 100644 --- a/crates/medea-macro/src/watchers.rs +++ b/crates/medea-macro/src/watchers.rs @@ -79,7 +79,11 @@ pub(crate) fn expand(mut input: ItemImpl) -> Result { }; Ok(quote! { - #[allow(clippy::multiple_inherent_impl)] + #[allow( + clippy::let_underscore_untyped, + clippy::multiple_inherent_impl, + let_underscore_drop, + )] #input impl crate::utils::component::ComponentState< diff --git a/crates/medea-reactive/src/collections/hash_map.rs b/crates/medea-reactive/src/collections/hash_map.rs index cb9ea0514..238c80e4a 100644 --- a/crates/medea-reactive/src/collections/hash_map.rs +++ b/crates/medea-reactive/src/collections/hash_map.rs @@ -3,12 +3,15 @@ //! [1]: std::collections::HashMap use std::{ - collections::hash_map::{Iter, Values}, + collections::{ + hash_map::{Iter, Values}, + HashMap as StdHashMap, + }, hash::Hash, marker::PhantomData, }; -use futures::stream::{LocalBoxStream, StreamExt as _}; +use futures::stream::{self, LocalBoxStream, StreamExt as _}; use crate::subscribers_store::{ common, progressable, @@ -100,7 +103,7 @@ pub type ObservableHashMap = #[derive(Debug, Clone)] pub struct HashMap, O> { /// Data stored by this [`HashMap`]. - store: std::collections::HashMap, + store: StdHashMap, /// Subscribers of the [`HashMap::on_insert()`] method. on_insert_subs: S, @@ -203,7 +206,7 @@ where /// [`Stream`]: futures::Stream #[allow(clippy::needless_collect)] // false positive: lifetimes pub fn replay_on_insert(&self) -> LocalBoxStream<'static, O> { - Box::pin(futures::stream::iter( + Box::pin(stream::iter( self.store .iter() .map(|(k, v)| self.on_insert_subs.wrap((k.clone(), v.clone()))) @@ -252,10 +255,7 @@ where /// Removes all entries which are not present in the provided [`HashMap`]. /// /// [`HashMap`]: std::collections::HashMap - pub fn remove_not_present( - &mut self, - other: &std::collections::HashMap, - ) { + pub fn remove_not_present(&mut self, other: &StdHashMap) { self.iter() .filter_map(|(id, _)| { if other.contains_key(id) { @@ -305,7 +305,7 @@ where impl, O> Default for HashMap { fn default() -> Self { Self { - store: std::collections::HashMap::new(), + store: StdHashMap::new(), on_insert_subs: S::default(), on_remove_subs: S::default(), _output: PhantomData, @@ -313,10 +313,10 @@ impl, O> Default for HashMap { } } -impl, O> - From> for HashMap +impl, O> From> + for HashMap { - fn from(from: std::collections::HashMap) -> Self { + fn from(from: StdHashMap) -> Self { Self { store: from, on_remove_subs: S::default(), @@ -354,7 +354,7 @@ where { fn from_iter>(iter: T) -> Self { Self { - store: std::collections::HashMap::from_iter(iter), + store: StdHashMap::from_iter(iter), on_remove_subs: S::default(), on_insert_subs: S::default(), _output: PhantomData, diff --git a/crates/medea-reactive/src/collections/hash_set.rs b/crates/medea-reactive/src/collections/hash_set.rs index a66ab95ef..b2162e435 100644 --- a/crates/medea-reactive/src/collections/hash_set.rs +++ b/crates/medea-reactive/src/collections/hash_set.rs @@ -1,8 +1,12 @@ //! Reactive hash set based on [`HashSet`]. -use std::{collections::hash_set::Iter, hash::Hash, marker::PhantomData}; +use std::{ + collections::{hash_set::Iter, HashSet as StdHashSet}, + hash::Hash, + marker::PhantomData, +}; -use futures::stream::LocalBoxStream; +use futures::stream::{self, LocalBoxStream}; use crate::subscribers_store::{ common, progressable, @@ -99,7 +103,7 @@ pub type ObservableHashSet = HashSet, T>; #[derive(Debug)] pub struct HashSet, O> { /// Data stored by this [`HashSet`]. - store: std::collections::HashSet, + store: StdHashSet, /// Subscribers of the [`HashSet::on_insert()`] method. on_insert_subs: S, @@ -192,7 +196,7 @@ where /// [`Stream`]: futures::Stream #[allow(clippy::needless_collect)] // false positive: lifetimes pub fn replay_on_insert(&self) -> LocalBoxStream<'static, O> { - Box::pin(futures::stream::iter( + Box::pin(stream::iter( self.store .clone() .into_iter() @@ -243,7 +247,7 @@ where /// diff is not empty. /// /// For the usage example you can read [`HashSet`] docs. - pub fn update(&mut self, updated: std::collections::HashSet) { + pub fn update(&mut self, updated: StdHashSet) { let removed_elems = self.store.difference(&updated); let inserted_elems = updated.difference(&self.store); @@ -273,7 +277,7 @@ where { fn default() -> Self { Self { - store: std::collections::HashSet::new(), + store: StdHashSet::new(), on_insert_subs: S::default(), on_remove_subs: S::default(), _output: PhantomData, @@ -305,11 +309,11 @@ where } } -impl From> for HashSet +impl From> for HashSet where S: SubscribersStore, { - fn from(from: std::collections::HashSet) -> Self { + fn from(from: StdHashSet) -> Self { Self { store: from, on_insert_subs: S::default(), diff --git a/crates/medea-reactive/src/collections/vec.rs b/crates/medea-reactive/src/collections/vec.rs index dd0264ab4..076831f81 100644 --- a/crates/medea-reactive/src/collections/vec.rs +++ b/crates/medea-reactive/src/collections/vec.rs @@ -1,8 +1,8 @@ //! Reactive vector based on [`Vec`]. -use std::{marker::PhantomData, mem, slice::Iter}; +use std::{marker::PhantomData, mem, slice::Iter, vec::Vec as StdVec}; -use futures::stream::LocalBoxStream; +use futures::stream::{self, LocalBoxStream}; use crate::subscribers_store::{ common, progressable, @@ -83,7 +83,7 @@ pub type ObservableVec = Vec, T>; #[derive(Debug)] pub struct Vec, O> { /// Data stored by this [`Vec`]. - store: std::vec::Vec, + store: StdVec, /// Subscribers of the [`Vec::on_push`] method. on_push_subs: S, @@ -194,12 +194,12 @@ where /// [`Stream`]: futures::Stream #[allow(clippy::needless_collect)] // false positive: lifetimes pub fn replay_on_push(&self) -> LocalBoxStream<'static, O> { - Box::pin(futures::stream::iter( + Box::pin(stream::iter( self.store .clone() .into_iter() .map(|val| self.on_push_subs.wrap(val)) - .collect::>(), + .collect::>(), )) } } @@ -209,7 +209,7 @@ where impl, O> Default for Vec { fn default() -> Self { Self { - store: std::vec::Vec::new(), + store: StdVec::new(), on_push_subs: S::default(), on_remove_subs: S::default(), _output: PhantomData, @@ -217,8 +217,8 @@ impl, O> Default for Vec { } } -impl, O> From> for Vec { - fn from(from: std::vec::Vec) -> Self { +impl, O> From> for Vec { + fn from(from: StdVec) -> Self { Self { store: from, on_push_subs: S::default(), diff --git a/crates/medea-reactive/src/field/cell.rs b/crates/medea-reactive/src/field/cell.rs index c2b87014b..94828a118 100644 --- a/crates/medea-reactive/src/field/cell.rs +++ b/crates/medea-reactive/src/field/cell.rs @@ -8,7 +8,10 @@ #![allow(clippy::module_name_repetitions)] -use std::cell::{Ref, RefCell}; +use std::{ + cell::{Ref, RefCell}, + mem, +}; use futures::{future::LocalBoxFuture, stream::LocalBoxStream}; @@ -162,7 +165,7 @@ where /// Replaces the contained underlying data with the given `new_data` value, /// and returns the old one. pub fn replace(&self, mut new_data: D) -> D { - std::mem::swap(&mut *self.0.borrow_mut().borrow_mut(), &mut new_data); + mem::swap(&mut *self.0.borrow_mut().borrow_mut(), &mut new_data); new_data } diff --git a/crates/medea-reactive/src/field/mod.rs b/crates/medea-reactive/src/field/mod.rs index ac69864f2..40e292bc4 100644 --- a/crates/medea-reactive/src/field/mod.rs +++ b/crates/medea-reactive/src/field/mod.rs @@ -13,7 +13,7 @@ use std::{ use futures::{ channel::{mpsc, oneshot}, - future::LocalBoxFuture, + future::{self, LocalBoxFuture}, stream::{self, LocalBoxStream, StreamExt as _}, }; @@ -94,7 +94,7 @@ where // TODO: This is kinda broken. // See https://github.com/instrumentisto/medea/issues/163 issue. if (assert_fn)(&self.data) { - Box::pin(futures::future::ok(())) + Box::pin(future::ok(())) } else { self.subs.when(Box::new(assert_fn)) } @@ -318,7 +318,7 @@ impl OnObservableFieldModification .take() .expect("`UniversalSubscriber::When` used already") .send(()) - .map_or(false, |_| false) + .map_or(false, |()| false) } else { true } diff --git a/crates/medea-reactive/src/field/progressable_cell.rs b/crates/medea-reactive/src/field/progressable_cell.rs index 8ed97ba5e..41e2e967a 100644 --- a/crates/medea-reactive/src/field/progressable_cell.rs +++ b/crates/medea-reactive/src/field/progressable_cell.rs @@ -2,7 +2,10 @@ //! //! [`Cell`]: std::cell::Cell -use std::cell::{Ref, RefCell}; +use std::{ + cell::{Ref, RefCell}, + mem, +}; use futures::stream::LocalBoxStream; @@ -79,7 +82,7 @@ where /// value. #[must_use] pub fn replace(&self, mut new_data: D) -> D { - std::mem::swap(&mut *self.0.borrow_mut().borrow_mut(), &mut new_data); + mem::swap(&mut *self.0.borrow_mut().borrow_mut(), &mut new_data); new_data } diff --git a/crates/medea-reactive/src/lib.rs b/crates/medea-reactive/src/lib.rs index 1eab1f853..45548e584 100644 --- a/crates/medea-reactive/src/lib.rs +++ b/crates/medea-reactive/src/lib.rs @@ -9,6 +9,7 @@ )] #![forbid(non_ascii_idents, unsafe_code)] #![warn( + clippy::absolute_paths, clippy::as_conversions, clippy::as_ptr_cast_mut, clippy::assertions_on_result_states, @@ -57,6 +58,7 @@ clippy::mutex_atomic, clippy::mutex_integer, clippy::needless_collect, + clippy::needless_pass_by_ref_mut, clippy::needless_raw_strings, clippy::nonstandard_macro_braces, clippy::option_if_let_else, @@ -69,6 +71,7 @@ clippy::pub_without_shorthand, clippy::rc_buffer, clippy::rc_mutex, + clippy::readonly_write_lock, clippy::redundant_clone, clippy::redundant_type_annotations, clippy::ref_patterns, @@ -81,6 +84,7 @@ clippy::str_to_string, clippy::string_add, clippy::string_lit_as_bytes, + clippy::string_lit_chars_any, clippy::string_slice, clippy::string_to_string, clippy::suboptimal_flops, @@ -92,7 +96,6 @@ clippy::transmute_undefined_repr, clippy::trivial_regex, clippy::try_err, - clippy::tuple_array_conversions, clippy::undocumented_unsafe_blocks, clippy::unimplemented, clippy::unnecessary_safety_comment, @@ -109,13 +112,11 @@ clippy::verbose_file_reads, clippy::wildcard_enum_match_arm, future_incompatible, - invalid_reference_casting, let_underscore_drop, meta_variable_misuse, missing_copy_implementations, missing_debug_implementations, missing_docs, - noop_method_call, semicolon_in_expressions_from_macros, unreachable_pub, unused_crate_dependencies, @@ -128,6 +129,9 @@ unused_tuple_struct_fields, variant_size_differences )] +// TODO: Massive false positives on `.await` points. Try remove on next Rust +// version. +#![allow(clippy::multiple_unsafe_ops_per_block)] pub mod collections; pub mod field; diff --git a/e2e/src/browser/mod.rs b/e2e/src/browser/mod.rs index ce719fef8..17cdc0364 100644 --- a/e2e/src/browser/mod.rs +++ b/e2e/src/browser/mod.rs @@ -46,6 +46,7 @@ pub enum Error { /// Shortcut for a [`Result`] with an [`Error`](enum@Error) inside. /// /// [`Result`]: std::result::Result +#[allow(clippy::absolute_paths)] type Result = std::result::Result; /// [WebDriver] handle of a browser window. diff --git a/e2e/src/lib.rs b/e2e/src/lib.rs index 912a4a663..3c6983909 100644 --- a/e2e/src/lib.rs +++ b/e2e/src/lib.rs @@ -12,6 +12,7 @@ )] #![forbid(non_ascii_idents)] #![warn( + clippy::absolute_paths, clippy::as_conversions, clippy::as_ptr_cast_mut, clippy::assertions_on_result_states, @@ -60,6 +61,7 @@ clippy::mutex_atomic, clippy::mutex_integer, clippy::needless_collect, + clippy::needless_pass_by_ref_mut, clippy::needless_raw_strings, clippy::nonstandard_macro_braces, clippy::option_if_let_else, @@ -72,6 +74,7 @@ clippy::pub_without_shorthand, clippy::rc_buffer, clippy::rc_mutex, + clippy::readonly_write_lock, clippy::redundant_clone, clippy::redundant_type_annotations, clippy::ref_patterns, @@ -84,6 +87,7 @@ clippy::str_to_string, clippy::string_add, clippy::string_lit_as_bytes, + clippy::string_lit_chars_any, clippy::string_slice, clippy::string_to_string, clippy::suboptimal_flops, @@ -95,7 +99,6 @@ clippy::transmute_undefined_repr, clippy::trivial_regex, clippy::try_err, - clippy::tuple_array_conversions, clippy::undocumented_unsafe_blocks, clippy::unimplemented, clippy::unnecessary_safety_comment, @@ -112,13 +115,11 @@ clippy::verbose_file_reads, clippy::wildcard_enum_match_arm, future_incompatible, - invalid_reference_casting, let_underscore_drop, meta_variable_misuse, missing_copy_implementations, missing_debug_implementations, missing_docs, - noop_method_call, semicolon_in_expressions_from_macros, unreachable_pub, unused_crate_dependencies, @@ -132,6 +133,9 @@ variant_size_differences )] #![allow(clippy::unwrap_used, unused_crate_dependencies)] +// TODO: Massive false positives on `.await` points. Try remove on next Rust +// version. +#![allow(clippy::multiple_unsafe_ops_per_block)] pub mod browser; pub mod object; diff --git a/e2e/tests/control.rs b/e2e/tests/control.rs index 76b106dca..166d598ae 100644 --- a/e2e/tests/control.rs +++ b/e2e/tests/control.rs @@ -13,6 +13,7 @@ pub enum Error { Reqwest(reqwest::Error), } +#[allow(clippy::absolute_paths)] type Result = std::result::Result; /// Client of a Control API. diff --git a/e2e/tests/world/member.rs b/e2e/tests/world/member.rs index 64cd20397..7bcaec566 100644 --- a/e2e/tests/world/member.rs +++ b/e2e/tests/world/member.rs @@ -23,6 +23,7 @@ pub enum Error { /// Shortcut for a [`Result`] containing an [`Error`](enum@Error). /// /// [`Result`]: std::result::Result +#[allow(clippy::absolute_paths)] type Result = std::result::Result; /// Builder of a [`Member`]. diff --git a/e2e/tests/world/mod.rs b/e2e/tests/world/mod.rs index f416d6d3e..a3613a206 100644 --- a/e2e/tests/world/mod.rs +++ b/e2e/tests/world/mod.rs @@ -47,6 +47,7 @@ pub enum Error { MemberNotFound(#[error(not(source))] String), } +#[allow(clippy::absolute_paths)] type Result = std::result::Result; /// [`World`][1] used by all E2E tests. diff --git a/mock/control-api/src/client.rs b/mock/control-api/src/client.rs index e8b3fc3c7..de03029bb 100644 --- a/mock/control-api/src/client.rs +++ b/mock/control-api/src/client.rs @@ -31,7 +31,7 @@ impl Fid { } impl From<()> for Fid { - fn from(_: ()) -> Self { + fn from((): ()) -> Self { Self(String::new()) } } diff --git a/mock/control-api/src/lib.rs b/mock/control-api/src/lib.rs index 7bc64564f..4abd2c925 100644 --- a/mock/control-api/src/lib.rs +++ b/mock/control-api/src/lib.rs @@ -8,6 +8,7 @@ )] #![forbid(non_ascii_idents)] #![warn( + clippy::absolute_paths, clippy::as_conversions, clippy::as_ptr_cast_mut, clippy::assertions_on_result_states, @@ -56,6 +57,7 @@ clippy::mutex_atomic, clippy::mutex_integer, clippy::needless_collect, + clippy::needless_pass_by_ref_mut, clippy::needless_raw_strings, clippy::nonstandard_macro_braces, clippy::option_if_let_else, @@ -68,6 +70,7 @@ clippy::pub_without_shorthand, clippy::rc_buffer, clippy::rc_mutex, + clippy::readonly_write_lock, clippy::redundant_clone, clippy::redundant_type_annotations, clippy::ref_patterns, @@ -80,6 +83,7 @@ clippy::str_to_string, clippy::string_add, clippy::string_lit_as_bytes, + clippy::string_lit_chars_any, clippy::string_slice, clippy::string_to_string, clippy::suboptimal_flops, @@ -91,7 +95,6 @@ clippy::transmute_undefined_repr, clippy::trivial_regex, clippy::try_err, - clippy::tuple_array_conversions, clippy::undocumented_unsafe_blocks, clippy::unimplemented, clippy::unnecessary_safety_comment, @@ -108,13 +111,11 @@ clippy::verbose_file_reads, clippy::wildcard_enum_match_arm, future_incompatible, - invalid_reference_casting, let_underscore_drop, meta_variable_misuse, missing_copy_implementations, missing_debug_implementations, missing_docs, - noop_method_call, semicolon_in_expressions_from_macros, unreachable_pub, unused_crate_dependencies, @@ -133,12 +134,16 @@ clippy::unwrap_used, unreachable_pub )] +// TODO: Massive false positives on `.await` points. Try remove on next Rust +// version. +#![allow(clippy::multiple_unsafe_ops_per_block)] pub mod api; pub mod callback; pub mod client; pub mod prelude; +use actix_web::rt; use clap::Parser as _; use slog::{o, Drain}; use slog_scope::GlobalLoggerGuard; @@ -185,7 +190,7 @@ pub fn run() { let _log_guard = init_logger(); - actix_web::rt::System::new().block_on(async move { + rt::System::new().block_on(async move { let callback_server = callback::server::run(&opts); api::run(&opts, callback_server).await; }); diff --git a/mock/control-api/src/main.rs b/mock/control-api/src/main.rs index 089dd3164..ff25ce568 100644 --- a/mock/control-api/src/main.rs +++ b/mock/control-api/src/main.rs @@ -8,6 +8,7 @@ )] #![forbid(non_ascii_idents)] #![warn( + clippy::absolute_paths, clippy::as_conversions, clippy::as_ptr_cast_mut, clippy::assertions_on_result_states, @@ -56,6 +57,7 @@ clippy::mutex_atomic, clippy::mutex_integer, clippy::needless_collect, + clippy::needless_pass_by_ref_mut, clippy::needless_raw_strings, clippy::nonstandard_macro_braces, clippy::option_if_let_else, @@ -68,6 +70,7 @@ clippy::pub_without_shorthand, clippy::rc_buffer, clippy::rc_mutex, + clippy::readonly_write_lock, clippy::redundant_clone, clippy::redundant_type_annotations, clippy::ref_patterns, @@ -80,6 +83,7 @@ clippy::str_to_string, clippy::string_add, clippy::string_lit_as_bytes, + clippy::string_lit_chars_any, clippy::string_slice, clippy::string_to_string, clippy::suboptimal_flops, @@ -91,7 +95,6 @@ clippy::transmute_undefined_repr, clippy::trivial_regex, clippy::try_err, - clippy::tuple_array_conversions, clippy::undocumented_unsafe_blocks, clippy::unimplemented, clippy::unnecessary_safety_comment, @@ -108,13 +111,11 @@ clippy::verbose_file_reads, clippy::wildcard_enum_match_arm, future_incompatible, - invalid_reference_casting, let_underscore_drop, meta_variable_misuse, missing_copy_implementations, missing_debug_implementations, missing_docs, - noop_method_call, semicolon_in_expressions_from_macros, unreachable_pub, unused_crate_dependencies, diff --git a/proto/client-api/src/lib.rs b/proto/client-api/src/lib.rs index 0fb319088..a2bf08c65 100644 --- a/proto/client-api/src/lib.rs +++ b/proto/client-api/src/lib.rs @@ -10,6 +10,7 @@ )] #![forbid(non_ascii_idents, unsafe_code)] #![warn( + clippy::absolute_paths, clippy::as_conversions, clippy::as_ptr_cast_mut, clippy::assertions_on_result_states, @@ -58,6 +59,7 @@ clippy::mutex_atomic, clippy::mutex_integer, clippy::needless_collect, + clippy::needless_pass_by_ref_mut, clippy::needless_raw_strings, clippy::nonstandard_macro_braces, clippy::option_if_let_else, @@ -70,6 +72,7 @@ clippy::pub_without_shorthand, clippy::rc_buffer, clippy::rc_mutex, + clippy::readonly_write_lock, clippy::redundant_clone, clippy::redundant_type_annotations, clippy::ref_patterns, @@ -82,6 +85,7 @@ clippy::str_to_string, clippy::string_add, clippy::string_lit_as_bytes, + clippy::string_lit_chars_any, clippy::string_slice, clippy::string_to_string, clippy::suboptimal_flops, @@ -93,7 +97,6 @@ clippy::transmute_undefined_repr, clippy::trivial_regex, clippy::try_err, - clippy::tuple_array_conversions, clippy::undocumented_unsafe_blocks, clippy::unimplemented, clippy::unnecessary_safety_comment, @@ -110,13 +113,11 @@ clippy::verbose_file_reads, clippy::wildcard_enum_match_arm, future_incompatible, - invalid_reference_casting, let_underscore_drop, meta_variable_misuse, missing_copy_implementations, missing_debug_implementations, missing_docs, - noop_method_call, semicolon_in_expressions_from_macros, unreachable_pub, unused_crate_dependencies, @@ -129,6 +130,9 @@ unused_tuple_struct_fields, variant_size_differences )] +// TODO: Massive false positives on `.await` points. Try remove on next Rust +// version. +#![allow(clippy::multiple_unsafe_ops_per_block)] pub mod state; pub mod stats; @@ -684,7 +688,7 @@ pub enum PeerUpdate { /// Representation of [RTCIceCandidateInit][1] object. /// -/// [1]: https://w3.org/TR/webrtc/#dom-rtcicecandidateinit +/// [1]: https://w3.org/TR/webrtc#dom-rtcicecandidateinit #[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] pub struct IceCandidate { /// [`candidate-attribute`][0] of this [`IceCandidate`]. diff --git a/proto/control-api/build.rs b/proto/control-api/build.rs index bcf20466a..e92f28678 100644 --- a/proto/control-api/build.rs +++ b/proto/control-api/build.rs @@ -10,6 +10,7 @@ )] #![forbid(non_ascii_idents, unsafe_code)] #![warn( + clippy::absolute_paths, clippy::as_conversions, clippy::as_ptr_cast_mut, clippy::assertions_on_result_states, @@ -58,6 +59,7 @@ clippy::mutex_atomic, clippy::mutex_integer, clippy::needless_collect, + clippy::needless_pass_by_ref_mut, clippy::needless_raw_strings, clippy::nonstandard_macro_braces, clippy::option_if_let_else, @@ -70,6 +72,7 @@ clippy::pub_without_shorthand, clippy::rc_buffer, clippy::rc_mutex, + clippy::readonly_write_lock, clippy::redundant_clone, clippy::redundant_type_annotations, clippy::ref_patterns, @@ -82,6 +85,7 @@ clippy::str_to_string, clippy::string_add, clippy::string_lit_as_bytes, + clippy::string_lit_chars_any, clippy::string_slice, clippy::string_to_string, clippy::suboptimal_flops, @@ -93,7 +97,6 @@ clippy::transmute_undefined_repr, clippy::trivial_regex, clippy::try_err, - clippy::tuple_array_conversions, clippy::undocumented_unsafe_blocks, clippy::unimplemented, clippy::unnecessary_safety_comment, @@ -110,13 +113,11 @@ clippy::verbose_file_reads, clippy::wildcard_enum_match_arm, future_incompatible, - invalid_reference_casting, let_underscore_drop, meta_variable_misuse, missing_copy_implementations, missing_debug_implementations, missing_docs, - noop_method_call, semicolon_in_expressions_from_macros, unreachable_pub, unused_crate_dependencies, diff --git a/proto/control-api/src/grpc/client.rs b/proto/control-api/src/grpc/client.rs index cb7bf6196..5be247678 100644 --- a/proto/control-api/src/grpc/client.rs +++ b/proto/control-api/src/grpc/client.rs @@ -25,6 +25,7 @@ use crate::{ /// [`Box`]ed [`Error`] with [`Send`] and [`Sync`]. /// /// [`Error`]: std::error::Error +#[allow(clippy::absolute_paths)] type StdError = Box; #[async_trait] @@ -42,7 +43,7 @@ where .map_err(T::Error::from)?; self.on_event(req) .await - .map(|_| tonic::Response::new(callback_proto::Response {})) + .map(|()| tonic::Response::new(callback_proto::Response {})) .map_err(Into::into) } } diff --git a/proto/control-api/src/grpc/mod.rs b/proto/control-api/src/grpc/mod.rs index a8a270e2e..e7f58bb0c 100644 --- a/proto/control-api/src/grpc/mod.rs +++ b/proto/control-api/src/grpc/mod.rs @@ -94,7 +94,7 @@ impl CallbackUrl { #[must_use] pub fn to_http(&self) -> Url { let mut url = self.0.clone(); - url.set_scheme("http").unwrap_or_else(|_| unreachable!()); + url.set_scheme("http").unwrap_or_else(|()| unreachable!()); url } } diff --git a/proto/control-api/src/grpc/server.rs b/proto/control-api/src/grpc/server.rs index 2646d3878..20112dc7e 100644 --- a/proto/control-api/src/grpc/server.rs +++ b/proto/control-api/src/grpc/server.rs @@ -24,6 +24,7 @@ use crate::{ /// [`Box`]ed [`Error`] with [`Send`] and [`Sync`]. /// /// [`Error`]: std::error::Error +#[allow(clippy::absolute_paths)] type StdError = Box; #[async_trait] @@ -75,7 +76,7 @@ where }; Ok(tonic::Response::new(match result { - Ok(_) => control_proto::Response { error: None }, + Ok(()) => control_proto::Response { error: None }, Err(e) => control_proto::Response { error: Some(e.into()), }, diff --git a/proto/control-api/src/lib.rs b/proto/control-api/src/lib.rs index 84e4e4dba..5526155a6 100644 --- a/proto/control-api/src/lib.rs +++ b/proto/control-api/src/lib.rs @@ -9,6 +9,7 @@ )] #![forbid(non_ascii_idents, unsafe_code)] #![warn( + clippy::absolute_paths, clippy::as_conversions, clippy::as_ptr_cast_mut, clippy::assertions_on_result_states, @@ -57,6 +58,7 @@ clippy::mutex_atomic, clippy::mutex_integer, clippy::needless_collect, + clippy::needless_pass_by_ref_mut, clippy::needless_raw_strings, clippy::nonstandard_macro_braces, clippy::option_if_let_else, @@ -69,6 +71,7 @@ clippy::pub_without_shorthand, clippy::rc_buffer, clippy::rc_mutex, + clippy::readonly_write_lock, clippy::redundant_clone, clippy::redundant_type_annotations, clippy::ref_patterns, @@ -81,6 +84,7 @@ clippy::str_to_string, clippy::string_add, clippy::string_lit_as_bytes, + clippy::string_lit_chars_any, clippy::string_slice, clippy::string_to_string, clippy::suboptimal_flops, @@ -92,7 +96,6 @@ clippy::transmute_undefined_repr, clippy::trivial_regex, clippy::try_err, - clippy::tuple_array_conversions, clippy::undocumented_unsafe_blocks, clippy::unimplemented, clippy::unnecessary_safety_comment, @@ -109,13 +112,11 @@ clippy::verbose_file_reads, clippy::wildcard_enum_match_arm, future_incompatible, - invalid_reference_casting, let_underscore_drop, meta_variable_misuse, missing_copy_implementations, missing_debug_implementations, missing_docs, - noop_method_call, semicolon_in_expressions_from_macros, unreachable_pub, unused_crate_dependencies, @@ -132,6 +133,9 @@ #![allow(clippy::same_name_method)] // TODO: Remove on next `derive_more` major version. #![allow(clippy::uninlined_format_args, clippy::use_debug)] +// TODO: Massive false positives on `.await` points. Try remove on next Rust +// version. +#![allow(clippy::multiple_unsafe_ops_per_block)] pub mod callback; pub mod control; diff --git a/src/api/dart/mod.rs b/src/api/dart/mod.rs index f60a215cf..10d3d7840 100644 --- a/src/api/dart/mod.rs +++ b/src/api/dart/mod.rs @@ -16,6 +16,7 @@ pub mod api; pub mod utils; #[allow( + clippy::absolute_paths, clippy::as_conversions, clippy::default_trait_access, clippy::let_underscore_untyped, @@ -160,7 +161,7 @@ impl Drop for DartValue { } impl From<()> for DartValue { - fn from(_: ()) -> Self { + fn from((): ()) -> Self { Self::None } } diff --git a/src/lib.rs b/src/lib.rs index 6ed833bfc..f07f5ab27 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -8,6 +8,7 @@ )] #![forbid(non_ascii_idents)] #![warn( + clippy::absolute_paths, clippy::as_conversions, clippy::as_ptr_cast_mut, clippy::assertions_on_result_states, @@ -56,6 +57,7 @@ clippy::mutex_atomic, clippy::mutex_integer, clippy::needless_collect, + clippy::needless_pass_by_ref_mut, clippy::needless_raw_strings, clippy::nonstandard_macro_braces, clippy::option_if_let_else, @@ -68,6 +70,7 @@ clippy::pub_without_shorthand, clippy::rc_buffer, clippy::rc_mutex, + clippy::readonly_write_lock, clippy::redundant_clone, clippy::redundant_type_annotations, clippy::ref_patterns, @@ -80,6 +83,7 @@ clippy::str_to_string, clippy::string_add, clippy::string_lit_as_bytes, + clippy::string_lit_chars_any, clippy::string_slice, clippy::string_to_string, clippy::suboptimal_flops, @@ -91,7 +95,6 @@ clippy::transmute_undefined_repr, clippy::trivial_regex, clippy::try_err, - clippy::tuple_array_conversions, clippy::undocumented_unsafe_blocks, clippy::unimplemented, clippy::unnecessary_safety_comment, @@ -108,13 +111,11 @@ clippy::verbose_file_reads, clippy::wildcard_enum_match_arm, future_incompatible, - invalid_reference_casting, let_underscore_drop, meta_variable_misuse, missing_copy_implementations, missing_debug_implementations, missing_docs, - noop_method_call, semicolon_in_expressions_from_macros, unreachable_pub, unused_crate_dependencies, @@ -137,6 +138,9 @@ )] // TODO: Remove on next `derive_more` major version. #![allow(clippy::uninlined_format_args, clippy::use_debug)] +// TODO: Massive false positives on `.await` points. Try remove on next Rust +// version. +#![allow(clippy::multiple_unsafe_ops_per_block)] #[macro_use] pub mod utils; diff --git a/src/peer/component/mod.rs b/src/peer/component/mod.rs index 7c4cb21fd..4097c20df 100644 --- a/src/peer/component/mod.rs +++ b/src/peer/component/mod.rs @@ -5,6 +5,8 @@ mod local_sdp; mod tracks_repository; mod watchers; +#[cfg(feature = "mockable")] +use std::future::Future; use std::{cell::Cell, collections::HashSet, rc::Rc}; use futures::{future::LocalBoxFuture, StreamExt as _, TryFutureExt as _}; @@ -569,11 +571,10 @@ impl State { self.negotiation_role.get() } - /// Returns [`Future`] resolving once local SDP approve is needed. - pub fn when_local_sdp_approve_needed( - &self, - ) -> impl std::future::Future { + /// Returns a [`Future`] resolving once local SDP approve is needed. + pub fn when_local_sdp_approve_needed(&self) -> impl Future { use futures::FutureExt as _; + self.negotiation_state .when_eq(NegotiationState::WaitLocalSdpApprove) .map(drop) diff --git a/src/peer/component/watchers.rs b/src/peer/component/watchers.rs index 427774f86..a42a4500e 100644 --- a/src/peer/component/watchers.rs +++ b/src/peer/component/watchers.rs @@ -341,7 +341,7 @@ impl Component { /// [`Stable`]: NegotiationState::Stable /// [`WaitRemoteSdp`]: NegotiationState::WaitRemoteSdp #[watch(self.local_sdp.on_approve().skip(1))] - fn local_sdp_approved(_: &PeerConnection, state: &State, _: ()) { + fn local_sdp_approved(_: &PeerConnection, state: &State, (): ()) { if let Some(negotiation_role) = state.negotiation_role.get() { match negotiation_role { NegotiationRole::Offerer => { diff --git a/src/peer/media/mod.rs b/src/peer/media/mod.rs index 13fe5d849..27342409d 100644 --- a/src/peer/media/mod.rs +++ b/src/peer/media/mod.rs @@ -695,16 +695,19 @@ impl MediaConnections { /// [`LocalStreamUpdateCriteria`]. pub async fn drop_send_tracks(&self, kinds: LocalStreamUpdateCriteria) { let remove_tracks_fut = future::join_all( - self.0.borrow().senders.values().filter_map(|s| { - kinds.has(s.state().kind(), s.state().source_kind()).then( - || { - let sender = s.obj(); - async move { - sender.remove_track().await; - } - }, - ) - }), + self.0 + .borrow() + .senders + .values() + .filter(|&s| { + kinds.has(s.state().kind(), s.state().source_kind()) + }) + .map(|s| { + let sender = s.obj(); + async move { + sender.remove_track().await; + } + }), ); drop(remove_tracks_fut.await); } @@ -816,7 +819,7 @@ impl MediaConnections { &self, id: TrackId, media_type: MediaType, - media_direction: medea_client_api_proto::MediaDirection, + media_direction: proto::MediaDirection, muted: bool, mid: Option, receivers: Vec, @@ -850,7 +853,7 @@ impl MediaConnections { &self, id: TrackId, media_type: MediaType, - media_direction: medea_client_api_proto::MediaDirection, + media_direction: proto::MediaDirection, muted: bool, mid: Option, sender: MemberId, @@ -891,15 +894,14 @@ impl MediaConnections { recv_constraints: &RecvConstraints, connection_mode: ConnectionMode, ) -> Result<(), Traced> { - use medea_client_api_proto::Direction; for track in tracks { match track.direction { - Direction::Send { mid, receivers } => { + proto::Direction::Send { mid, receivers } => { let component = self .create_sender( track.id, track.media_type, - medea_client_api_proto::MediaDirection::SendRecv, + proto::MediaDirection::SendRecv, send_constraints.muted(track.media_type), mid, receivers, @@ -911,12 +913,12 @@ impl MediaConnections { self.0.borrow_mut().senders.insert(track.id, component), ); } - Direction::Recv { mid, sender } => { + proto::Direction::Recv { mid, sender } => { let component = self .create_receiver( track.id, track.media_type, - medea_client_api_proto::MediaDirection::SendRecv, + proto::MediaDirection::SendRecv, false, mid, sender, diff --git a/src/peer/media/receiver/component.rs b/src/peer/media/receiver/component.rs index e497784da..a5fb54c7b 100644 --- a/src/peer/media/receiver/component.rs +++ b/src/peer/media/receiver/component.rs @@ -1,6 +1,6 @@ //! [`Component`] for `MediaTrack` with a `Recv` direction. -use std::rc::Rc; +use std::{iter, rc::Rc}; use futures::StreamExt as _; use medea_client_api_proto as proto; @@ -159,7 +159,7 @@ impl Updatable for State { /// [`Future`]: std::future::Future fn when_stabilized(&self) -> AllProcessed<'static> { let controller = Rc::clone(&self.enabled_individual); - when_all_processed(std::iter::once( + when_all_processed(iter::once( Processed::new(Box::new(move || { let controller = Rc::clone(&controller); Box::pin(async move { @@ -481,9 +481,9 @@ impl TransceiverSide for State { #[cfg(feature = "mockable")] #[allow(clippy::multiple_inherent_impl)] impl State { - /// Stabilizes [`MediaExchangeState`] of this [`State`]. + /// Stabilizes the [`MediaExchangeState`] of this [`State`]. pub fn stabilize(&self) { - if let crate::peer::MediaExchangeState::Transition(transition) = + if let MediaExchangeState::Transition(transition) = self.enabled_individual.state() { self.enabled_individual.update(transition.intended()); diff --git a/src/peer/media/receiver/mod.rs b/src/peer/media/receiver/mod.rs index 14adaaf31..6815ff2be 100644 --- a/src/peer/media/receiver/mod.rs +++ b/src/peer/media/receiver/mod.rs @@ -188,7 +188,7 @@ impl Receiver { /// Returns [`mid`] of this [`Receiver`]. /// - /// [`mid`]: https://w3.org/TR/webrtc/#dom-rtptransceiver-mid + /// [`mid`]: https://w3.org/TR/webrtc#dom-rtptransceiver-mid #[must_use] pub fn mid(&self) -> Option { if self.mid.borrow().is_none() && self.transceiver.borrow().is_some() { diff --git a/src/peer/media/sender/mod.rs b/src/peer/media/sender/mod.rs index 4b2410542..bb8f308a6 100644 --- a/src/peer/media/sender/mod.rs +++ b/src/peer/media/sender/mod.rs @@ -99,7 +99,7 @@ impl Sender { /// [`LocalTracksConstraints`] are configured to disable this [`Sender`], /// but it cannot be disabled according to the provide [`State`]. /// - /// [`mid`]: https://w3.org/TR/webrtc/#dom-rtptransceiver-mid + /// [`mid`]: https://w3.org/TR/webrtc#dom-rtptransceiver-mid pub async fn new( state: &State, media_connections: &MediaConnections, @@ -205,7 +205,7 @@ impl Sender { /// should never fail for any other reason. /// /// [1]: https://w3c.github.io/webrtc-pc/#dom-rtcrtpsender - /// [2]: https://w3.org/TR/webrtc/#dom-rtcrtpsender-replacetrack + /// [2]: https://w3.org/TR/webrtc#dom-rtcrtpsender-replacetrack pub async fn remove_track(&self) { drop(self.track.take()); drop(self.transceiver.set_send_track(None).await); @@ -260,7 +260,7 @@ impl Sender { /// Returns [`mid`] of this [`Sender`]. /// - /// [`mid`]: https://w3.org/TR/webrtc/#dom-rtptransceiver-mid + /// [`mid`]: https://w3.org/TR/webrtc#dom-rtptransceiver-mid #[must_use] pub fn mid(&self) -> Option { self.transceiver.mid() diff --git a/src/peer/mod.rs b/src/peer/mod.rs index af0e648ba..282ddf6b0 100644 --- a/src/peer/mod.rs +++ b/src/peer/mod.rs @@ -835,7 +835,7 @@ impl PeerConnection { /// [RTCPeerConnection.setRemoteDescription()][2] fails. /// /// [1]: https://w3.org/TR/webrtc/#rtcpeerconnection-interface - /// [2]: https://w3.org/TR/webrtc/#dom-peerconnection-setremotedescription + /// [2]: https://w3.org/TR/webrtc#dom-peerconnection-setremotedescription /// [3]: platform::RtcPeerConnectionError::SetRemoteDescriptionFailed async fn set_remote_answer( &self, @@ -854,7 +854,7 @@ impl PeerConnection { /// [RTCPeerConnection.setRemoteDescription()][2] fails. /// /// [1]: https://w3.org/TR/webrtc/#rtcpeerconnection-interface - /// [2]: https://w3.org/TR/webrtc/#dom-peerconnection-setremotedescription + /// [2]: https://w3.org/TR/webrtc#dom-peerconnection-setremotedescription async fn set_remote_offer( &self, offer: String, @@ -877,8 +877,8 @@ impl PeerConnection { /// candidates. /// /// [1]: https://w3.org/TR/webrtc/#rtcpeerconnection-interface - /// [2]: https://w3.org/TR/webrtc/#dom-peerconnection-setremotedescription - /// [3]: https://w3.org/TR/webrtc/#dom-peerconnection-addicecandidate + /// [2]: https://w3.org/TR/webrtc#dom-peerconnection-setremotedescription + /// [3]: https://w3.org/TR/webrtc#dom-peerconnection-addicecandidate async fn set_remote_description( &self, desc: platform::SdpType, @@ -923,7 +923,7 @@ impl PeerConnection { /// /// [1]: https://tools.ietf.org/html/rfc5245#section-2 /// [2]: platform::RtcPeerConnectionError::AddIceCandidateFailed - /// [3]: https://w3.org/TR/webrtc/#dom-peerconnection-addicecandidate + /// [3]: https://w3.org/TR/webrtc#dom-peerconnection-addicecandidate pub async fn add_ice_candidate( &self, candidate: String, diff --git a/src/platform/dart/ice_candidate.rs b/src/platform/dart/ice_candidate.rs index 35b41529c..013d5c646 100644 --- a/src/platform/dart/ice_candidate.rs +++ b/src/platform/dart/ice_candidate.rs @@ -1,6 +1,6 @@ //! ICE candidate of a [RTCPeerConnection][1]. //! -//! [1]: https://w3.org/TR/webrtc/#dom-rtcpeerconnection +//! [1]: https://w3.org/TR/webrtc#dom-rtcpeerconnection use dart_sys::Dart_Handle; use derive_more::From; @@ -38,7 +38,7 @@ mod ice_candidate { /// Wrapper around a [`DartHandle`] representing an ICE candidate of a /// [RTCPeerConnection][1]. /// -/// [1]: https://w3.org/TR/webrtc/#dom-rtcpeerconnection +/// [1]: https://w3.org/TR/webrtc#dom-rtcpeerconnection #[derive(Debug, From)] pub struct IceCandidate(DartHandle); diff --git a/src/platform/dart/media_devices.rs b/src/platform/dart/media_devices.rs index 7a78cf654..f2f8ef915 100644 --- a/src/platform/dart/media_devices.rs +++ b/src/platform/dart/media_devices.rs @@ -278,7 +278,7 @@ impl MediaDevices { if let Some(mut h) = handler { unsafe { media_devices::on_device_change( - Callback::from_fn_mut(move |_: ()| { + Callback::from_fn_mut(move |(): ()| { h(); }) .into_dart(), diff --git a/src/platform/dart/media_track.rs b/src/platform/dart/media_track.rs index ccac00614..13c9e051e 100644 --- a/src/platform/dart/media_track.rs +++ b/src/platform/dart/media_track.rs @@ -304,7 +304,7 @@ impl MediaStreamTrack { F: 'static + FnOnce(), { if let Some(cb) = f { - let cb = Callback::from_once(|_: ()| cb()); + let cb = Callback::from_once(|(): ()| cb()); unsafe { media_stream_track::on_ended(self.inner.get(), cb.into_dart()); }; diff --git a/src/platform/dart/peer_connection.rs b/src/platform/dart/peer_connection.rs index cda8bb840..f9f070eaf 100644 --- a/src/platform/dart/peer_connection.rs +++ b/src/platform/dart/peer_connection.rs @@ -1,6 +1,6 @@ //! Wrapper around [RTCPeerConnection][1]. //! -//! [1]: https://w3.org/TR/webrtc/#dom-rtcpeerconnection +//! [1]: https://w3.org/TR/webrtc#dom-rtcpeerconnection use std::future::Future; @@ -33,7 +33,7 @@ use super::{ media_track::MediaStreamTrack, utils::string_into_c_str, }; -type Result = std::result::Result>; +type RtcPeerConnectionResult = Result>; #[dart_bridge("flutter/lib/src/native/platform/peer_connection.g.dart")] mod peer_connection { @@ -135,7 +135,7 @@ mod peer_connection { /// Representation of [RTCPeerConnection][1]. /// -/// [1]: https://w3.org/TR/webrtc/#dom-rtcpeerconnection +/// [1]: https://w3.org/TR/webrtc#dom-rtcpeerconnection #[derive(Clone, Debug)] pub struct RtcPeerConnection { handle: DartHandle, @@ -148,7 +148,10 @@ impl RtcPeerConnection { /// /// Errors with [`RtcPeerConnectionError::PeerCreationError`] if /// [`RtcPeerConnection`] creation fails. - pub async fn new(ice_servers: I, is_force_relayed: bool) -> Result + pub async fn new( + ice_servers: I, + is_force_relayed: bool, + ) -> RtcPeerConnectionResult where I: IntoIterator, { @@ -169,7 +172,7 @@ impl RtcPeerConnection { /// Returns [`RtcStats`] of this [`RtcPeerConnection`]. #[allow(clippy::missing_errors_doc, clippy::unused_async)] - pub async fn get_stats(&self) -> Result { + pub async fn get_stats(&self) -> RtcPeerConnectionResult { // TODO: Correct implementation requires `flutter_webrtc`-side rework. Ok(RtcStats(Vec::new())) } @@ -177,7 +180,7 @@ impl RtcPeerConnection { /// Sets `handler` for a [RTCTrackEvent][1] (see [`ontrack` callback][2]). /// /// [1]: https://w3.org/TR/webrtc/#rtctrackevent - /// [2]: https://w3.org/TR/webrtc/#dom-rtcpeerconnection-ontrack + /// [2]: https://w3.org/TR/webrtc#dom-rtcpeerconnection-ontrack pub fn on_track(&self, handler: Option) where F: 'static + FnMut(MediaStreamTrack, Transceiver), @@ -203,8 +206,8 @@ impl RtcPeerConnection { /// Sets `handler` for a [RTCPeerConnectionIceEvent][1] (see /// [`onicecandidate` callback][2]). /// - /// [1]: https://w3.org/TR/webrtc/#dom-rtcpeerconnectioniceevent - /// [2]: https://w3.org/TR/webrtc/#dom-rtcpeerconnection-onicecandidate + /// [1]: https://w3.org/TR/webrtc#dom-rtcpeerconnectioniceevent + /// [2]: https://w3.org/TR/webrtc#dom-rtcpeerconnection-onicecandidate pub fn on_ice_candidate(&self, handler: Option) where F: 'static + FnMut(IceCandidate), @@ -299,13 +302,13 @@ impl RtcPeerConnection { /// /// [1]: https://w3.org/TR/webrtc/#rtcpeerconnection-interface /// [2]: https://tools.ietf.org/html/rfc5245#section-2 - /// [3]: https://w3.org/TR/webrtc/#dom-peerconnection-addicecandidate + /// [3]: https://w3.org/TR/webrtc#dom-peerconnection-addicecandidate pub async fn add_ice_candidate( &self, candidate: &str, sdp_m_line_index: Option, sdp_mid: &Option, - ) -> Result<()> { + ) -> RtcPeerConnectionResult<()> { let fut = unsafe { peer_connection::add_ice_candidate( self.handle.get(), @@ -339,8 +342,8 @@ impl RtcPeerConnection { /// With [`RtcPeerConnectionError::SetLocalDescriptionFailed`] if /// [RtcPeerConnection.setLocalDescription()][1] fails. /// - /// [1]: https://w3.org/TR/webrtc/#dom-peerconnection-setlocaldescription - pub async fn set_offer(&self, offer: &str) -> Result<()> { + /// [1]: https://w3.org/TR/webrtc#dom-peerconnection-setlocaldescription + pub async fn set_offer(&self, offer: &str) -> RtcPeerConnectionResult<()> { self.set_local_description(RtcSdpType::Offer, offer.into()) .await .map_err(tracerr::map_from_and_wrap!()) @@ -353,8 +356,11 @@ impl RtcPeerConnection { /// With [`RtcPeerConnectionError::SetLocalDescriptionFailed`] if /// [RtcPeerConnection.setLocalDescription()][1] fails. /// - /// [1]: https://w3.org/TR/webrtc/#dom-peerconnection-setlocaldescription - pub async fn set_answer(&self, answer: &str) -> Result<()> { + /// [1]: https://w3.org/TR/webrtc#dom-peerconnection-setlocaldescription + pub async fn set_answer( + &self, + answer: &str, + ) -> RtcPeerConnectionResult<()> { self.set_local_description(RtcSdpType::Answer, answer.into()) .await .map_err(tracerr::map_from_and_wrap!()) @@ -369,8 +375,8 @@ impl RtcPeerConnection { /// With [`RtcPeerConnectionError::CreateAnswerFailed`] if /// [RtcPeerConnection.createAnswer()][1] fails. /// - /// [1]: https://w3.org/TR/webrtc/#dom-rtcpeerconnection-createanswer - pub async fn create_answer(&self) -> Result { + /// [1]: https://w3.org/TR/webrtc#dom-rtcpeerconnection-createanswer + pub async fn create_answer(&self) -> RtcPeerConnectionResult { let fut = unsafe { peer_connection::create_answer(self.handle.get()) }; unsafe { FutureFromDart::execute(fut) } .await @@ -385,8 +391,8 @@ impl RtcPeerConnection { /// With [`RtcPeerConnectionError::SetLocalDescriptionFailed`] if /// [RtcPeerConnection.setLocalDescription()][1] fails. /// - /// [1]: https://w3.org/TR/webrtc/#dom-peerconnection-setlocaldescription - pub async fn rollback(&self) -> Result<()> { + /// [1]: https://w3.org/TR/webrtc#dom-peerconnection-setlocaldescription + pub async fn rollback(&self) -> RtcPeerConnectionResult<()> { let fut = unsafe { peer_connection::rollback(self.handle.get()) }; unsafe { FutureFromDart::execute(fut) } .await @@ -404,8 +410,8 @@ impl RtcPeerConnection { /// With [`RtcPeerConnectionError::CreateOfferFailed`] if /// [RtcPeerConnection.createOffer()][1] fails. /// - /// [1]: https://w3.org/TR/webrtc/#dom-rtcpeerconnection-createoffer - pub async fn create_offer(&self) -> Result { + /// [1]: https://w3.org/TR/webrtc#dom-rtcpeerconnection-createoffer + pub async fn create_offer(&self) -> RtcPeerConnectionResult { let fut = unsafe { peer_connection::create_offer(self.handle.get()) }; unsafe { FutureFromDart::execute(fut) } .await @@ -424,8 +430,11 @@ impl RtcPeerConnection { /// With [`RtcPeerConnectionError::SetRemoteDescriptionFailed`] if /// [RTCPeerConnection.setRemoteDescription()][1] fails. /// - /// [1]: https://w3.org/TR/webrtc/#dom-peerconnection-setremotedescription - pub async fn set_remote_description(&self, sdp: SdpType) -> Result<()> { + /// [1]: https://w3.org/TR/webrtc#dom-peerconnection-setremotedescription + pub async fn set_remote_description( + &self, + sdp: SdpType, + ) -> RtcPeerConnectionResult<()> { let fut = match sdp { SdpType::Offer(sdp) => unsafe { peer_connection::set_remote_description( @@ -451,7 +460,7 @@ impl RtcPeerConnection { /// Creates a new [`Transceiver`] (see [RTCRtpTransceiver][1]) and adds it /// to the [set of this RTCPeerConnection's transceivers][2]. /// - /// [1]: https://w3.org/TR/webrtc/#dom-rtcrtptransceiver + /// [1]: https://w3.org/TR/webrtc#dom-rtcrtptransceiver /// [2]: https://w3.org/TR/webrtc/#transceivers-set pub fn add_transceiver( &self, @@ -476,7 +485,7 @@ impl RtcPeerConnection { /// Returns [`Transceiver`] (see [RTCRtpTransceiver][1]) from a /// [set of this RTCPeerConnection's transceivers][2] by provided `mid`. /// - /// [1]: https://w3.org/TR/webrtc/#dom-rtcrtptransceiver + /// [1]: https://w3.org/TR/webrtc#dom-rtcrtptransceiver /// [2]: https://w3.org/TR/webrtc/#transceivers-set pub fn get_transceiver_by_mid( &self, @@ -501,7 +510,7 @@ impl RtcPeerConnection { &self, sdp_type: RtcSdpType, sdp: String, - ) -> Result<()> { + ) -> RtcPeerConnectionResult<()> { let fut = unsafe { peer_connection::set_local_description( self.handle.get(), diff --git a/src/platform/dart/transport.rs b/src/platform/dart/transport.rs index 605fa4fe6..85c3ea3f1 100644 --- a/src/platform/dart/transport.rs +++ b/src/platform/dart/transport.rs @@ -21,7 +21,7 @@ use crate::{ rpc::{ApiUrl, ClientDisconnect, CloseMsg}, }; -type Result> = std::result::Result; +type TransportResult = Result>; #[dart_bridge("flutter/lib/src/native/platform/transport.g.dart")] mod transport { @@ -128,7 +128,7 @@ impl Default for WebSocketRpcTransport { #[async_trait(?Send)] impl RpcTransport for WebSocketRpcTransport { - async fn connect(&self, url: ApiUrl) -> Result<()> { + async fn connect(&self, url: ApiUrl) -> TransportResult<()> { // TODO: Propagate execution error. #[allow(clippy::map_err_ignore)] let handle = { @@ -203,7 +203,7 @@ impl RpcTransport for WebSocketRpcTransport { } #[allow(clippy::unwrap_in_result)] - fn send(&self, msg: &ClientMsg) -> Result<(), Traced> { + fn send(&self, msg: &ClientMsg) -> TransportResult<()> { let state = self.socket_state.get(); let handle = self .handle diff --git a/src/platform/dart/utils/dart_api.rs b/src/platform/dart/utils/dart_api.rs index 5e2646f28..7a651d69c 100644 --- a/src/platform/dart/utils/dart_api.rs +++ b/src/platform/dart/utils/dart_api.rs @@ -2,6 +2,8 @@ //! //! [`Dart DL API`]: https://tinyurl.com/32e7fudh +use core::ffi; + use dart_sys::{ Dart_CObject, Dart_DeletePersistentHandle_DL, Dart_FinalizableHandle, Dart_GetError_DL, Dart_Handle, Dart_HandleFinalizer, @@ -19,7 +21,7 @@ use dart_sys::{ /// Dart. /// /// [1]: https://api.dart.dev/dart-ffi/NativeApi/initializeApiDLData.html -pub unsafe fn initialize_api(data: *mut core::ffi::c_void) -> isize { +pub unsafe fn initialize_api(data: *mut ffi::c_void) -> isize { Dart_InitializeApiDL(data) } @@ -118,7 +120,7 @@ pub unsafe fn post_c_object( /// [`mem::size_of()`]: std::mem::size_of pub unsafe fn new_finalizable_handle( object: Dart_Handle, - peer: *mut ::core::ffi::c_void, + peer: *mut ffi::c_void, external_allocation_size: isize, callback: Dart_HandleFinalizer, ) -> Dart_FinalizableHandle { @@ -153,7 +155,7 @@ pub unsafe fn is_error(handle: Dart_Handle) -> bool { /// # Safety /// /// [`initialize_api`] must be called before this function. -pub unsafe fn get_error(handle: Dart_Handle) -> *const core::ffi::c_char { +pub unsafe fn get_error(handle: Dart_Handle) -> *const ffi::c_char { #[allow(clippy::expect_used)] Dart_GetError_DL.expect("dart_api_dl has not been initialized")(handle) } diff --git a/src/platform/peer_connection.rs b/src/platform/peer_connection.rs index c77ac9de3..a8a5f95e9 100644 --- a/src/platform/peer_connection.rs +++ b/src/platform/peer_connection.rs @@ -9,17 +9,17 @@ use crate::{ /// Representation of [RTCSdpType]. /// -/// [RTCSdpType]: https://w3.org/TR/webrtc/#dom-rtcsdptype +/// [RTCSdpType]: https://w3.org/TR/webrtc#dom-rtcsdptype #[derive(Debug)] pub enum SdpType { /// [`offer` type][1] of SDP. /// - /// [1]: https://w3.org/TR/webrtc/#dom-rtcsdptype-offer + /// [1]: https://w3.org/TR/webrtc#dom-rtcsdptype-offer Offer(String), /// [`answer` type][1] of SDP. /// - /// [1]: https://w3.org/TR/webrtc/#dom-rtcsdptype-answer + /// [1]: https://w3.org/TR/webrtc#dom-rtcsdptype-answer Answer(String), } @@ -30,34 +30,34 @@ pub enum SdpType { pub struct IceCandidate { /// [`candidate` field][2] of the discovered [RTCIceCandidate][1]. /// - /// [1]: https://w3.org/TR/webrtc/#dom-rtcicecandidate - /// [2]: https://w3.org/TR/webrtc/#dom-rtcicecandidate-candidate + /// [1]: https://w3.org/TR/webrtc#dom-rtcicecandidate + /// [2]: https://w3.org/TR/webrtc#dom-rtcicecandidate-candidate pub candidate: String, /// [`sdpMLineIndex` field][2] of the discovered [RTCIceCandidate][1]. /// - /// [1]: https://w3.org/TR/webrtc/#dom-rtcicecandidate - /// [2]: https://w3.org/TR/webrtc/#dom-rtcicecandidate-sdpmlineindex + /// [1]: https://w3.org/TR/webrtc#dom-rtcicecandidate + /// [2]: https://w3.org/TR/webrtc#dom-rtcicecandidate-sdpmlineindex pub sdp_m_line_index: Option, /// [`sdpMid` field][2] of the discovered [RTCIceCandidate][1]. /// - /// [1]: https://w3.org/TR/webrtc/#dom-rtcicecandidate - /// [2]: https://w3.org/TR/webrtc/#dom-rtcicecandidate-sdpmid + /// [1]: https://w3.org/TR/webrtc#dom-rtcicecandidate + /// [2]: https://w3.org/TR/webrtc#dom-rtcicecandidate-sdpmid pub sdp_mid: Option, } /// Errors that may occur during signaling between this and remote /// [RTCPeerConnection][1] and event handlers setting errors. /// -/// [1]: https://w3.org/TR/webrtc/#dom-rtcpeerconnection +/// [1]: https://w3.org/TR/webrtc#dom-rtcpeerconnection #[derive(Caused, Clone, Debug, Display, From)] #[cause(error = platform::Error)] pub enum RtcPeerConnectionError { /// Occurs when cannot adds new remote candidate to the /// [RTCPeerConnection][1]'s remote description. /// - /// [1]: https://w3.org/TR/webrtc/#dom-rtcpeerconnection + /// [1]: https://w3.org/TR/webrtc#dom-rtcpeerconnection #[display(fmt = "Failed to add ICE candidate: {}", _0)] #[from(ignore)] AddIceCandidateFailed(platform::Error), diff --git a/src/platform/rtc_stats.rs b/src/platform/rtc_stats.rs index bef5d7618..16152619f 100644 --- a/src/platform/rtc_stats.rs +++ b/src/platform/rtc_stats.rs @@ -14,7 +14,7 @@ use crate::{platform, utils::Caused}; pub enum RtcStatsError { /// [RTCStats.id][1] is undefined. /// - /// [1]: https://w3.org/TR/webrtc/#dom-rtcstats-id + /// [1]: https://w3.org/TR/webrtc#dom-rtcstats-id #[display(fmt = "RTCStats.id is undefined")] UndefinedId, diff --git a/src/platform/transceiver.rs b/src/platform/transceiver.rs index f36a2c719..5b1c8de67 100644 --- a/src/platform/transceiver.rs +++ b/src/platform/transceiver.rs @@ -1,6 +1,6 @@ //! Definition and implementation of [RTCRtpTransceiverDirection][1]. //! -//! [1]: https://w3.org/TR/webrtc/#dom-rtcrtptransceiverdirection +//! [1]: https://w3.org/TR/webrtc#dom-rtcrtptransceiverdirection // Because of uncontrolled names in the generated code. #![allow(clippy::same_name_method)] diff --git a/src/platform/wasm/media_device_info.rs b/src/platform/wasm/media_device_info.rs index dd360a01e..98e07d029 100644 --- a/src/platform/wasm/media_device_info.rs +++ b/src/platform/wasm/media_device_info.rs @@ -3,7 +3,6 @@ //! [1]: https://w3.org/TR/mediacapture-streams#device-info use derive_more::From; -use web_sys as sys; use crate::media::MediaDeviceKind; @@ -11,15 +10,15 @@ use crate::media::MediaDeviceKind; /// /// [1]: https://w3.org/TR/mediacapture-streams#device-info #[derive(Debug, From)] -pub struct MediaDeviceInfo(sys::MediaDeviceInfo); +pub struct MediaDeviceInfo(web_sys::MediaDeviceInfo); -impl From for MediaDeviceKind { - fn from(value: sys::MediaDeviceKind) -> Self { +impl From for MediaDeviceKind { + fn from(value: web_sys::MediaDeviceKind) -> Self { match value { - sys::MediaDeviceKind::Audioinput => Self::AudioInput, - sys::MediaDeviceKind::Videoinput => Self::VideoInput, - sys::MediaDeviceKind::Audiooutput => Self::AudioOutput, - sys::MediaDeviceKind::__Nonexhaustive => { + web_sys::MediaDeviceKind::Audioinput => Self::AudioInput, + web_sys::MediaDeviceKind::Videoinput => Self::VideoInput, + web_sys::MediaDeviceKind::Audiooutput => Self::AudioOutput, + web_sys::MediaDeviceKind::__Nonexhaustive => { unreachable!("Unknown MediaDeviceKind::{value:?}") } } diff --git a/src/platform/wasm/media_devices.rs b/src/platform/wasm/media_devices.rs index a0c0eb08f..6a5c5760f 100644 --- a/src/platform/wasm/media_devices.rs +++ b/src/platform/wasm/media_devices.rs @@ -3,6 +3,8 @@ //! [1]: https://w3.org/TR/mediacapture-streams#mediadevices #![allow(clippy::unwrap_used)] +// TODO: False positive in function signatures, try remove on 1.74 Rust upgrade. +#![allow(clippy::let_underscore_untyped, let_underscore_drop)] use std::{cell::RefCell, rc::Rc}; use wasm_bindgen_futures::JsFuture; diff --git a/src/platform/wasm/peer_connection.rs b/src/platform/wasm/peer_connection.rs index abdeb0ad5..f4f14da78 100644 --- a/src/platform/wasm/peer_connection.rs +++ b/src/platform/wasm/peer_connection.rs @@ -1,6 +1,6 @@ //! Wrapper around [RTCPeerConnection][1]. //! -//! [1]: https://w3.org/TR/webrtc/#dom-rtcpeerconnection +//! [1]: https://w3.org/TR/webrtc#dom-rtcpeerconnection #![allow(clippy::unwrap_used)] @@ -36,13 +36,11 @@ use crate::{ use super::ice_server::RtcIceServers; /// Shortcut for a [`Result`] holding a [`Traced`] [`RtcPeerConnectionError`]. -/// -/// [`Result`]: std::result::Result -type Result = std::result::Result>; +type RtcPeerConnectionResult = Result>; /// Representation of [RTCPeerConnection][1]. /// -/// [1]: https://w3.org/TR/webrtc/#dom-rtcpeerconnection +/// [1]: https://w3.org/TR/webrtc#dom-rtcpeerconnection #[derive(Debug)] pub struct RtcPeerConnection { /// Underlying [RTCPeerConnection][1]. @@ -59,9 +57,9 @@ pub struct RtcPeerConnection { /// discovers a new [RTCIceCandidate][4]. /// /// [1]: https://w3.org/TR/webrtc/#rtcpeerconnection-interface - /// [2]: https://w3.org/TR/webrtc/#dom-rtcpeerconnection-onicecandidate + /// [2]: https://w3.org/TR/webrtc#dom-rtcpeerconnection-onicecandidate /// [3]: https://w3.org/TR/webrtc/#event-icecandidate - /// [4]: https://w3.org/TR/webrtc/#dom-rtcicecandidate + /// [4]: https://w3.org/TR/webrtc#dom-rtcicecandidate on_ice_candidate: RefCell< Option>, >, @@ -94,7 +92,7 @@ pub struct RtcPeerConnection { /// new [MediaStreamTrack][4] from remote peer. /// /// [1]: https://w3.org/TR/webrtc/#rtcpeerconnection-interface - /// [2]: https://w3.org/TR/webrtc/#dom-rtcpeerconnection-ontrack + /// [2]: https://w3.org/TR/webrtc#dom-rtcpeerconnection-ontrack /// [3]: https://w3.org/TR/webrtc/#event-track /// [4]: https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack on_track: @@ -109,7 +107,10 @@ impl RtcPeerConnection { /// Errors with [`RtcPeerConnectionError::PeerCreationError`] if /// [`SysRtcPeerConnection`] creation fails. #[allow(clippy::unused_async)] // for platform code uniformity - pub async fn new(ice_servers: I, is_force_relayed: bool) -> Result + pub async fn new( + ice_servers: I, + is_force_relayed: bool, + ) -> RtcPeerConnectionResult where I: IntoIterator, { @@ -148,7 +149,7 @@ impl RtcPeerConnection { /// [PeerConnection.getStats][1] promise throws exception. /// /// [1]: https://tinyurl.com/w6hmt5f - pub async fn get_stats(&self) -> Result { + pub async fn get_stats(&self) -> RtcPeerConnectionResult { let js_stats = JsFuture::from(self.peer.get_stats()).await.map_err(|e| { tracerr::new!(RtcPeerConnectionError::GetStatsException( @@ -167,7 +168,7 @@ impl RtcPeerConnection { /// If binding to the [`track`][3] event fails. Not supposed to ever happen. /// /// [1]: https://w3.org/TR/webrtc/#rtctrackevent - /// [2]: https://w3.org/TR/webrtc/#dom-rtcpeerconnection-ontrack + /// [2]: https://w3.org/TR/webrtc#dom-rtcpeerconnection-ontrack /// [3]: https://w3.org/TR/webrtc/#event-track pub fn on_track(&self, f: Option) where @@ -204,8 +205,8 @@ impl RtcPeerConnection { /// If binding to the [`icecandidate`][3] event fails. Not supposed to ever /// happen. /// - /// [1]: https://w3.org/TR/webrtc/#dom-rtcpeerconnectioniceevent - /// [2]: https://w3.org/TR/webrtc/#dom-rtcpeerconnection-onicecandidate + /// [1]: https://w3.org/TR/webrtc#dom-rtcpeerconnectioniceevent + /// [2]: https://w3.org/TR/webrtc#dom-rtcpeerconnection-onicecandidate /// [3]: https://w3.org/TR/webrtc/#event-icecandidate pub fn on_ice_candidate(&self, f: Option) where @@ -355,13 +356,13 @@ impl RtcPeerConnection { /// /// [1]: https://w3.org/TR/webrtc/#rtcpeerconnection-interface /// [2]: https://tools.ietf.org/html/rfc5245#section-2 - /// [3]: https://w3.org/TR/webrtc/#dom-peerconnection-addicecandidate + /// [3]: https://w3.org/TR/webrtc#dom-peerconnection-addicecandidate pub async fn add_ice_candidate( &self, candidate: &str, sdp_m_line_index: Option, sdp_mid: &Option, - ) -> Result<()> { + ) -> RtcPeerConnectionResult<()> { let mut cand_init = RtcIceCandidateInit::new(candidate); _ = cand_init .sdp_m_line_index(sdp_m_line_index) @@ -395,12 +396,12 @@ impl RtcPeerConnection { /// With [`RtcPeerConnectionError::SetLocalDescriptionFailed`] if /// [RtcPeerConnection.setLocalDescription()][1] fails. /// - /// [1]: https://w3.org/TR/webrtc/#dom-peerconnection-setlocaldescription + /// [1]: https://w3.org/TR/webrtc#dom-peerconnection-setlocaldescription async fn set_local_description( &self, sdp_type: RtcSdpType, offer: &str, - ) -> Result<()> { + ) -> RtcPeerConnectionResult<()> { let peer: Rc = Rc::clone(&self.peer); let mut desc = RtcSessionDescriptionInit::new(sdp_type); @@ -423,8 +424,8 @@ impl RtcPeerConnection { /// With [`RtcPeerConnectionError::SetLocalDescriptionFailed`] if /// [RtcPeerConnection.setLocalDescription()][1] fails. /// - /// [1]: https://w3.org/TR/webrtc/#dom-peerconnection-setlocaldescription - pub async fn set_offer(&self, offer: &str) -> Result<()> { + /// [1]: https://w3.org/TR/webrtc#dom-peerconnection-setlocaldescription + pub async fn set_offer(&self, offer: &str) -> RtcPeerConnectionResult<()> { self.set_local_description(RtcSdpType::Offer, offer) .await .map_err(tracerr::map_from_and_wrap!()) @@ -437,8 +438,11 @@ impl RtcPeerConnection { /// With [`RtcPeerConnectionError::SetLocalDescriptionFailed`] if /// [RtcPeerConnection.setLocalDescription()][1] fails. /// - /// [1]: https://w3.org/TR/webrtc/#dom-peerconnection-setlocaldescription - pub async fn set_answer(&self, answer: &str) -> Result<()> { + /// [1]: https://w3.org/TR/webrtc#dom-peerconnection-setlocaldescription + pub async fn set_answer( + &self, + answer: &str, + ) -> RtcPeerConnectionResult<()> { self.set_local_description(RtcSdpType::Answer, answer) .await .map_err(tracerr::map_from_and_wrap!()) @@ -454,8 +458,8 @@ impl RtcPeerConnection { /// With [`RtcPeerConnectionError::CreateAnswerFailed`] if /// [RtcPeerConnection.createAnswer()][1] fails. /// - /// [1]: https://w3.org/TR/webrtc/#dom-rtcpeerconnection-createanswer - pub async fn create_answer(&self) -> Result { + /// [1]: https://w3.org/TR/webrtc#dom-rtcpeerconnection-createanswer + pub async fn create_answer(&self) -> RtcPeerConnectionResult { let answer = JsFuture::from(self.peer.create_answer()) .await .map_err(Into::into) @@ -474,8 +478,8 @@ impl RtcPeerConnection { /// With [`RtcPeerConnectionError::SetLocalDescriptionFailed`] if /// [RtcPeerConnection.setLocalDescription()][1] fails. /// - /// [1]: https://w3.org/TR/webrtc/#dom-peerconnection-setlocaldescription - pub async fn rollback(&self) -> Result<()> { + /// [1]: https://w3.org/TR/webrtc#dom-peerconnection-setlocaldescription + pub async fn rollback(&self) -> RtcPeerConnectionResult<()> { let peer: Rc = Rc::clone(&self.peer); JsFuture::from(peer.set_local_description( @@ -501,8 +505,8 @@ impl RtcPeerConnection { /// With [`RtcPeerConnectionError::CreateOfferFailed`] if /// [RtcPeerConnection.createOffer()][1] fails. /// - /// [1]: https://w3.org/TR/webrtc/#dom-rtcpeerconnection-createoffer - pub async fn create_offer(&self) -> Result { + /// [1]: https://w3.org/TR/webrtc#dom-rtcpeerconnection-createoffer + pub async fn create_offer(&self) -> RtcPeerConnectionResult { let peer: Rc = Rc::clone(&self.peer); let mut offer_options = RtcOfferOptions::new(); @@ -532,8 +536,11 @@ impl RtcPeerConnection { /// With [`RtcPeerConnectionError::SetRemoteDescriptionFailed`] if /// [RTCPeerConnection.setRemoteDescription()][1] fails. /// - /// [1]: https://w3.org/TR/webrtc/#dom-peerconnection-setremotedescription - pub async fn set_remote_description(&self, sdp: SdpType) -> Result<()> { + /// [1]: https://w3.org/TR/webrtc#dom-peerconnection-setremotedescription + pub async fn set_remote_description( + &self, + sdp: SdpType, + ) -> RtcPeerConnectionResult<()> { let description = match sdp { SdpType::Offer(offer) => { let mut desc = @@ -562,7 +569,7 @@ impl RtcPeerConnection { /// Creates new [`RtcRtpTransceiver`] (see [RTCRtpTransceiver][1]) /// and adds it to the [set of this RTCPeerConnection's transceivers][2]. /// - /// [1]: https://w3.org/TR/webrtc/#dom-rtcrtptransceiver + /// [1]: https://w3.org/TR/webrtc#dom-rtcrtptransceiver /// [2]: https://w3.org/TR/webrtc/#transceivers-set pub fn add_transceiver( &self, @@ -587,7 +594,7 @@ impl RtcPeerConnection { /// If fails to [iterate over transceivers on JS side](js_sys::try_iter). /// Not supposed to ever happen. /// - /// [1]: https://w3.org/TR/webrtc/#dom-rtcrtptransceiver + /// [1]: https://w3.org/TR/webrtc#dom-rtcrtptransceiver /// [2]: https://w3.org/TR/webrtc/#transceivers-set pub fn get_transceiver_by_mid( &self, @@ -620,7 +627,7 @@ impl Drop for RtcPeerConnection { /// and [closes][1] the underlying /// [RTCPeerConnection][`SysRtcPeerConnection`]. /// - /// [1]: https://w3.org/TR/webrtc/#dom-rtcpeerconnection-close + /// [1]: https://w3.org/TR/webrtc#dom-rtcpeerconnection-close fn drop(&mut self) { drop(self.on_track.borrow_mut().take()); drop(self.on_ice_candidate.borrow_mut().take()); @@ -633,10 +640,10 @@ impl Drop for RtcPeerConnection { /// Returns [RTCPeerConnection.connectionState][1] property of provided /// [`SysRtcPeerConnection`] using reflection. /// -/// [1]: https://w3.org/TR/webrtc/#dom-peerconnection-connection-state +/// [1]: https://w3.org/TR/webrtc#dom-peerconnection-connection-state fn get_peer_connection_state( peer: &SysRtcPeerConnection, -) -> Option> { +) -> Option> { let state = get_property_by_name(peer, "connectionState", |v| v.as_string())?; Some(Ok(match state.as_str() { diff --git a/src/platform/wasm/rtc_stats.rs b/src/platform/wasm/rtc_stats.rs index 7c809d71f..c73564315 100644 --- a/src/platform/wasm/rtc_stats.rs +++ b/src/platform/wasm/rtc_stats.rs @@ -5,7 +5,7 @@ use std::rc::Rc; use js_sys::{ - Array as JsArray, Function as JsFunction, Iterator as JsIterator, + Array as JsArray, Function as JsFunction, Iterator as JsIterator, JSON, }; use medea_client_api_proto::stats::{RtcStat, RtcStatsType}; use tracerr::Traced; @@ -43,7 +43,7 @@ impl TryFrom<&JsValue> for RtcStats { let stat = stat.unchecked_into::(); let stat = RtcStatsReportEntry::try_from(stat) .map_err(tracerr::map_from_and_wrap!())?; - let stat_json = js_sys::JSON::stringify(&JsValue::from(&stat.0)) + let stat_json = JSON::stringify(&JsValue::from(&stat.0)) .map(String::from) .unwrap_throw(); let rtc_stat: RtcStat = serde_json::from_str(&stat_json) diff --git a/src/platform/wasm/transceiver.rs b/src/platform/wasm/transceiver.rs index 22820bebc..16b572c67 100644 --- a/src/platform/wasm/transceiver.rs +++ b/src/platform/wasm/transceiver.rs @@ -66,7 +66,7 @@ impl Transceiver { /// /// Errors with JS error if the underlying [`replaceTrack`][1] call fails. /// - /// [1]: https://w3.org/TR/webrtc/#dom-rtcrtpsender-replacetrack + /// [1]: https://w3.org/TR/webrtc#dom-rtcrtpsender-replacetrack pub async fn set_send_track( &self, new_track: Option<&Rc>, @@ -82,7 +82,7 @@ impl Transceiver { /// Returns [`mid`] of this [`Transceiver`]. /// - /// [`mid`]: https://w3.org/TR/webrtc/#dom-rtptransceiver-mid + /// [`mid`]: https://w3.org/TR/webrtc#dom-rtptransceiver-mid #[must_use] pub fn mid(&self) -> Option { self.0.mid() diff --git a/src/platform/wasm/transport.rs b/src/platform/wasm/transport.rs index 4b5cc8d16..b2952978a 100644 --- a/src/platform/wasm/transport.rs +++ b/src/platform/wasm/transport.rs @@ -31,7 +31,7 @@ struct ServerMessage(ServerMsg); impl TryFrom<&MessageEvent> for ServerMessage { type Error = TransportError; - fn try_from(msg: &MessageEvent) -> std::result::Result { + fn try_from(msg: &MessageEvent) -> Result { use TransportError::{MessageNotString, ParseServerMessage}; let payload = msg.data().as_string().ok_or(MessageNotString)?; @@ -43,9 +43,7 @@ impl TryFrom<&MessageEvent> for ServerMessage { } /// Shortcut for a [`Result`] containing a [`Traced`] [`TransportError`]. -/// -/// [`Result`]: std::result::Result -type Result> = std::result::Result; +type TransportResult = Result>; /// Inner data of a [`WebSocketRpcTransport`]. #[derive(Debug)] @@ -194,7 +192,7 @@ impl Default for WebSocketRpcTransport { #[async_trait(?Send)] impl RpcTransport for WebSocketRpcTransport { - async fn connect(&self, url: ApiUrl) -> Result<()> { + async fn connect(&self, url: ApiUrl) -> TransportResult<()> { let socket = SysWebSocket::new(url.as_ref()) .map_err(Into::into) .map_err(TransportError::CreateSocket) @@ -261,7 +259,7 @@ impl RpcTransport for WebSocketRpcTransport { self.0.borrow_mut().close_reason = close_reason; } - fn send(&self, msg: &ClientMsg) -> Result<()> { + fn send(&self, msg: &ClientMsg) -> TransportResult<()> { let inner = self.0.borrow(); let message = serde_json::to_string(msg) .map_err(|e| TransportError::SerializeClientMessage(e.into())) diff --git a/src/room.rs b/src/room.rs index bcadad109..0946c0010 100644 --- a/src/room.rs +++ b/src/room.rs @@ -852,11 +852,11 @@ impl Room { peer_events_rx.map(RoomEvent::PeerEvent).fuse(); let mut rpc_connection_lost = rpc .on_connection_loss() - .map(|_| RoomEvent::RpcClientLostConnection) + .map(|()| RoomEvent::RpcClientLostConnection) .fuse(); let mut rpc_client_reconnected = rpc .on_reconnected() - .map(|_| RoomEvent::RpcClientReconnected) + .map(|()| RoomEvent::RpcClientReconnected) .fuse(); let room = Rc::new(InnerRoom::new(rpc, media_manager, tx)); diff --git a/src/rpc/heartbeat.rs b/src/rpc/heartbeat.rs index a64ed5285..24f1d11f5 100644 --- a/src/rpc/heartbeat.rs +++ b/src/rpc/heartbeat.rs @@ -64,6 +64,8 @@ impl Inner { /// Sends [`ClientMsg::Pong`] to a server. /// /// If some error happen then it will be printed with [`log::error`]. + // TODO: False positive, try remove on Rust 1.74 upgrade. + #[allow(unused_must_use)] fn send_pong(&self, n: u32) { self.transport .send(&ClientMsg::Pong(n)) diff --git a/src/rpc/rpc_session.rs b/src/rpc/rpc_session.rs index 4e128edf5..74e3d795b 100644 --- a/src/rpc/rpc_session.rs +++ b/src/rpc/rpc_session.rs @@ -280,7 +280,7 @@ impl WebSocketRpcSession { .connect(info.url.clone()) .await { - Ok(_) => { + Ok(()) => { this.state.set(S::Authorizing(info)); } Err(e) => { diff --git a/src/utils/errors.rs b/src/utils/errors.rs index f42eaa2be..9b2005d08 100644 --- a/src/utils/errors.rs +++ b/src/utils/errors.rs @@ -15,14 +15,14 @@ pub trait Caused { fn cause(self) -> Option; } -/// Wrapper for [`serde_json::error::Error`] that provides [`Clone`], [`Debug`], +/// Wrapper for [`serde_json::Error`] that provides [`Clone`], [`Debug`], /// [`Display`] implementations. /// /// [`Debug`]: std::fmt::Debug /// [`Display`]: std::fmt::Display #[derive(Clone, Debug, Display, From)] #[from(forward)] -pub struct JsonParseError(Rc); +pub struct JsonParseError(Rc); impl PartialEq for JsonParseError { fn eq(&self, other: &Self) -> bool {