diff --git a/Cargo.lock b/Cargo.lock index 958c51434..1fbee5b56 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -115,7 +115,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb" dependencies = [ "quote", - "syn 2.0.76", + "syn 2.0.77", ] [[package]] @@ -250,7 +250,7 @@ dependencies = [ "actix-router", "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.77", ] [[package]] @@ -261,24 +261,18 @@ checksum = "7c7db3d5a9718568e4cf4a537cfd7070e6e6ff7481510d0237fb529ac850f6d3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.77", ] [[package]] name = "addr2line" -version = "0.22.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" +checksum = "f5fb1d8e4442bd405fdfd1dacb42792696b0cf9cb15882e5d097b742a676d375" dependencies = [ "gimli", ] -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - [[package]] name = "adler2" version = "2.0.0" @@ -416,9 +410,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "10f00e1f6e58a40e807377c75c6a7f97bf9044fab57816f2414e6f5f4499d7b8" [[package]] name = "arc-swap" @@ -434,7 +428,7 @@ checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.77", ] [[package]] @@ -456,18 +450,18 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.77", ] [[package]] name = "async-trait" -version = "0.1.81" +version = "0.1.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" +checksum = "a27b8a3a6e1a44fa4c8baf1f653e4172e81486d4941f2237e20dc2d0cf4ddff1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.77", ] [[package]] @@ -490,9 +484,9 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "aws-lc-rs" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ae74d9bd0a7530e8afd1770739ad34b36838829d6ad61818f9230f683f5ad77" +checksum = "2f95446d919226d587817a7d21379e6eb099b97b45110a7f272a444ca5c54070" dependencies = [ "aws-lc-sys", "mirai-annotations", @@ -502,9 +496,9 @@ dependencies = [ [[package]] name = "aws-lc-sys" -version = "0.20.1" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f0e249228c6ad2d240c2dc94b714d711629d52bad946075d8e9b2f5391f0703" +checksum = "234314bd569802ec87011d653d6815c6d7b9ffb969e9fee5b8b20ef860e8dce9" dependencies = [ "bindgen", "cc", @@ -577,17 +571,17 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.73" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" dependencies = [ "addr2line", - "cc", "cfg-if 1.0.0", "libc", - "miniz_oxide 0.7.4", + "miniz_oxide", "object", "rustc-demangle", + "windows-targets 0.52.6", ] [[package]] @@ -621,7 +615,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.76", + "syn 2.0.77", "which", ] @@ -691,9 +685,9 @@ checksum = "5ce89b21cab1437276d2650d57e971f9d548a2d9037cc231abdc0562b97498ce" [[package]] name = "bytemuck" -version = "1.17.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fd4c6dcc3b0aea2f5c0b4b82c2b15fe39ddbc76041a310848f4706edf76bb31" +checksum = "94bbb0ad554ad961ddc5da507a12a29b14e4ae5bda06b19f575a3e6079d2e2ae" [[package]] name = "byteorder" @@ -718,9 +712,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.15" +version = "1.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57b6a275aa2903740dc87da01c62040406b8812552e97129a63ea8850a17c6e6" +checksum = "b62ac837cdb5cb22e10a256099b4fc502b1dfe560cb282963a974d7abd80e476" dependencies = [ "jobserver", "libc", @@ -774,9 +768,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.16" +version = "4.5.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed6719fffa43d0d87e5fd8caeab59be1554fb028cd30edc88fc4369b17971019" +checksum = "3e5a21b8495e732f1b3c364c9949b201ca7bae518c502c80256c96ad79eaf6ac" dependencies = [ "clap_builder", "clap_derive", @@ -784,9 +778,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.15" +version = "4.5.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216aec2b177652e3846684cbfe25c9964d18ec45234f0f5da5157b207ed1aab6" +checksum = "8cf2dd12af7a047ad9d6da2b6b249759a22a7abc0f474c1dae1777afa4b21a73" dependencies = [ "anstream", "anstyle", @@ -804,7 +798,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.77", ] [[package]] @@ -907,9 +901,9 @@ checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpufeatures" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51e852e6dc9a5bed1fae92dd2375037bf2b768725bf3be87811edee3249d09ad" +checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" dependencies = [ "libc", ] @@ -1010,7 +1004,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.76", + "syn 2.0.77", "synthez", ] @@ -1049,7 +1043,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.76", + "syn 2.0.77", ] [[package]] @@ -1060,7 +1054,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.76", + "syn 2.0.77", ] [[package]] @@ -1080,7 +1074,7 @@ checksum = "51aac4c99b2e6775164b412ea33ae8441b2fde2dbf05a20bc0052a63d08c475b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.77", ] [[package]] @@ -1114,7 +1108,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version", - "syn 2.0.76", + "syn 2.0.77", ] [[package]] @@ -1134,7 +1128,7 @@ checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.77", "unicode-xid", ] @@ -1242,9 +1236,9 @@ dependencies = [ [[package]] name = "fantoccini" -version = "0.21.1" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "871139c015d646c5fbe287b85876fa060c9d7870ccc388e989c056b303d8462a" +checksum = "dd52b63e98251013cd5a9e881b9d460fc530e5df4eec58930c9694d6497c53e5" dependencies = [ "base64 0.22.1", "cookie 0.18.1", @@ -1283,7 +1277,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "324a1be68054ef05ad64b861cc9eaf1d623d2d8cb25b4bf2cb9cdd902b4bf253" dependencies = [ "crc32fast", - "miniz_oxide 0.8.0", + "miniz_oxide", ] [[package]] @@ -1319,7 +1313,7 @@ dependencies = [ "md-5", "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.77", ] [[package]] @@ -1420,7 +1414,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.77", ] [[package]] @@ -1487,7 +1481,7 @@ dependencies = [ "quote", "serde", "serde_json", - "syn 2.0.76", + "syn 2.0.77", "textwrap", "thiserror", "typed-builder", @@ -1495,9 +1489,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.29.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" +checksum = "32085ea23f3234fc7846555e85283ba4de91e21016dc0455a16286d87a292d64" [[package]] name = "glob" @@ -1507,9 +1501,9 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "globset" -version = "0.4.14" +version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57da3b9b5b85bd66f31093f8c408b90a74431672542466497dcbdfdc02034be1" +checksum = "15f1ce686646e7f1e19bf7d5533fe443a45dbfb990e00629110797578b42fb19" dependencies = [ "aho-corasick", "bstr", @@ -1541,7 +1535,7 @@ dependencies = [ "futures-sink", "futures-util", "http 0.2.12", - "indexmap 2.4.0", + "indexmap 2.5.0", "slab", "tokio", "tokio-util", @@ -1560,7 +1554,7 @@ dependencies = [ "futures-core", "futures-sink", "http 1.1.0", - "indexmap 2.4.0", + "indexmap 2.5.0", "slab", "tokio", "tokio-util", @@ -1723,9 +1717,9 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.27.2" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155" +checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" dependencies = [ "futures-util", "http 1.1.0", @@ -1771,9 +1765,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde7055719c54e36e95e8719f95883f22072a48ede39db7fc17a4e1d5281e9b9" +checksum = "da62f120a8a37763efb0cf8fdf264b884c7b8b9ac8660b900c8661030c00e6ba" dependencies = [ "bytes", "futures-channel", @@ -1830,9 +1824,9 @@ dependencies = [ [[package]] name = "ignore" -version = "0.4.22" +version = "0.4.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b46810df39e66e925525d6e38ce1e7f6e1d208f72dc39757880fcb66e2c58af1" +checksum = "6d89fd380afde86567dfba715db065673989d6253f42b88179abd3eae47bda4b" dependencies = [ "crossbeam-deque", "globset", @@ -1863,9 +1857,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93ead53efc7ea8ed3cfb0c79fc8023fbb782a5432b52830b6518941cebe6505c" +checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" dependencies = [ "equivalent", "hashbrown 0.14.5", @@ -1898,9 +1892,9 @@ checksum = "f958d3d68f4167080a18141e10381e7634563984a537f2a49a30fd8e53ac5767" [[package]] name = "ipnet" -version = "2.9.0" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" +checksum = "187674a687eed5fe42285b40c6291f9a01517d415fad1c3cbc6a9f778af7fcd4" [[package]] name = "is-terminal" @@ -1987,7 +1981,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.76", + "syn 2.0.77", ] [[package]] @@ -2210,7 +2204,7 @@ dependencies = [ "medea-jason", "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.77", "synstructure", ] @@ -2246,15 +2240,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" -[[package]] -name = "miniz_oxide" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" -dependencies = [ - "adler", -] - [[package]] name = "miniz_oxide" version = "0.8.0" @@ -2306,7 +2291,7 @@ dependencies = [ "cfg-if 1.0.0", "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.77", ] [[package]] @@ -2379,9 +2364,9 @@ dependencies = [ [[package]] name = "object" -version = "0.36.3" +version = "0.36.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27b64972346851a39438c60b341ebc01bba47464ae329e55cf343eb93964efd9" +checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a" dependencies = [ "memchr", ] @@ -2415,7 +2400,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.77", ] [[package]] @@ -2505,7 +2490,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" dependencies = [ "fixedbitset", - "indexmap 2.4.0", + "indexmap 2.5.0", ] [[package]] @@ -2525,7 +2510,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.77", ] [[package]] @@ -2594,7 +2579,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "479cf940fbbb3426c32c5d5176f62ad57549a0bb84773423ba8be9d089f5faba" dependencies = [ "proc-macro2", - "syn 2.0.76", + "syn 2.0.77", ] [[package]] @@ -2608,9 +2593,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.13.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13db3d3fde688c61e2446b4d843bc27a7e8af269a69440c0308021dc92333cc" +checksum = "3b2ecbe40f08db5c006b5764a2645f7f3f141ce756412ac9e1dd6087e6d32995" dependencies = [ "bytes", "prost-derive", @@ -2618,9 +2603,9 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.13.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bb182580f71dd070f88d01ce3de9f4da5021db7115d2e1c3605a754153b77c1" +checksum = "f8650aabb6c35b860610e9cff5dc1af886c9e25073b7b1712a68972af4281302" dependencies = [ "bytes", "heck 0.5.0", @@ -2633,28 +2618,28 @@ dependencies = [ "prost", "prost-types", "regex", - "syn 2.0.76", + "syn 2.0.77", "tempfile", ] [[package]] name = "prost-derive" -version = "0.13.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18bec9b0adc4eba778b33684b7ba3e7137789434769ee3ce3930463ef904cfca" +checksum = "acf0c195eebb4af52c752bec4f52f645da98b6e92077a04110c7f349477ae5ac" dependencies = [ "anyhow", "itertools 0.13.0", "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.77", ] [[package]] name = "prost-types" -version = "0.13.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cee5168b05f49d4b0ca581206eb14a7b22fafd963efe729ac48eb03266e25cc2" +checksum = "60caa6738c7369b940c3d49246a8d1749323674c65cb13010134f5c9bad5b519" dependencies = [ "prost", ] @@ -2735,7 +2720,7 @@ checksum = "bcc303e793d3734489387d205e9b186fac9c6cfacedd98cbb2e8a5943595f3e6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.77", ] [[package]] @@ -2851,18 +2836,18 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustc_version" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ "semver", ] [[package]] name = "rustix" -version = "0.38.34" +version = "0.38.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +checksum = "3f55e80d50763938498dd5ebb18647174e0c76dc38c5505294bb224624f30f36" dependencies = [ "bitflags", "errno", @@ -2873,9 +2858,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.12" +version = "0.23.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c58f8c84392efc0a126acce10fa59ff7b3d2ac06ab451a33f2741989b806b044" +checksum = "f2dabaac7466917e566adb06783a81ca48944c6898a1b08b9374106dd671f4c8" dependencies = [ "aws-lc-rs", "log", @@ -2888,9 +2873,9 @@ dependencies = [ [[package]] name = "rustls-native-certs" -version = "0.7.2" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04182dffc9091a404e0fc069ea5cd60e5b866c3adf881eff99a32d048242dffa" +checksum = "fcaf18a4f2be7326cd874a5fa579fae794320a0f388d365dca7e480e55f83f8a" dependencies = [ "openssl-probe", "rustls-pemfile", @@ -2917,9 +2902,9 @@ checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0" [[package]] name = "rustls-webpki" -version = "0.102.6" +version = "0.102.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e6b52d4fda176fd835fdc55a835d4a89b8499cad995885a21149d5ad62f852e" +checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" dependencies = [ "aws-lc-rs", "ring", @@ -2950,11 +2935,11 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" +checksum = "e9aaafd5a2b6e3d657ff009d82fbd630b6bd54dd4eb06f21693925cdf80f9b8b" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -2990,7 +2975,7 @@ dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.77", ] [[package]] @@ -3030,29 +3015,29 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" -version = "1.0.209" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99fce0ffe7310761ca6bf9faf5115afbc19688edd00171d81b1bb1b116c63e09" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.209" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.77", ] [[package]] name = "serde_json" -version = "1.0.127" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8043c06d9f82bd7271361ed64f415fe5e12a77fdb52e573e7f06a516dea329ad" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" dependencies = [ "itoa", "memchr", @@ -3082,7 +3067,7 @@ dependencies = [ "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.4.0", + "indexmap 2.5.0", "serde", "serde_derive", "serde_json", @@ -3099,7 +3084,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.77", ] [[package]] @@ -3108,7 +3093,7 @@ version = "0.9.34+deprecated" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" dependencies = [ - "indexmap 2.4.0", + "indexmap 2.5.0", "itoa", "ryu", "serde", @@ -3244,7 +3229,7 @@ checksum = "0eb01866308440fc64d6c44d9e86c5cc17adfe33c4d6eed55da9145044d0ffc1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.77", ] [[package]] @@ -3294,9 +3279,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.76" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578e081a14e0cefc3279b0472138c513f37b41a08d5a3cca9b6e4e8ceb6cd525" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -3326,7 +3311,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.77", ] [[package]] @@ -3335,7 +3320,7 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3d2c2202510a1e186e63e596d9318c91a8cbe85cd1a56a7be0c333e5f59ec8d" dependencies = [ - "syn 2.0.76", + "syn 2.0.77", "synthez-codegen", "synthez-core", ] @@ -3346,7 +3331,7 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f724aa6d44b7162f3158a57bccd871a77b39a4aef737e01bcdff41f4772c7746" dependencies = [ - "syn 2.0.76", + "syn 2.0.77", "synthez-core", ] @@ -3359,7 +3344,7 @@ dependencies = [ "proc-macro2", "quote", "sealed 0.5.0", - "syn 2.0.76", + "syn 2.0.77", ] [[package]] @@ -3457,7 +3442,7 @@ checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.77", ] [[package]] @@ -3520,9 +3505,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.39.3" +version = "1.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9babc99b9923bfa4804bd74722ff02c0381021eafa4db9949217e3be8e84fff5" +checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" dependencies = [ "backtrace", "bytes", @@ -3544,7 +3529,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.77", ] [[package]] @@ -3570,9 +3555,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.15" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" +checksum = "4f4e6ce100d0eb49a2734f8c0812bcd324cf357d21810932c5df6b96ef2b86f1" dependencies = [ "futures-core", "pin-project-lite", @@ -3581,9 +3566,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.11" +version = "0.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" +checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" dependencies = [ "bytes", "futures-core", @@ -3632,7 +3617,7 @@ dependencies = [ "proc-macro2", "prost-build", "quote", - "syn 2.0.76", + "syn 2.0.77", ] [[package]] @@ -3697,7 +3682,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.77", ] [[package]] @@ -3732,7 +3717,7 @@ checksum = "29a3151c41d0b13e3d011f98adc24434560ef06673a155a6c7f66b9879eecce2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.77", ] [[package]] @@ -3883,7 +3868,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.77", "wasm-bindgen-shared", ] @@ -3917,7 +3902,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.77", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -3950,7 +3935,7 @@ checksum = "b7f89739351a2e03cb94beb799d47fb2cac01759b40ec441f7de39b00cbf7ef0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.77", ] [[package]] @@ -4254,7 +4239,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.77", ] [[package]] @@ -4262,20 +4247,6 @@ name = "zeroize" version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" -dependencies = [ - "zeroize_derive", -] - -[[package]] -name = "zeroize_derive" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.76", -] [[package]] name = "zstd" diff --git a/Cargo.toml b/Cargo.toml index 3f3b60e6b..e430467f1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "medea-jason" version = "0.6.0" edition = "2021" -rust-version = "1.75" +rust-version = "1.81" description = "Client library for Medea media server." authors = ["Instrumentisto Team "] license = "MPL-2.0" diff --git a/Makefile b/Makefile index 27fd443b8..98b806453 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.80 -CHROME_VERSION := 126.0 -FIREFOX_VERSION := 128.0.3-driver0.34.0 +RUST_VER := 1.81 +CHROME_VERSION := 127.0 +FIREFOX_VERSION := 130.0-driver0.35.0 -CARGO_NDK_VER := 3.5.4-ndkr27-rust$(RUST_VER) +CARGO_NDK_VER := 3.5.4-ndkr27b-rust$(RUST_VER) ANDROID_TARGETS := aarch64-linux-android \ armv7-linux-androideabi \ i686-linux-android \ diff --git a/crates/medea-macro/Cargo.toml b/crates/medea-macro/Cargo.toml index 74355c111..b10ba94cd 100644 --- a/crates/medea-macro/Cargo.toml +++ b/crates/medea-macro/Cargo.toml @@ -2,7 +2,7 @@ name = "medea-macro" version = "0.3.0" edition = "2021" -rust-version = "1.65" +rust-version = "1.81" description = "Internal macros and codegen for Medea media server project." authors = ["Instrumentisto Team "] license = "BlueOak-1.0.0" diff --git a/crates/medea-macro/src/lib.rs b/crates/medea-macro/src/lib.rs index fdfe42319..652b670fe 100644 --- a/crates/medea-macro/src/lib.rs +++ b/crates/medea-macro/src/lib.rs @@ -10,10 +10,13 @@ #![forbid(non_ascii_idents, unsafe_code)] #![warn( clippy::absolute_paths, + clippy::allow_attributes, + clippy::allow_attributes_without_reason, clippy::as_conversions, clippy::as_ptr_cast_mut, clippy::assertions_on_result_states, clippy::branches_sharing_code, + clippy::cfg_not_test, clippy::clear_with_drain, clippy::clone_on_ref_ptr, clippy::collection_is_never_read, @@ -84,6 +87,7 @@ clippy::rest_pat_in_fully_bound_structs, clippy::same_name_method, clippy::semicolon_inside_block, + clippy::set_contains_or_insert, clippy::shadow_unrelated, clippy::significant_drop_in_scrutinee, clippy::significant_drop_tightening, diff --git a/crates/medea-reactive/Cargo.toml b/crates/medea-reactive/Cargo.toml index 8205f9c00..06c1bbee1 100644 --- a/crates/medea-reactive/Cargo.toml +++ b/crates/medea-reactive/Cargo.toml @@ -2,7 +2,7 @@ name = "medea-reactive" version = "0.1.2" edition = "2021" -rust-version = "1.64" +rust-version = "1.81" description = "Reactive mutable data containers." authors = ["Instrumentisto Team "] license = "BlueOak-1.0.0" diff --git a/crates/medea-reactive/src/collections/hash_map.rs b/crates/medea-reactive/src/collections/hash_map.rs index 32fe9fc00..92ff40561 100644 --- a/crates/medea-reactive/src/collections/hash_map.rs +++ b/crates/medea-reactive/src/collections/hash_map.rs @@ -204,7 +204,7 @@ where /// values and values that will be inserted. /// /// [`Stream`]: futures::Stream - #[allow(clippy::needless_collect)] // false positive: lifetimes + #[expect(clippy::needless_collect, reason = "false positive: lifetimes")] pub fn replay_on_insert(&self) -> LocalBoxStream<'static, O> { Box::pin(stream::iter( self.store @@ -341,7 +341,7 @@ impl, O> Drop for HashMap { /// Sends all key-values of a dropped [`HashMap`] to the /// [`HashMap::on_remove`] subs. fn drop(&mut self) { - #[allow(clippy::iter_over_hash_type)] // order doesn't matter here + #[expect(clippy::iter_over_hash_type, reason = "order doesn't matte")] for (k, v) in self.store.drain() { self.on_remove_subs.send_update((k, v)); } diff --git a/crates/medea-reactive/src/collections/hash_set.rs b/crates/medea-reactive/src/collections/hash_set.rs index 6e63d9869..c3952dfab 100644 --- a/crates/medea-reactive/src/collections/hash_set.rs +++ b/crates/medea-reactive/src/collections/hash_set.rs @@ -194,7 +194,7 @@ where /// values and values that will be inserted. /// /// [`Stream`]: futures::Stream - #[allow(clippy::needless_collect)] // false positive: lifetimes + #[expect(clippy::needless_collect, reason = "false positive: lifetimes")] pub fn replay_on_insert(&self) -> LocalBoxStream<'static, O> { Box::pin(stream::iter( self.store @@ -303,7 +303,7 @@ where /// Sends all values of a dropped [`HashSet`] to the /// [`HashSet::on_remove()`] subscriptions. fn drop(&mut self) { - #[allow(clippy::iter_over_hash_type)] // order doesn't matter here + #[expect(clippy::iter_over_hash_type, reason = "order doesn't matter")] for val in self.store.drain() { self.on_remove_subs.send_update(val); } diff --git a/crates/medea-reactive/src/collections/mod.rs b/crates/medea-reactive/src/collections/mod.rs index 587fb7e2c..4b28ad8d0 100644 --- a/crates/medea-reactive/src/collections/mod.rs +++ b/crates/medea-reactive/src/collections/mod.rs @@ -1,6 +1,7 @@ //! Implementations of reactive collections based on [`std::collections`]. -#![allow(clippy::module_name_repetitions)] // TODO: Refactor? +// TODO: Needs refactoring. +#![expect(clippy::module_name_repetitions, reason = "needs refactoring")] pub mod hash_map; pub mod hash_set; diff --git a/crates/medea-reactive/src/collections/vec.rs b/crates/medea-reactive/src/collections/vec.rs index 076831f81..b263f5e43 100644 --- a/crates/medea-reactive/src/collections/vec.rs +++ b/crates/medea-reactive/src/collections/vec.rs @@ -192,7 +192,7 @@ where /// inserted. /// /// [`Stream`]: futures::Stream - #[allow(clippy::needless_collect)] // false positive: lifetimes + #[expect(clippy::needless_collect, reason = "false positive: lifetimes")] pub fn replay_on_push(&self) -> LocalBoxStream<'static, O> { Box::pin(stream::iter( self.store diff --git a/crates/medea-reactive/src/field/cell.rs b/crates/medea-reactive/src/field/cell.rs index c8b7a4bd4..bc37dd3a5 100644 --- a/crates/medea-reactive/src/field/cell.rs +++ b/crates/medea-reactive/src/field/cell.rs @@ -6,7 +6,8 @@ //! [`Cell`]: std::cell::Cell //! [`ObservableField`]: crate::ObservableField -#![allow(clippy::module_name_repetitions)] // TODO: Refactor? +// TODO: Needs refactoring. +#![expect(clippy::module_name_repetitions, reason = "needs refactoring")] use std::{ cell::{Ref, RefCell}, diff --git a/crates/medea-reactive/src/field/mod.rs b/crates/medea-reactive/src/field/mod.rs index 09c03fb9a..792148659 100644 --- a/crates/medea-reactive/src/field/mod.rs +++ b/crates/medea-reactive/src/field/mod.rs @@ -1,6 +1,7 @@ //! Implementations of basic reactive containers. -#![allow(clippy::module_name_repetitions)] // TODO: Refactor? +// TODO: Needs refactoring. +#![expect(clippy::module_name_repetitions, reason = "needs refactoring")] pub mod cell; pub mod progressable_cell; @@ -219,7 +220,6 @@ pub trait OnObservableFieldModification { /// Subscriber that implements subscribing and [`Whenable`] in [`Vec`]. /// /// This structure should be wrapped into [`Vec`]. -#[allow(variant_size_differences)] pub enum UniversalSubscriber { /// Subscriber for [`Whenable`]. When { @@ -311,7 +311,7 @@ impl OnObservableFieldModification fn on_modify(&mut self, data: &D) { self.borrow_mut().retain(|sub| match sub { UniversalSubscriber::When { assert_fn, sender } => { - #[allow(clippy::expect_used)] // intentional + #[expect(clippy::expect_used, reason = "single use expected")] if (assert_fn)(data) { sender .borrow_mut() diff --git a/crates/medea-reactive/src/lib.rs b/crates/medea-reactive/src/lib.rs index 58546cfc7..dd460c9e1 100644 --- a/crates/medea-reactive/src/lib.rs +++ b/crates/medea-reactive/src/lib.rs @@ -10,10 +10,13 @@ #![forbid(non_ascii_idents, unsafe_code)] #![warn( clippy::absolute_paths, + clippy::allow_attributes, + clippy::allow_attributes_without_reason, clippy::as_conversions, clippy::as_ptr_cast_mut, clippy::assertions_on_result_states, clippy::branches_sharing_code, + clippy::cfg_not_test, clippy::clear_with_drain, clippy::clone_on_ref_ptr, clippy::collection_is_never_read, @@ -84,6 +87,7 @@ clippy::rest_pat_in_fully_bound_structs, clippy::same_name_method, clippy::semicolon_inside_block, + clippy::set_contains_or_insert, clippy::shadow_unrelated, clippy::significant_drop_in_scrutinee, clippy::significant_drop_tightening, diff --git a/crates/medea-reactive/src/subscribers_store/progressable/guarded.rs b/crates/medea-reactive/src/subscribers_store/progressable/guarded.rs index d916d8229..538060919 100644 --- a/crates/medea-reactive/src/subscribers_store/progressable/guarded.rs +++ b/crates/medea-reactive/src/subscribers_store/progressable/guarded.rs @@ -69,7 +69,7 @@ pub struct Guard(Rc>); impl Guard { /// Creates new [`Guard`] on the given `counter`. fn new(counter: Rc>) -> Self { - #[allow(clippy::expect_used)] // intentional + #[expect(clippy::expect_used, reason = "overflowing is unexpected")] counter.mutate(|mut c| { *c = c .checked_add(1) diff --git a/crates/medea-reactive/src/subscribers_store/progressable/processed.rs b/crates/medea-reactive/src/subscribers_store/progressable/processed.rs index 9968a551d..a4c5967a3 100644 --- a/crates/medea-reactive/src/subscribers_store/progressable/processed.rs +++ b/crates/medea-reactive/src/subscribers_store/progressable/processed.rs @@ -17,7 +17,7 @@ pub type Factory<'a, T> = Box LocalBoxFuture<'a, T> + 'static>; /// Creates [`AllProcessed`] [`Future`] from the provided [`Iterator`] of /// [`Factory`]s. -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions, reason = "naming is saner this way")] pub fn when_all_processed(futures: I) -> AllProcessed<'static> where I: IntoIterator>, @@ -80,7 +80,7 @@ impl fmt::Debug for Processed<'_, T> { /// conditions are still met. /// /// Inner [`Factory`] can be unwrapped using [`Into`] implementation. -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions, reason = "naming is saner this way")] #[must_use = "futures do nothing unless you `.await` or poll them"] pub struct AllProcessed<'a, T = ()> { /// Factory creating the underlying [`Future`] and recreating it to recheck diff --git a/e2e/Cargo.toml b/e2e/Cargo.toml index bf2d9a6d2..e53193d5f 100644 --- a/e2e/Cargo.toml +++ b/e2e/Cargo.toml @@ -2,7 +2,7 @@ name = "medea-e2e" version = "0.0.0" edition = "2021" -rust-version = "1.80" +rust-version = "1.81" description = "E2E tests for Medea media server." authors = ["Instrumentisto Team "] publish = false diff --git a/e2e/src/browser/client.rs b/e2e/src/browser/client.rs index 2b1671069..3f1f6d0a0 100644 --- a/e2e/src/browser/client.rs +++ b/e2e/src/browser/client.rs @@ -53,7 +53,8 @@ impl From for Result { /// Client for interacting with a browser through a [WebDriver] protocol. /// /// [WebDriver]: https://w3.org/TR/webdriver -#[allow(clippy::module_name_repetitions)] // TODO: Refactor? +// TODO: Needs refactoring. +#[expect(clippy::module_name_repetitions, reason = "needs refactoring")] #[derive(Clone, Debug)] pub struct WebDriverClient { /// Inner implementation of this [`WebDriverClient`]. diff --git a/e2e/src/browser/mock/mod.rs b/e2e/src/browser/mock/mod.rs index 86324e1d0..7964abff1 100644 --- a/e2e/src/browser/mock/mod.rs +++ b/e2e/src/browser/mock/mod.rs @@ -13,7 +13,9 @@ pub async fn instantiate_mocks(window: &Window) { MediaDevices::instantiate(window).await; } -#[allow(clippy::multiple_inherent_impl)] // better keep these functions here +// TODO: Try remove on next Rust version upgrade. +#[expect(clippy::allow_attributes, reason = "`#[expect]` is not considered")] +#[allow(clippy::multiple_inherent_impl, reason = "more proper place")] impl Window { /// Returns a `WebSocket` object mock for this [`Window`]. #[must_use] diff --git a/e2e/src/browser/mod.rs b/e2e/src/browser/mod.rs index 15578ffe5..f0f1b130e 100644 --- a/e2e/src/browser/mod.rs +++ b/e2e/src/browser/mod.rs @@ -55,7 +55,7 @@ pub enum Error { /// Shortcut for a [`Result`] with an [`Error`](enum@Error) inside. /// /// [`Result`]: std::result::Result -#[allow(clippy::absolute_paths)] // intentional +#[expect(clippy::absolute_paths, reason = "one liner")] type Result = std::result::Result; /// [WebDriver] handle of a browser window. diff --git a/e2e/src/lib.rs b/e2e/src/lib.rs index bea3bb96d..690d36496 100644 --- a/e2e/src/lib.rs +++ b/e2e/src/lib.rs @@ -13,10 +13,13 @@ #![forbid(non_ascii_idents)] #![warn( clippy::absolute_paths, + clippy::allow_attributes, + clippy::allow_attributes_without_reason, clippy::as_conversions, clippy::as_ptr_cast_mut, clippy::assertions_on_result_states, clippy::branches_sharing_code, + clippy::cfg_not_test, clippy::clear_with_drain, clippy::clone_on_ref_ptr, clippy::collection_is_never_read, @@ -87,6 +90,7 @@ clippy::rest_pat_in_fully_bound_structs, clippy::same_name_method, clippy::semicolon_inside_block, + clippy::set_contains_or_insert, clippy::shadow_unrelated, clippy::significant_drop_in_scrutinee, clippy::significant_drop_tightening, @@ -147,8 +151,11 @@ unused_results, variant_size_differences )] -// This is OK for testing crate. -#![allow(clippy::unwrap_used, unused_crate_dependencies)] // intentional +#![expect( // intentional + clippy::unwrap_used, + unused_crate_dependencies, + reason = "OK for testing crate" +)] pub mod browser; pub mod object; diff --git a/e2e/src/object/mod.rs b/e2e/src/object/mod.rs index 640d1c664..1d6db71d9 100644 --- a/e2e/src/object/mod.rs +++ b/e2e/src/object/mod.rs @@ -45,7 +45,8 @@ pub enum AwaitCompletion { } /// Pointer to a JS object on a browser's side. -#[allow(clippy::module_name_repetitions)] // TODO: Refactor? +// TODO: Needs refactoring. +#[expect(clippy::module_name_repetitions, reason = "needs refactoring")] #[derive(Clone, Debug, Display)] pub struct ObjectPtr(String); @@ -96,7 +97,7 @@ impl Drop for Object { impl Object { /// Returns a new [`Object`] with the provided ID and [`browser::Window`]. #[must_use] - pub fn new(id: String, window: browser::Window) -> Self { + pub const fn new(id: String, window: browser::Window) -> Self { Self { ptr: ObjectPtr(id), window, diff --git a/e2e/src/object/remote_track.rs b/e2e/src/object/remote_track.rs index 7207d42e8..f23401208 100644 --- a/e2e/src/object/remote_track.rs +++ b/e2e/src/object/remote_track.rs @@ -23,7 +23,7 @@ pub enum MediaDirection { impl From for u8 { // TODO: Generate by derive? - #[allow(clippy::as_conversions)] // it's safe conversion + #[expect(clippy::as_conversions, reason = "safe conversion")] fn from(d: MediaDirection) -> Self { d as Self } diff --git a/e2e/tests/control.rs b/e2e/tests/control.rs index fbaab2f1b..d7285d7fb 100644 --- a/e2e/tests/control.rs +++ b/e2e/tests/control.rs @@ -13,7 +13,7 @@ pub enum Error { Reqwest(reqwest::Error), } -#[allow(clippy::absolute_paths)] // intentional +#[expect(clippy::absolute_paths, reason = "one liner")] type Result = std::result::Result; /// Client of a Control API. diff --git a/mock/control-api/Cargo.toml b/mock/control-api/Cargo.toml index 70d85c2be..ecb902d4e 100644 --- a/mock/control-api/Cargo.toml +++ b/mock/control-api/Cargo.toml @@ -2,7 +2,7 @@ name = "medea-control-api-mock" version = "0.2.1" edition = "2021" -rust-version = "1.75" +rust-version = "1.81" description = "RESTful mock server for Medea's Control API." authors = ["Instrumentisto Team "] license = "BlueOak-1.0.0" diff --git a/mock/control-api/src/api/endpoint.rs b/mock/control-api/src/api/endpoint.rs index 731ccd44f..27247e8cc 100644 --- a/mock/control-api/src/api/endpoint.rs +++ b/mock/control-api/src/api/endpoint.rs @@ -277,7 +277,7 @@ impl Endpoint { } } -#[allow(clippy::fallible_impl_from, clippy::unwrap_used)] // intentional +#[expect(clippy::fallible_impl_from, clippy::unwrap_used, reason = "unrelated")] impl From for Endpoint { fn from(proto: proto::member::Element) -> Self { match proto.el.unwrap() { diff --git a/mock/control-api/src/api/member.rs b/mock/control-api/src/api/member.rs index e6070fee7..8ee45c3b7 100644 --- a/mock/control-api/src/api/member.rs +++ b/mock/control-api/src/api/member.rs @@ -51,7 +51,10 @@ pub struct Member { impl Member { /// Converts [`Member`] into protobuf [`proto::Member`]. - #[allow(clippy::missing_panics_doc)] // intentional + #[expect( // intentional + clippy::missing_panics_doc, + reason = "`Duration` values are not expected to be large" + )] #[must_use] pub fn into_proto(self, member_id: String) -> proto::Member { let member_elements = self @@ -60,9 +63,10 @@ impl Member { .map(|(id, endpoint)| (id.clone(), endpoint.into_proto(id))) .collect(); - // PANIC: Unwrapping `Duration` conversion is OK here, because its - // values are not expected to be large. - #[allow(clippy::unwrap_used)] + #[expect( // intentional + clippy::unwrap_used, + reason = "`Duration` values are not expected to be large" + )] proto::Member { pipeline: member_elements, id: member_id, diff --git a/mock/control-api/src/api/mod.rs b/mock/control-api/src/api/mod.rs index 08aded995..b51bcfcf0 100644 --- a/mock/control-api/src/api/mod.rs +++ b/mock/control-api/src/api/mod.rs @@ -161,7 +161,8 @@ macro_rules! gen_request_macro { /// # Errors /// /// Errors if unable to send message to [`GrpcCallbackServer`] actor. -#[allow(clippy::missing_panics_doc, clippy::needless_pass_by_value)] +// TODO: Needs refactoring. +#[expect(clippy::missing_panics_doc, reason = "needs refactoring")] pub async fn get_callbacks( state: Data, ) -> Result { @@ -178,7 +179,6 @@ pub async fn get_callbacks( /// Implementation of `Delete` requests to [Control API] mock. /// /// [Control API]: https://tinyurl.com/yxsqplq7 -#[allow(clippy::needless_pass_by_value)] mod delete { use super::{AppContext, Data, HttpResponse, Path, Response}; @@ -192,7 +192,6 @@ mod delete { /// Implementation of `Get` requests to [Control API] mock. /// /// [Control API]: https://tinyurl.com/yxsqplq7 -#[allow(clippy::needless_pass_by_value)] mod get { use super::{AppContext, Data, HttpResponse, Path, SingleGetResponse}; @@ -206,7 +205,6 @@ mod get { /// Implementation of `Post` requests to [Control API] mock. /// /// [Control API]: https://tinyurl.com/yxsqplq7 -#[allow(clippy::needless_pass_by_value)] mod create { use super::{ AppContext, CreateResponse, Data, Element, Fid, HttpError, @@ -441,7 +439,7 @@ impl Element { } } -#[allow(clippy::fallible_impl_from)] // intentional +#[expect(clippy::fallible_impl_from, reason = "unrelated")] impl From for Element { fn from(proto: proto::Element) -> Self { use proto::element::El; @@ -459,7 +457,7 @@ impl From for Element { } } -#[allow(clippy::fallible_impl_from)] // intentional +#[expect(clippy::fallible_impl_from, reason = "unrelated")] impl From for Element { fn from(proto: proto::room::Element) -> Self { match proto.el.unwrap() { diff --git a/mock/control-api/src/api/room.rs b/mock/control-api/src/api/room.rs index c0c6682df..72887862d 100644 --- a/mock/control-api/src/api/room.rs +++ b/mock/control-api/src/api/room.rs @@ -57,15 +57,18 @@ impl RoomElement { } } -#[allow(clippy::fallible_impl_from, clippy::unwrap_used)] // intentional +#[expect( // unimplemented + clippy::fallible_impl_from, clippy::unwrap_used, + reason = "unimplemented" +)] impl From for RoomElement { fn from(proto: proto::room::Element) -> Self { match proto.el.unwrap() { proto::room::element::El::Member(member) => { Self::Member(member.into()) } - proto::room::element::El::WebrtcPlay(_) - | proto::room::element::El::WebrtcPub(_) => unimplemented!(), + proto::room::element::El::WebrtcPlay(..) + | proto::room::element::El::WebrtcPub(..) => unimplemented!(), } } } diff --git a/mock/control-api/src/api/ws.rs b/mock/control-api/src/api/ws.rs index c7a1108f9..435bf50f6 100644 --- a/mock/control-api/src/api/ws.rs +++ b/mock/control-api/src/api/ws.rs @@ -30,7 +30,6 @@ use crate::{ /// Errors if handshake fails for any underlying reason. /// /// [WebSocket]: https://en.wikipedia.org/wiki/WebSocket -#[allow(clippy::unused_async)] // required by `actix_web` pub async fn create_ws( request: HttpRequest, path: Path, @@ -81,7 +80,7 @@ enum NotificationVariants<'a> { impl Notification { /// Builds `method: Created` [`Notification`]. - #[allow(clippy::missing_panics_doc)] // intentional + #[expect(clippy::missing_panics_doc, reason = "serialization")] #[must_use] pub fn created(fid: &Fid, element: &Element) -> Self { Self( @@ -94,7 +93,7 @@ impl Notification { } /// Builds `method: Deleted` [`Notification`]. - #[allow(clippy::missing_panics_doc)] // intentional + #[expect(clippy::missing_panics_doc, reason = "serialization")] #[must_use] pub fn deleted(fid: &Fid) -> Self { Self( @@ -106,7 +105,7 @@ impl Notification { } /// Builds `method: Broadcast` [`Notification`]. - #[allow(clippy::missing_panics_doc)] // intentional + #[expect(clippy::missing_panics_doc, reason = "serialization")] #[must_use] pub fn broadcast(payload: Value) -> Self { Self( diff --git a/mock/control-api/src/callback/mod.rs b/mock/control-api/src/callback/mod.rs index 645226037..100c526e3 100644 --- a/mock/control-api/src/callback/mod.rs +++ b/mock/control-api/src/callback/mod.rs @@ -42,7 +42,7 @@ pub struct CallbackItem { pub at: String, } -#[allow(clippy::fallible_impl_from)] // intentional +#[expect(clippy::fallible_impl_from, reason = "unrelated")] impl From for CallbackItem { fn from(proto: proto::Request) -> Self { Self { diff --git a/mock/control-api/src/callback/server.rs b/mock/control-api/src/callback/server.rs index 5cd049d51..213fcfb15 100644 --- a/mock/control-api/src/callback/server.rs +++ b/mock/control-api/src/callback/server.rs @@ -46,7 +46,7 @@ impl GrpcCallbackService { /// Returns [`GrpcCallbackService`] with provided pointer to [`Vec`] of /// [`CallbackItem`]s. #[must_use] - pub fn new(events: CallbackItems) -> Self { + pub const fn new(events: CallbackItems) -> Self { Self { events } } } diff --git a/mock/control-api/src/client.rs b/mock/control-api/src/client.rs index 125003399..ad7366efa 100644 --- a/mock/control-api/src/client.rs +++ b/mock/control-api/src/client.rs @@ -28,8 +28,7 @@ pub struct Fid(String); impl Fid { /// Returns `Room`'s ID from this [`Fid`]. fn room_id(&self) -> &str { - // PANIC: Slicing is OK here, as the index is taken from the source. - #[allow(clippy::string_slice)] // intentional + #[expect(clippy::string_slice, reason = "index is taken from source")] self.0.find('/').map_or(self.0.as_str(), |i| &self.0[..i]) } } @@ -127,7 +126,7 @@ impl ControlClient { /// # Errors /// /// Errors if gRPC request fails. - #[allow(clippy::missing_panics_doc)] + #[expect(clippy::missing_panics_doc, reason = "locking")] pub async fn create( &self, id: String, @@ -221,7 +220,7 @@ impl ControlClient { /// # Errors /// /// Errors if gRPC request fails. - #[allow(clippy::missing_panics_doc)] + #[expect(clippy::missing_panics_doc, reason = "locking")] pub async fn delete(&self, fid: Fid) -> Result { let req = id_request(vec![fid.clone().into()]); let response = self.get_client().delete(tonic::Request::new(req)).await; diff --git a/mock/control-api/src/lib.rs b/mock/control-api/src/lib.rs index b1b3dd6ed..f4327592a 100644 --- a/mock/control-api/src/lib.rs +++ b/mock/control-api/src/lib.rs @@ -9,10 +9,13 @@ #![forbid(non_ascii_idents)] #![warn( clippy::absolute_paths, + clippy::allow_attributes, + clippy::allow_attributes_without_reason, clippy::as_conversions, clippy::as_ptr_cast_mut, clippy::assertions_on_result_states, clippy::branches_sharing_code, + clippy::cfg_not_test, clippy::clear_with_drain, clippy::clone_on_ref_ptr, clippy::collection_is_never_read, @@ -83,6 +86,7 @@ clippy::rest_pat_in_fully_bound_structs, clippy::same_name_method, clippy::semicolon_inside_block, + clippy::set_contains_or_insert, clippy::shadow_unrelated, clippy::significant_drop_in_scrutinee, clippy::significant_drop_tightening, @@ -144,11 +148,12 @@ variant_size_differences )] // TODO: Needs refactoring. -#![allow( +#![expect( clippy::module_name_repetitions, clippy::unimplemented, clippy::unwrap_used, - unreachable_pub + unreachable_pub, + reason = "needs refactoring" )] pub mod api; diff --git a/mock/control-api/src/main.rs b/mock/control-api/src/main.rs index ecd6e5def..170ac9f85 100644 --- a/mock/control-api/src/main.rs +++ b/mock/control-api/src/main.rs @@ -9,10 +9,13 @@ #![forbid(non_ascii_idents)] #![warn( clippy::absolute_paths, + clippy::allow_attributes, + clippy::allow_attributes_without_reason, clippy::as_conversions, clippy::as_ptr_cast_mut, clippy::assertions_on_result_states, clippy::branches_sharing_code, + clippy::cfg_not_test, clippy::clear_with_drain, clippy::clone_on_ref_ptr, clippy::collection_is_never_read, @@ -83,6 +86,7 @@ clippy::rest_pat_in_fully_bound_structs, clippy::same_name_method, clippy::semicolon_inside_block, + clippy::set_contains_or_insert, clippy::shadow_unrelated, clippy::significant_drop_in_scrutinee, clippy::significant_drop_tightening, @@ -143,7 +147,7 @@ unused_results, variant_size_differences )] -#![allow(unused_crate_dependencies)] +#![expect(unused_crate_dependencies, reason = "used by lib")] fn main() { medea_control_api_mock::run(); diff --git a/proto/client-api/Cargo.toml b/proto/client-api/Cargo.toml index 78f22120c..6dff07c20 100644 --- a/proto/client-api/Cargo.toml +++ b/proto/client-api/Cargo.toml @@ -2,7 +2,7 @@ name = "medea-client-api-proto" version = "0.6.1" edition = "2021" -rust-version = "1.75" +rust-version = "1.81" description = "Client API protocol implementation for Medea media server." authors = ["Instrumentisto Team "] license = "BlueOak-1.0.0" diff --git a/proto/client-api/src/lib.rs b/proto/client-api/src/lib.rs index 42c64352d..142f76123 100644 --- a/proto/client-api/src/lib.rs +++ b/proto/client-api/src/lib.rs @@ -11,10 +11,13 @@ #![forbid(non_ascii_idents, unsafe_code)] #![warn( clippy::absolute_paths, + clippy::allow_attributes, + clippy::allow_attributes_without_reason, clippy::as_conversions, clippy::as_ptr_cast_mut, clippy::assertions_on_result_states, clippy::branches_sharing_code, + clippy::cfg_not_test, clippy::clear_with_drain, clippy::clone_on_ref_ptr, clippy::collection_is_never_read, @@ -85,6 +88,7 @@ clippy::rest_pat_in_fully_bound_structs, clippy::same_name_method, clippy::semicolon_inside_block, + clippy::set_contains_or_insert, clippy::shadow_unrelated, clippy::significant_drop_in_scrutinee, clippy::significant_drop_tightening, @@ -217,12 +221,15 @@ impl_incrementable!(PeerId); #[cfg(feature = "server")] impl_incrementable!(TrackId); -#[allow(variant_size_differences)] +/// Message sent by Media Server to Web Client. +#[cfg_attr( + target_family = "wasm", + expect(variant_size_differences, reason = "`Event` is the most common") +)] +#[derive(Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "client", derive(Deserialize))] #[cfg_attr(feature = "server", derive(Serialize))] -#[derive(Clone, Debug, Eq, PartialEq)] #[serde(tag = "msg", content = "data")] -/// Message sent by Media Server to Web Client. pub enum ServerMsg { /// `ping` message that Media Server is expected to send to Web Client /// periodically for probing its aliveness. @@ -243,11 +250,14 @@ pub enum ServerMsg { RpcSettings(RpcSettings), } -#[allow(variant_size_differences)] +/// Message by Web Client to Media Server. +#[cfg_attr( + target_family = "wasm", + expect(variant_size_differences, reason = "`Command` is the most common") +)] +#[derive(Clone, Debug, PartialEq)] #[cfg_attr(feature = "client", derive(Serialize))] #[cfg_attr(feature = "server", derive(Deserialize))] -#[derive(Clone, Debug, PartialEq)] -/// Message by Web Client to Media Server. pub enum ClientMsg { /// `pong` message that Web Client answers with to Media Server in response /// to received [`ServerMsg::Ping`]. @@ -370,7 +380,6 @@ pub enum Command { } /// Web Client's `PeerConnection` metrics. -#[allow(variant_size_differences)] #[cfg_attr(feature = "client", derive(Serialize))] #[cfg_attr(feature = "server", derive(Deserialize))] #[derive(Clone, Debug, PartialEq)] @@ -735,7 +744,6 @@ pub enum ConnectionMode { } /// [`Track`] update which should be applied to the `Peer`. -#[allow(variant_size_differences)] #[cfg_attr(feature = "client", derive(Deserialize))] #[cfg_attr(feature = "server", derive(Serialize))] #[derive(Clone, Debug, Eq, PartialEq)] diff --git a/proto/client-api/src/stats.rs b/proto/client-api/src/stats.rs index f1d74ce84..7179cb678 100644 --- a/proto/client-api/src/stats.rs +++ b/proto/client-api/src/stats.rs @@ -2,7 +2,8 @@ //! //! [RTCPeerConnection]: https://w3.org/TR/webrtc#dom-rtcpeerconnection -#![allow(clippy::module_name_repetitions)] // TODO: Needs refactoring. +// TODO: Needs refactoring. +#![expect(clippy::module_name_repetitions, reason = "needs refactoring")] use std::{ hash::{Hash, Hasher}, @@ -787,7 +788,10 @@ pub enum SenderStatsKind { /// /// [RTCRtpReceiver]: https://w3.org/TR/webrtc#dom-rtcrtpreceiver /// [1]: https://w3.org/TR/webrtc-stats/#dom-rtcstatstype-receiver -#[allow(clippy::empty_enum_variants_with_brackets)] // required by `serde` +#[expect( // required by `serde` + clippy::empty_enum_variants_with_brackets, + reason = "required by `serde`" +)] #[serde_with::skip_serializing_none] #[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] #[serde(tag = "kind", rename_all = "camelCase")] diff --git a/proto/control-api/Cargo.toml b/proto/control-api/Cargo.toml index e04bc0b56..6cccc8448 100644 --- a/proto/control-api/Cargo.toml +++ b/proto/control-api/Cargo.toml @@ -2,7 +2,7 @@ name = "medea-control-api-proto" version = "0.12.1" edition = "2021" -rust-version = "1.75" +rust-version = "1.81" description = "Control API protocol implementation for Medea media server." authors = ["Instrumentisto Team "] license = "BlueOak-1.0.0" diff --git a/proto/control-api/build.rs b/proto/control-api/build.rs index 9e782c0c1..5c3f611e3 100644 --- a/proto/control-api/build.rs +++ b/proto/control-api/build.rs @@ -11,10 +11,13 @@ #![forbid(non_ascii_idents, unsafe_code)] #![warn( clippy::absolute_paths, + clippy::allow_attributes, + clippy::allow_attributes_without_reason, clippy::as_conversions, clippy::as_ptr_cast_mut, clippy::assertions_on_result_states, clippy::branches_sharing_code, + clippy::cfg_not_test, clippy::clear_with_drain, clippy::clone_on_ref_ptr, clippy::collection_is_never_read, @@ -85,6 +88,7 @@ clippy::rest_pat_in_fully_bound_structs, clippy::same_name_method, clippy::semicolon_inside_block, + clippy::set_contains_or_insert, clippy::shadow_unrelated, clippy::significant_drop_in_scrutinee, clippy::significant_drop_tightening, diff --git a/proto/control-api/src/direct/client.rs b/proto/control-api/src/direct/client.rs index 4a7ff7408..1d2543849 100644 --- a/proto/control-api/src/direct/client.rs +++ b/proto/control-api/src/direct/client.rs @@ -45,7 +45,8 @@ impl CallbackApiServer { } /// Direct in-process [`ControlApi`] client. -#[allow(clippy::module_name_repetitions)] // TODO: Refactor? +// TODO: Needs refactoring. +#[expect(clippy::module_name_repetitions, reason = "needs refactoring")] #[derive(Debug)] pub struct ControlApiClient { /// [`mpsc::UnboundedSender`] to send [`ControlApiRequest`]s to linked diff --git a/proto/control-api/src/direct/server.rs b/proto/control-api/src/direct/server.rs index b8e52553c..fc619f223 100644 --- a/proto/control-api/src/direct/server.rs +++ b/proto/control-api/src/direct/server.rs @@ -13,7 +13,8 @@ use crate::{callback, CallbackApi, ControlApi}; use super::{CallbackApiRequest, ControlApiRequest}; /// Direct in-process [`ControlApi`] server. -#[allow(clippy::module_name_repetitions)] // TODO: Refactor? +// TODO: Needs refactoring. +#[expect(clippy::module_name_repetitions, reason = "needs refactoring")] #[derive(Debug)] pub struct ControlApiServer { /// Inner [`ControlApi`] implementation. diff --git a/proto/control-api/src/grpc/api.rs b/proto/control-api/src/grpc/api.rs index fdf6a8f25..7f74fe06e 100644 --- a/proto/control-api/src/grpc/api.rs +++ b/proto/control-api/src/grpc/api.rs @@ -1,6 +1,5 @@ // This file is @generated by prost-build. /// Request for creating a new `Element` on a media server. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct CreateRequest { /// FID (Full ID) of the parent `Element` to create the provided `Element` in. @@ -13,7 +12,6 @@ pub struct CreateRequest { /// Nested message and enum types in `CreateRequest`. pub mod create_request { /// Spec of the created `Element`. - #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum El { #[prost(message, tag = "2")] @@ -27,7 +25,6 @@ pub mod create_request { } } /// Request with many FIDs (Full IDs) of `Element`s. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct IdRequest { /// List of `Element`s FIDs. @@ -35,7 +32,6 @@ pub struct IdRequest { pub fid: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, } /// Request for applying a spec to an exiting `Element` on a media server. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ApplyRequest { /// FID (full ID) of the parent `Element` to apply the provided spec to. @@ -48,7 +44,6 @@ pub struct ApplyRequest { /// Nested message and enum types in `ApplyRequest`. pub mod apply_request { /// Spec of the `Element` to be applied. - #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum El { #[prost(message, tag = "2")] @@ -66,7 +61,6 @@ pub mod apply_request { /// /// If operation fails then an `Error` will be returned. /// The response is considered successful only if it doesn't contain an `Error`. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Response { /// Error of this `Response`. @@ -77,7 +71,6 @@ pub struct Response { /// /// If operation fails then an `Error` will be returned. /// The response is considered successful only if it doesn't contain an `Error`. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct CreateResponse { /// Hashmap with IDs (key) and URIs (value) of `Element`s, which should be used @@ -97,7 +90,6 @@ pub struct CreateResponse { /// /// If operation fails then an `Error` will be returned. /// The response is considered successful only if it doesn't contain an `Error`. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetResponse { /// Hashmap with IDs (key) and specs (value) of the requested `Elements`. @@ -112,7 +104,6 @@ pub struct GetResponse { /// Error of a failed request. /// /// If an `Error` is not returned then a request is considered as successful. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Error { /// Concrete unique code of this `Error`. @@ -135,7 +126,6 @@ pub struct Error { pub element: ::prost::alloc::string::String, } /// Possible media elements forming a media pipeline. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Element { #[prost(oneof = "element::El", tags = "1, 2, 3, 4")] @@ -143,7 +133,6 @@ pub struct Element { } /// Nested message and enum types in `Element`. pub mod element { - #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum El { #[prost(message, tag = "1")] @@ -158,7 +147,6 @@ pub mod element { } /// Media element representing a single space where multiple `Member`s can /// interact with each other. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Room { /// ID of this `Room`. @@ -174,7 +162,6 @@ pub struct Room { /// Nested message and enum types in `Room`. pub mod room { /// Possible media elements forming a `Room` pipeline. - #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Element { #[prost(oneof = "element::El", tags = "1, 2, 3")] @@ -182,7 +169,6 @@ pub mod room { } /// Nested message and enum types in `Element`. pub mod element { - #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum El { #[prost(message, tag = "1")] @@ -196,7 +182,6 @@ pub mod room { } /// Media element representing a client authorized to participate in some bigger /// media pipeline (`Room`, for example). -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Member { /// ID of this `Member`. @@ -245,7 +230,6 @@ pub struct Member { /// Nested message and enum types in `Member`. pub mod member { /// Elements which Member's pipeline can contain. - #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Element { #[prost(oneof = "element::El", tags = "1, 2")] @@ -253,7 +237,6 @@ pub mod member { } /// Nested message and enum types in `Element`. pub mod element { - #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum El { #[prost(message, tag = "1")] @@ -271,7 +254,6 @@ pub mod member { /// Hashed variant only supports Argon2 hash at the moment. /// `Member` sid won't contain a `token` query parameter if hashed credentials /// are used, so it should be appended manually on a client side. - #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Credentials { /// Argon2 hash of credentials. @@ -284,7 +266,6 @@ pub mod member { } /// Media element receiving media data from a client via WebRTC (allows to /// publish media data). -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct WebRtcPublishEndpoint { /// ID of this `WebRtcPublishEndpoint`. @@ -312,7 +293,6 @@ pub struct WebRtcPublishEndpoint { /// Nested message and enum types in `WebRtcPublishEndpoint`. pub mod web_rtc_publish_endpoint { /// Audio media type settings of a `WebRtcPublishEndpoint`. - #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct AudioSettings { /// Policy to publish the audio media type with. @@ -320,7 +300,6 @@ pub mod web_rtc_publish_endpoint { pub publish_policy: i32, } /// Video media type settings of `WebRtcPublishEndpoint`. - #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct VideoSettings { /// Policy to publish the video media type with. @@ -431,7 +410,6 @@ pub mod web_rtc_publish_endpoint { } } /// Media element playing media data for a client via WebRTC. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct WebRtcPlayEndpoint { /// ID of this `WebRtcPlayEndpoint`. @@ -452,7 +430,6 @@ pub struct WebRtcPlayEndpoint { } /// Ping message received by a media server periodically for probing its /// healthiness. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct Ping { /// Each new `Ping` should increment its nonce, starting with 0. @@ -460,7 +437,6 @@ pub struct Ping { pub nonce: u32, } /// Pong message sent by a media server in response to a received `Ping` message. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct Pong { /// / Nonce of the answered `Ping` message. diff --git a/proto/control-api/src/grpc/callback.rs b/proto/control-api/src/grpc/callback.rs index dd27b22bd..734a74549 100644 --- a/proto/control-api/src/grpc/callback.rs +++ b/proto/control-api/src/grpc/callback.rs @@ -1,6 +1,5 @@ // This file is @generated by prost-build. /// Request with a fired callback event and its meta information. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Request { /// FID (Full ID) of the media `Element`, the occurred event is related to. @@ -16,7 +15,6 @@ pub struct Request { /// Nested message and enum types in `Request`. pub mod request { /// Occurred event. - #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, Copy, PartialEq, ::prost::Oneof)] pub enum Event { #[prost(message, tag = "3")] @@ -29,15 +27,12 @@ pub mod request { /// /// We don't use `google.protobuf.Empty` to be able to add some fields (if /// necessary) in the future. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct Response {} /// Event notifying about a `Member` joining a `Room`. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct OnJoin {} /// Event notifying about a `Member` leaving its `Room`. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct OnLeave { /// Reason of why the `Member` leaves. diff --git a/proto/control-api/src/grpc/convert/api.rs b/proto/control-api/src/grpc/convert/api.rs index adcd63b8c..a47ed2073 100644 --- a/proto/control-api/src/grpc/convert/api.rs +++ b/proto/control-api/src/grpc/convert/api.rs @@ -374,7 +374,7 @@ impl TryFrom for Member { member_id: &str, field: &'static str, ) -> Result, ProtobufError> { - #[allow(clippy::map_err_ignore)] // intentional + #[expect(clippy::map_err_ignore, reason = "not useful")] duration.map(TryInto::try_into).transpose().map_err(|_| { ProtobufError::InvalidDuration(member_id.into(), field) }) @@ -422,9 +422,10 @@ impl TryFrom for Member { impl From for proto::Member { fn from(member: Member) -> Self { - // PANIC: Unwrapping `Duration` conversion is OK here, because its - // values are not expected to be large. - #[allow(clippy::unwrap_used)] // intentional + #[expect( // intentional + clippy::unwrap_used, + reason = " `Duration` values are not expected to be large" + )] Self { id: member.id.into(), on_join: member diff --git a/proto/control-api/src/lib.rs b/proto/control-api/src/lib.rs index e48bd1bdc..34a167437 100644 --- a/proto/control-api/src/lib.rs +++ b/proto/control-api/src/lib.rs @@ -10,10 +10,13 @@ #![forbid(non_ascii_idents, unsafe_code)] #![warn( clippy::absolute_paths, + clippy::allow_attributes, + clippy::allow_attributes_without_reason, clippy::as_conversions, clippy::as_ptr_cast_mut, clippy::assertions_on_result_states, clippy::branches_sharing_code, + clippy::cfg_not_test, clippy::clear_with_drain, clippy::clone_on_ref_ptr, clippy::collection_is_never_read, @@ -84,6 +87,7 @@ clippy::rest_pat_in_fully_bound_structs, clippy::same_name_method, clippy::semicolon_inside_block, + clippy::set_contains_or_insert, clippy::shadow_unrelated, clippy::significant_drop_in_scrutinee, clippy::significant_drop_tightening, @@ -144,7 +148,6 @@ unused_results, variant_size_differences )] -#![allow(clippy::same_name_method)] // uncontrolled names in the generated code pub mod callback; pub mod control; diff --git a/src/api/dart/api/mod.rs b/src/api/dart/api/mod.rs index 2caa78bbc..2dbe03c6f 100644 --- a/src/api/dart/api/mod.rs +++ b/src/api/dart/api/mod.rs @@ -3,37 +3,30 @@ //! //! [Flutter]: https://flutter.dev -#![allow( +// TODO: Needs refactoring. +#![expect( clippy::as_conversions, - clippy::doc_markdown, // because generated code in `#[frb]` macro - clippy::missing_panics_doc, - clippy::needless_pass_by_value, - clippy::undocumented_unsafe_blocks, clippy::unwrap_used, - non_snake_case, + reason = "needs refactoring" )] -#[allow( +#[expect( clippy::absolute_paths, + clippy::allow_attributes_without_reason, clippy::as_conversions, - clippy::default_trait_access, - clippy::let_underscore_untyped, + clippy::cast_lossless, + clippy::cast_possible_truncation, + clippy::cast_possible_wrap, clippy::missing_docs_in_private_items, - clippy::multiple_unsafe_ops_per_block, - clippy::ptr_as_ptr, + clippy::redundant_else, + clippy::significant_drop_tightening, clippy::undocumented_unsafe_blocks, - clippy::empty_structs_with_brackets, clippy::use_self, clippy::wildcard_imports, clippy::unreadable_literal, - let_underscore_drop, unused_qualifications, unit_bindings, - clippy::redundant_else, - clippy::significant_drop_tightening, - clippy::cast_possible_truncation, - clippy::cast_lossless, - clippy::cast_possible_wrap + reason = "codegen" )] #[rustfmt::skip] mod api_bridge_generated; diff --git a/src/api/dart/err.rs b/src/api/dart/err.rs index 444c8094b..749926eb4 100644 --- a/src/api/dart/err.rs +++ b/src/api/dart/err.rs @@ -118,12 +118,12 @@ mod exception { /// Creates and returns a new Dart `NativePanicException`. #[must_use] pub unsafe fn new_panic_error() -> Dart_Handle { - #[allow(clippy::unwrap_used)] + #[expect(clippy::unwrap_used, reason = "FFI error is unexpected")] unsafe { exception::new_panic_exception() }.unwrap() } /// An error that can be returned from Rust to Dart. -#[allow(missing_copy_implementations)] // not trivially copyable +#[expect(missing_copy_implementations, reason = "not trivially copyable")] #[derive(Debug, Into)] #[repr(transparent)] pub struct DartError(ptr::NonNull); @@ -135,11 +135,11 @@ impl DartError { } } -#[allow(clippy::fallible_impl_from)] // intentional +#[expect(clippy::fallible_impl_from, reason = "FFI error is unexpected")] impl From for DartOpaque { fn from(val: DartError) -> Self { let boxed = unsafe { Box::from_raw(val.0.as_ptr()) }; - #[allow(clippy::unwrap_used)] // intentional + #[expect(clippy::unwrap_used, reason = "FFI error is unexpected")] Self::new((*boxed).cast(), unsafe { DART_HANDLER_PORT.unwrap() }) } } @@ -150,10 +150,10 @@ impl From for DartError { } } -#[allow(clippy::fallible_impl_from)] // intentional +#[expect(clippy::fallible_impl_from, reason = "FFI error is unexpected")] impl From for DartError { fn from(err: StateError) -> Self { - #[allow(clippy::unwrap_used)] // intentional + #[expect(clippy::unwrap_used, reason = "FFI error is unexpected")] let exception = unsafe { exception::new_state_error(string_into_c_str(err.message())) } @@ -163,10 +163,10 @@ impl From for DartError { } } -#[allow(clippy::fallible_impl_from)] // intentional +#[expect(clippy::fallible_impl_from, reason = "FFI error is unexpected")] impl From for DartError { fn from(err: LocalMediaInitException) -> Self { - #[allow(clippy::unwrap_used)] // intentional + #[expect(clippy::unwrap_used, reason = "FFI error is unexpected")] let exception = unsafe { exception::new_local_media_init_exception( err.kind() as i64, @@ -181,10 +181,10 @@ impl From for DartError { } } -#[allow(clippy::fallible_impl_from)] // intentional +#[expect(clippy::fallible_impl_from, reason = "FFI error is unexpected")] impl From for DartError { fn from(err: EnumerateDevicesException) -> Self { - #[allow(clippy::unwrap_used)] // intentional + #[expect(clippy::unwrap_used, reason = "FFI error is unexpected")] let exception = unsafe { exception::new_enumerate_devices_exception( err.cause().into(), @@ -197,10 +197,10 @@ impl From for DartError { } } -#[allow(clippy::fallible_impl_from)] // intentional +#[expect(clippy::fallible_impl_from, reason = "FFI error is unexpected")] impl From for DartError { fn from(err: InvalidOutputAudioDeviceIdException) -> Self { - #[allow(clippy::unwrap_used)] // intentional + #[expect(clippy::unwrap_used, reason = "FFI error is unexpected")] let exception = unsafe { exception::new_invalid_output_audio_device_id_exception( string_into_c_str(err.trace()), @@ -212,10 +212,10 @@ impl From for DartError { } } -#[allow(clippy::fallible_impl_from)] // intentional +#[expect(clippy::fallible_impl_from, reason = "FFI error is unexpected")] impl From for DartError { fn from(err: MicVolumeException) -> Self { - #[allow(clippy::unwrap_used)] // intentional + #[expect(clippy::unwrap_used, reason = "FFI error is unexpected")] let exception = unsafe { exception::new_mic_volume_exception( err.cause().into(), @@ -228,10 +228,10 @@ impl From for DartError { } } -#[allow(clippy::fallible_impl_from)] // intentional +#[expect(clippy::fallible_impl_from, reason = "FFI error is unexpected")] impl From for DartError { fn from(err: FormatException) -> Self { - #[allow(clippy::unwrap_used)] // intentional + #[expect(clippy::unwrap_used, reason = "FFI error is unexpected")] let exception = unsafe { exception::new_format_exception(string_into_c_str(err.message())) } @@ -241,10 +241,10 @@ impl From for DartError { } } -#[allow(clippy::fallible_impl_from)] // intentional +#[expect(clippy::fallible_impl_from, reason = "FFI error is unexpected")] impl From for DartError { fn from(err: RpcClientException) -> Self { - #[allow(clippy::unwrap_used)] // intentional + #[expect(clippy::unwrap_used, reason = "FFI error is unexpected")] let exception = unsafe { exception::new_rpc_client_exception( err.kind() as i64, @@ -259,10 +259,10 @@ impl From for DartError { } } -#[allow(clippy::fallible_impl_from)] // intentional +#[expect(clippy::fallible_impl_from, reason = "FFI error is unexpected")] impl From for DartError { fn from(err: MediaStateTransitionException) -> Self { - #[allow(clippy::unwrap_used)] // intentional + #[expect(clippy::unwrap_used, reason = "FFI error is unexpected")] let exception = unsafe { exception::new_media_state_transition_exception( string_into_c_str(err.message()), @@ -276,10 +276,10 @@ impl From for DartError { } } -#[allow(clippy::fallible_impl_from)] // intentional +#[expect(clippy::fallible_impl_from, reason = "FFI error is unexpected")] impl From for DartError { fn from(err: InternalException) -> Self { - #[allow(clippy::unwrap_used)] // intentional + #[expect(clippy::unwrap_used, reason = "FFI error is unexpected")] let exception = unsafe { exception::new_internal_exception( string_into_c_str(err.message()), @@ -293,10 +293,10 @@ impl From for DartError { } } -#[allow(clippy::fallible_impl_from)] // intentional +#[expect(clippy::fallible_impl_from, reason = "FFI error is unexpected")] impl From for DartError { fn from(err: MediaSettingsUpdateException) -> Self { - #[allow(clippy::unwrap_used)] // intentional + #[expect(clippy::unwrap_used, reason = "FFI error is unexpected")] let exception = unsafe { exception::new_media_settings_update_exception( string_into_c_str(err.message()), diff --git a/src/api/dart/mod.rs b/src/api/dart/mod.rs index 2c22ecb42..2f3bc71e6 100644 --- a/src/api/dart/mod.rs +++ b/src/api/dart/mod.rs @@ -4,12 +4,13 @@ //! [Flutter]: https://flutter.dev // TODO: Improve documentation in this module. -#![allow( +#![expect( clippy::as_conversions, clippy::missing_safety_doc, clippy::missing_panics_doc, clippy::undocumented_unsafe_blocks, - missing_docs + missing_docs, + reason = "needs refactoring" )] pub mod api; @@ -72,7 +73,6 @@ pub enum MemoryOwner { } /// Type-erased value that can be transferred via FFI boundaries to/from Dart. -#[allow(missing_copy_implementations)] // not trivially copyable #[derive(Debug)] #[repr(u8)] pub enum DartValue { @@ -715,12 +715,12 @@ pub unsafe extern "C" fn box_foreign_value( } #[cfg(feature = "mockable")] -#[allow(clippy::missing_docs_in_private_items)] +#[expect(clippy::missing_docs_in_private_items, reason = "for testing only")] mod dart_value_extern_tests_helpers { - use super::*; - use crate::platform::set_panic_hook; + use super::propagate_panic; + #[no_mangle] pub unsafe extern "C" fn fire_panic() { set_panic_hook(); diff --git a/src/api/err.rs b/src/api/err.rs index 7058fca6f..2cf92ad4f 100644 --- a/src/api/err.rs +++ b/src/api/err.rs @@ -1,7 +1,11 @@ //! External API errors. -// For `wasm_bindgen`. -#![allow(clippy::mem_forget, clippy::multiple_inherent_impl)] +// TODO: Try use `#![expect]` on next Rust version upgrade. +#![allow(clippy::multiple_inherent_impl, reason = "`wasm_bindgen` codegen")] +#![cfg_attr( + target_family = "wasm", + expect(clippy::mem_forget, reason = "`wasm_bindgen` codegen") +)] use std::borrow::Cow; @@ -137,10 +141,13 @@ impl LocalMediaInitException { } } +#[expect( // `wasm_bindgen` doesn't support `const fn` + clippy::missing_const_for_fn, + reason = "`wasm_bindgen` doesn't support `const fn`" +)] #[cfg_attr(target_family = "wasm", wasm_bindgen)] impl LocalMediaInitException { /// Returns concrete error kind of this [`LocalMediaInitException`]. - #[allow(clippy::missing_const_for_fn)] // required by `wasm_bindgen` #[must_use] pub fn kind(&self) -> LocalMediaInitExceptionKind { self.kind @@ -318,10 +325,13 @@ impl RpcClientException { } } +#[expect( // `wasm_bindgen` doesn't support `const fn` + clippy::missing_const_for_fn, + reason = "`wasm_bindgen` doesn't support `const fn`" +)] #[cfg_attr(target_family = "wasm", wasm_bindgen)] impl RpcClientException { /// Returns concrete error kind of this [`RpcClientException`]. - #[allow(clippy::missing_const_for_fn)] // required by `wasm_bindgen` #[must_use] pub fn kind(&self) -> RpcClientExceptionKind { self.kind @@ -473,6 +483,10 @@ impl MediaStateTransitionException { } } +#[expect( // `wasm_bindgen` doesn't support `const fn` + clippy::missing_const_for_fn, + reason = "`wasm_bindgen` doesn't support `const fn`" +)] #[cfg_attr(target_family = "wasm", wasm_bindgen)] impl MediaStateTransitionException { /// Returns an error message describing the problem. @@ -488,7 +502,6 @@ impl MediaStateTransitionException { } /// Returns concrete error kind of this [`MediaStateTransitionException`]. - #[allow(clippy::missing_const_for_fn)] // required by `wasm_bindgen` #[must_use] pub fn kind(&self) -> MediaStateTransitionExceptionKind { self.kind @@ -530,6 +543,10 @@ impl MediaSettingsUpdateException { } } +#[expect( // `wasm_bindgen` doesn't support `const fn` + clippy::missing_const_for_fn, + reason = "`wasm_bindgen` doesn't support `const fn`" +)] #[cfg_attr(target_family = "wasm", wasm_bindgen)] impl MediaSettingsUpdateException { /// Returns an error message describing the problem. @@ -547,7 +564,6 @@ impl MediaSettingsUpdateException { /// Returns whether media settings were successfully rolled back after new /// settings application failed. - #[allow(clippy::missing_const_for_fn)] // required by `wasm_bindgen` #[must_use] pub fn rolled_back(&self) -> bool { self.rolled_back diff --git a/src/api/wasm/local_media_track.rs b/src/api/wasm/local_media_track.rs index b6ad2f1f9..a15bad241 100644 --- a/src/api/wasm/local_media_track.rs +++ b/src/api/wasm/local_media_track.rs @@ -41,7 +41,10 @@ impl LocalMediaTrack { /// Returns a [`MediaKind::Audio`] if this [`LocalMediaTrack`] represents an /// audio track, or a [`MediaKind::Video`] if it represents a video track. - #[allow(clippy::as_conversions)] // TODO: Needs refactoring. + // TODO: Try remove on next Rust upgrade. + #[expect(clippy::allow_attributes, reason = "`#[expect]` doesn't work")] + // TODO: Needs refactoring. + #[allow(clippy::as_conversions, reason = "needs refactoring")] pub fn state(&self) -> Promise { let this = self.0.clone(); future_to_promise( diff --git a/src/api/wasm/media_stream_settings.rs b/src/api/wasm/media_stream_settings.rs index 48ff3ba5b..f6f6d9949 100644 --- a/src/api/wasm/media_stream_settings.rs +++ b/src/api/wasm/media_stream_settings.rs @@ -2,7 +2,10 @@ //! //! [1]: https://w3.org/TR/mediacapture-streams#dom-mediastreamconstraints -#![allow(clippy::new_without_default)] +#![expect( // intentional + clippy::new_without_default, + reason = "makes no sense for `wasm_bindgen`" +)] use derive_more::{From, Into}; use wasm_bindgen::prelude::*; diff --git a/src/api/wasm/mod.rs b/src/api/wasm/mod.rs index 0602eceb8..09e1b3b80 100644 --- a/src/api/wasm/mod.rs +++ b/src/api/wasm/mod.rs @@ -3,8 +3,7 @@ //! //! [`Jason`]: crate::api::Jason -// For `wasm_bindgen`. -#![allow(clippy::mem_forget)] +#![expect(clippy::mem_forget, reason = "`wasm_bindgen` codegen")] pub mod connection_handle; pub mod err; diff --git a/src/api/wasm/room_close_reason.rs b/src/api/wasm/room_close_reason.rs index 7bbf0e5b8..b4a7a37b9 100644 --- a/src/api/wasm/room_close_reason.rs +++ b/src/api/wasm/room_close_reason.rs @@ -17,7 +17,10 @@ use crate::room; #[derive(Debug, From)] pub struct RoomCloseReason(room::RoomCloseReason); -#[allow(clippy::missing_const_for_fn)] // required by `wasm_bindgen` +#[expect( // `wasm_bindgen` doesn't support `const fn` + clippy::missing_const_for_fn, + reason = "`wasm_bindgen` doesn't support `const fn`" +)] #[wasm_bindgen] impl RoomCloseReason { /// Returns the [`Room`]'s close reason. diff --git a/src/connection.rs b/src/connection.rs index 10c9caadc..8825e1e2b 100644 --- a/src/connection.rs +++ b/src/connection.rs @@ -74,7 +74,6 @@ pub struct Connections { room_recv_constraints: Rc, /// Callback invoked on remote `Member` media arrival. - #[cfg_attr(not(target_family = "wasm"), allow(unused_qualifications))] on_new_connection: platform::Callback, } @@ -92,7 +91,6 @@ impl Connections { /// Sets callback, which will be invoked when new [`Connection`] is /// established. - #[cfg_attr(not(target_family = "wasm"), allow(unused_qualifications))] pub fn on_new_connection( &self, f: platform::Function, @@ -192,7 +190,7 @@ impl Connections { ) -> Vec { let mut connections = self.connections.borrow_mut(); - #[allow(clippy::iter_over_hash_type)] // order doesn't matter here + #[expect(clippy::iter_over_hash_type, reason = "order doesn't matter")] for partner in partner_members { _ = self .members_to_tracks @@ -231,7 +229,7 @@ impl Connections { let mut tracks = self.tracks.borrow_mut(); if let Some(partners) = tracks.remove(track_id) { - #[allow(clippy::iter_over_hash_type)] // order doesn't matter here + #[expect(clippy::iter_over_hash_type, reason = "doesn't matter")] for p in partners { if let Some(member_tracks) = self.members_to_tracks.borrow_mut().get_mut(&p) @@ -257,7 +255,7 @@ impl Connections { /// Updates this [`Connection`] with the provided [`proto::state::Room`]. pub fn apply(&self, new_state: &proto::state::Room) { - #[allow(clippy::iter_over_hash_type)] // order doesn't matter here + #[expect(clippy::iter_over_hash_type, reason = "order doesn't matter")] for peer in new_state.peers.values() { for (track_id, sender) in &peer.senders { if let Some(partners) = self.tracks.borrow().get(track_id) { @@ -651,7 +649,7 @@ impl Connection { pub fn update_quality_score(&self, score: ConnectionQualityScore) { if self.0.quality_score.replace(Some(score)) != Some(score) { // TODO: Replace with derive? - #[allow(clippy::as_conversions)] // intentional + #[expect(clippy::as_conversions, reason = "needs refactoring")] self.0.on_quality_score_update.call1(score as u8); } } diff --git a/src/lib.rs b/src/lib.rs index 06cd10792..a3a4db3f8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -9,10 +9,13 @@ #![forbid(non_ascii_idents)] #![warn( clippy::absolute_paths, + clippy::allow_attributes, + clippy::allow_attributes_without_reason, clippy::as_conversions, clippy::as_ptr_cast_mut, clippy::assertions_on_result_states, clippy::branches_sharing_code, + clippy::cfg_not_test, clippy::clear_with_drain, clippy::clone_on_ref_ptr, clippy::collection_is_never_read, @@ -83,6 +86,7 @@ clippy::rest_pat_in_fully_bound_structs, clippy::same_name_method, clippy::semicolon_inside_block, + clippy::set_contains_or_insert, clippy::shadow_unrelated, clippy::significant_drop_in_scrutinee, clippy::significant_drop_tightening, @@ -143,14 +147,16 @@ unused_results, variant_size_differences )] -#![cfg_attr(feature = "mockable", allow(missing_docs))] +#![cfg_attr( + feature = "mockable", + expect(missing_docs, reason = "for testing only") +)] // TODO: Needs refactoring. -#![allow( +#![expect( clippy::module_name_repetitions, clippy::unimplemented, - clippy::unnecessary_safety_comment, - clippy::unnecessary_safety_doc, - unreachable_pub + unreachable_pub, + reason = "needs refactoring" )] #[macro_use] diff --git a/src/media/constraints.rs b/src/media/constraints.rs index 6a62eab18..aca8d97e4 100644 --- a/src/media/constraints.rs +++ b/src/media/constraints.rs @@ -842,7 +842,7 @@ impl VideoSource { /// /// If this [`VideoSource`] is important then without this [`VideoSource`] /// call session can't be started. - #[allow(clippy::use_self)] // because of `const` only + #[expect(clippy::use_self, reason = "because of `const` only")] #[must_use] pub const fn required(&self) -> bool { match self { @@ -918,7 +918,7 @@ impl TrackConstraints { /// /// If these [`TrackConstraints`] are important then without them a session /// call can't be started. - #[allow(clippy::use_self)] // because of `const` only + #[expect(clippy::use_self, reason = "because of `const` only")] #[must_use] pub const fn required(&self) -> bool { match self { @@ -928,27 +928,27 @@ impl TrackConstraints { } /// Returns these [`TrackConstraints`] media source kind. - #[allow(clippy::use_self)] // because of `const` only + #[expect(clippy::use_self, reason = "because of `const` only")] #[must_use] pub const fn media_source_kind(&self) -> MediaSourceKind { match &self { - TrackConstraints::Audio(_) => MediaSourceKind::Device, - TrackConstraints::Video(VideoSource::Device(_)) => { + TrackConstraints::Audio(..) => MediaSourceKind::Device, + TrackConstraints::Video(VideoSource::Device(..)) => { MediaSourceKind::Device } - TrackConstraints::Video(VideoSource::Display(_)) => { + TrackConstraints::Video(VideoSource::Display(..)) => { MediaSourceKind::Display } } } /// Returns [`MediaKind`] of these [`TrackConstraints`]. - #[allow(clippy::use_self)] // because of `const` only + #[expect(clippy::use_self, reason = "because of `const` only")] #[must_use] pub const fn media_kind(&self) -> MediaKind { match &self { - TrackConstraints::Audio(_) => MediaKind::Audio, - TrackConstraints::Video(_) => MediaKind::Video, + TrackConstraints::Audio(..) => MediaKind::Audio, + TrackConstraints::Video(..) => MediaKind::Video, } } } diff --git a/src/media/manager.rs b/src/media/manager.rs index 219c886f2..77a9bca38 100644 --- a/src/media/manager.rs +++ b/src/media/manager.rs @@ -136,7 +136,7 @@ impl From for GetUserMediaError { /// Error occurring when [getDisplayMedia()][1] request fails. /// /// [1]: https://w3.org/TR/screen-capture#dom-mediadevices-getdisplaymedia -#[allow(variant_size_differences)] // `Box`ing still reports this +#[expect(variant_size_differences, reason = "`Box`ing still reports this")] #[derive(Caused, Clone, Debug, Display, From)] #[cause(error = platform::Error)] pub enum GetDisplayMediaError { @@ -301,9 +301,10 @@ impl InnerMediaManager { .borrow_mut() .retain(|_, track| Weak::strong_count(track) > 0); - // PANIC: It's OK to unwrap `Weak` here as we have cleaned the absent - // ones in the line above. - #[allow(clippy::unwrap_used)] // intentional + #[expect( // intentional + clippy::unwrap_used, + reason = "absent ones are cleaned in the line above" + )] let storage: Vec<_> = self .tracks .borrow() @@ -428,7 +429,7 @@ impl InnerMediaManager { &self, device_id: String, ) -> Result<(), Traced> { - #[allow(clippy::map_err_ignore)] // intentional + #[expect(clippy::map_err_ignore, reason = "not useful")] self.media_devices .set_output_audio_id(device_id) .await diff --git a/src/media/track/local.rs b/src/media/track/local.rs index 8bd4a8407..bc5c29a01 100644 --- a/src/media/track/local.rs +++ b/src/media/track/local.rs @@ -88,7 +88,10 @@ impl Track { } /// Returns this [`Track`]'s kind (audio/video). - #[allow(clippy::missing_const_for_fn)] // not all platforms allow this + #[cfg_attr( + target_family = "wasm", + expect(clippy::missing_const_for_fn, reason = "not on all platforms") + )] #[must_use] pub fn kind(&self) -> MediaKind { self.track.kind() @@ -148,7 +151,7 @@ pub struct LocalMediaTrack(Rc); impl LocalMediaTrack { /// Creates a new [`LocalMediaTrack`] from the provided [`Track`]. #[must_use] - pub fn new(track: Rc) -> Self { + pub const fn new(track: Rc) -> Self { Self(track) } diff --git a/src/media/track/remote.rs b/src/media/track/remote.rs index d558c5d16..8b3fbb109 100644 --- a/src/media/track/remote.rs +++ b/src/media/track/remote.rs @@ -32,7 +32,10 @@ struct Inner { /// Callback to be invoked whenever this [`Track`]'s general /// [`MediaDirection`] is changed. - #[allow(unused_qualifications)] + #[cfg_attr( + not(target_family = "wasm"), + expect(unused_qualifications, reason = "`cfg` code uniformity") + )] on_media_direction_changed: platform::Callback, /// Current general [`MediaDirection`] of this [`Track`]. @@ -189,7 +192,10 @@ impl Track { /// Sets callback to be invoked whenever this [`Track`]'s general /// [`MediaDirection`] is changed. - #[allow(unused_qualifications)] + #[cfg_attr( + not(target_family = "wasm"), + expect(unused_qualifications, reason = "`cfg` code uniformity") + )] pub fn on_media_direction_changed( &self, callback: platform::Function, diff --git a/src/peer/component/mod.rs b/src/peer/component/mod.rs index c03c84481..56a879eae 100644 --- a/src/peer/component/mod.rs +++ b/src/peer/component/mod.rs @@ -487,7 +487,7 @@ impl SynchronizableState for State { input.connection_mode, ); - #[allow(clippy::iter_over_hash_type)] // order doesn't matter here + #[expect(clippy::iter_over_hash_type, reason = "order doesn't matter")] for (id, sender) in input.senders { if !sender.receivers.is_empty() { state.senders.insert( @@ -499,7 +499,7 @@ impl SynchronizableState for State { ); } } - #[allow(clippy::iter_over_hash_type)] // order doesn't matter here + #[expect(clippy::iter_over_hash_type, reason = "order doesn't matter")] for (id, receiver) in input.receivers { state.receivers.insert( id, @@ -509,7 +509,7 @@ impl SynchronizableState for State { )), ); } - #[allow(clippy::iter_over_hash_type)] // order doesn't matter here + #[expect(clippy::iter_over_hash_type, reason = "order doesn't matter")] for ice_candidate in input.ice_candidates { state.ice_candidates.add(ice_candidate); } @@ -567,7 +567,9 @@ impl Updatable for State { } #[cfg(feature = "mockable")] -#[allow(clippy::multiple_inherent_impl)] +// TODO: Try remove on next Rust version upgrade. +#[expect(clippy::allow_attributes, reason = "`#[expect]` is not considered")] +#[allow(clippy::multiple_inherent_impl, reason = "feature gated")] impl State { /// Waits for a [`State::remote_sdp`] change to be applied. pub async fn when_remote_sdp_processed(&self) { diff --git a/src/peer/component/tracks_repository.rs b/src/peer/component/tracks_repository.rs index b0dfa8084..71bd5a46d 100644 --- a/src/peer/component/tracks_repository.rs +++ b/src/peer/component/tracks_repository.rs @@ -160,7 +160,7 @@ where fn apply(&self, input: Self::Input, send_cons: &LocalTracksConstraints) { self.0.borrow_mut().remove_not_present(&input); - #[allow(clippy::iter_over_hash_type)] // order doesn't matter here + #[expect(clippy::iter_over_hash_type, reason = "order doesn't matter")] for (id, track) in input { if let Some(sync_track) = self.0.borrow().get(&id) { sync_track.apply(track, send_cons); @@ -245,7 +245,9 @@ impl TracksRepository { } #[cfg(feature = "mockable")] -#[allow(clippy::multiple_inherent_impl)] +// TODO: Try remove on next Rust version upgrade. +#[expect(clippy::allow_attributes, reason = "`#[expect]` is not considered")] +#[allow(clippy::multiple_inherent_impl, reason = "feature gated")] impl TracksRepository { /// Sets [`SyncState`] of all [`sender::State`]s to the /// [`SyncState::Synced`]. diff --git a/src/peer/component/watchers.rs b/src/peer/component/watchers.rs index cc33e9f25..d9872f096 100644 --- a/src/peer/component/watchers.rs +++ b/src/peer/component/watchers.rs @@ -171,13 +171,12 @@ impl Component { peer.track_events_sender.clone(), ) .await - .map_err(|e| { + .inspect_err(|e| { drop(peer.peer_events_sender.unbounded_send( PeerEvent::FailedLocalMedia { error: tracerr::map_from(e.clone()), }, )); - e }) .map_err(tracerr::map_from_and_wrap!())?; peer.media_connections @@ -225,7 +224,6 @@ impl Component { /// Watcher for the [`State::connections`] insert update. /// /// Creates a new [`Connection`] for the given [`PeerConnection`]. - #[allow(clippy::needless_pass_by_value)] // required by macro #[watch( self.maybe_update_connections.subscribe().filter_map(future::ready) )] diff --git a/src/peer/media/mod.rs b/src/peer/media/mod.rs index e30bc0d2a..0c0f1e310 100644 --- a/src/peer/media/mod.rs +++ b/src/peer/media/mod.rs @@ -281,7 +281,7 @@ pub async fn probe_video_codecs( } } if !target_codecs.is_empty() { - #[allow(clippy::iter_over_hash_type)] // order doesn't matter here + #[expect(clippy::iter_over_hash_type, reason = "order doesn't matter")] for (mime, mut c) in codecs { if REQUIRED_CODECS.contains(&mime.as_str()) { target_codecs.append(&mut c); @@ -372,7 +372,7 @@ impl InnerMediaConnections { /// Returns all [`TransceiverSide`]s by provided [`TrackDirection`], /// [`MediaKind`] and [`MediaSourceKind`]. - #[allow(clippy::as_conversions)] + #[expect(clippy::as_conversions, reason = "no other way")] fn get_transceivers_by_direction_and_kind( &self, direction: TrackDirection, @@ -533,7 +533,7 @@ impl MediaConnections { let inner = self.0.borrow(); let mut mids = HashMap::with_capacity(inner.senders.len() + inner.receivers.len()); - #[allow(clippy::iter_over_hash_type)] // order doesn't matter here + #[expect(clippy::iter_over_hash_type, reason = "order doesn't matter")] for (track_id, sender) in &inner.senders { drop( mids.insert( @@ -545,7 +545,7 @@ impl MediaConnections { ), ); } - #[allow(clippy::iter_over_hash_type)] // order doesn't matter here + #[expect(clippy::iter_over_hash_type, reason = "order doesn't matter")] for (track_id, receiver) in &inner.receivers { drop( mids.insert( @@ -588,7 +588,7 @@ impl MediaConnections { /// /// Returns `None` if [`TransceiverSide`] with a provided [`TrackId`] /// doesn't exists in this [`MediaConnections`]. - #[allow(clippy::as_conversions)] + #[expect(clippy::as_conversions, reason = "no other way")] pub fn get_transceiver_side_by_id( &self, track_id: TrackId, @@ -634,7 +634,7 @@ impl MediaConnections { kinds: LocalStreamUpdateCriteria, ) -> Option { let mut stream_request = None; - #[allow(clippy::iter_over_hash_type)] // order doesn't matter here + #[expect(clippy::iter_over_hash_type, reason = "order doesn't matter")] for sender in self.0.borrow().senders.values() { if kinds .has(sender.state().media_kind(), sender.state().media_source()) @@ -764,9 +764,7 @@ impl MediaConnections { .receivers .values() .filter_map(|receiver| { - // Suppress Clippy warn because this impl is easier to - // follow. - #[allow(clippy::question_mark)] + #[expect(clippy::question_mark, reason = "more readable")] if receiver.transceiver().is_none() { return None; } @@ -838,7 +836,9 @@ impl MediaConnections { } #[cfg(feature = "mockable")] -#[allow(clippy::multiple_inherent_impl)] +// TODO: Try remove on next Rust version upgrade. +#[expect(clippy::allow_attributes, reason = "`#[expect]` is not considered")] +#[allow(clippy::multiple_inherent_impl, reason = "feature gated")] impl MediaConnections { /// Indicates whether all [`Receiver`]s with [`MediaKind::Video`] are /// enabled. @@ -929,7 +929,7 @@ impl MediaConnections { /// # Errors /// /// See [`sender::CreateError`] for details. - #[allow(clippy::too_many_arguments)] // TODO: refactor + #[expect(clippy::too_many_arguments, reason = "not a problem")] pub async fn create_sender( &self, id: TrackId, @@ -963,7 +963,7 @@ impl MediaConnections { } /// Creates a new [`receiver::Component`] with the provided data. - #[allow(clippy::too_many_arguments)] + #[expect(clippy::too_many_arguments, reason = "not a problem")] pub async fn create_receiver( &self, id: TrackId, diff --git a/src/peer/media/receiver/component.rs b/src/peer/media/receiver/component.rs index 652c3b5e8..e40fbc168 100644 --- a/src/peer/media/receiver/component.rs +++ b/src/peer/media/receiver/component.rs @@ -479,7 +479,9 @@ impl TransceiverSide for State { } #[cfg(feature = "mockable")] -#[allow(clippy::multiple_inherent_impl)] +// TODO: Try remove on next Rust version upgrade. +#[expect(clippy::allow_attributes, reason = "`#[expect]` is not considered")] +#[allow(clippy::multiple_inherent_impl, reason = "feature gated")] impl State { /// Stabilizes the [`MediaExchangeState`] of this [`State`]. pub fn stabilize(&self) { diff --git a/src/peer/media/receiver/mod.rs b/src/peer/media/receiver/mod.rs index 17054243e..7e466538e 100644 --- a/src/peer/media/receiver/mod.rs +++ b/src/peer/media/receiver/mod.rs @@ -105,7 +105,7 @@ impl Receiver { ) -> Self { let caps = TrackConstraints::from(state.media_type().clone()); - #[allow(clippy::if_then_some_else_none)] + #[expect(clippy::if_then_some_else_none, reason = "more readable")] let transceiver = if state.mid().is_none() { // Try to find send transceiver that can be used as `sendrecv`. let sender = media_connections @@ -329,7 +329,9 @@ impl Receiver { } #[cfg(feature = "mockable")] -#[allow(clippy::multiple_inherent_impl)] +// TODO: Try remove on next Rust version upgrade. +#[expect(clippy::allow_attributes, reason = "`#[expect]` is not considered")] +#[allow(clippy::multiple_inherent_impl, reason = "feature gated")] impl Receiver { /// Returns the current `enabled_general` status of this [`Receiver`]. #[must_use] diff --git a/src/peer/media/sender/component.rs b/src/peer/media/sender/component.rs index 9df635f68..fd4b89b62 100644 --- a/src/peer/media/sender/component.rs +++ b/src/peer/media/sender/component.rs @@ -274,7 +274,7 @@ impl From<&State> for proto::state::Sender { impl State { /// Creates new [`State`] with the provided data. - #[allow(clippy::too_many_arguments)] + #[expect(clippy::too_many_arguments, reason = "not a problem")] #[must_use] pub fn new( id: TrackId, @@ -605,7 +605,7 @@ impl Component { } /// Disables media exchange on a local track acquisition error. - #[allow(clippy::needless_pass_by_value)] + #[expect(clippy::needless_pass_by_value, reason = "required by macro")] #[watch(self.local_track_state.subscribe())] fn local_track_state_changed( _: &Sender, @@ -691,7 +691,9 @@ impl MediaStateControllable for State { } #[cfg(feature = "mockable")] -#[allow(clippy::multiple_inherent_impl)] +// TODO: Try remove on next Rust version upgrade. +#[expect(clippy::allow_attributes, reason = "`#[expect]` is not considered")] +#[allow(clippy::multiple_inherent_impl, reason = "feature gated")] impl State { /// Sets the [`State::sync_state`] to a [`SyncState::Synced`]. pub fn synced(&self) { diff --git a/src/peer/media/sender/mod.rs b/src/peer/media/sender/mod.rs index b58cd4564..bf8c14715 100644 --- a/src/peer/media/sender/mod.rs +++ b/src/peer/media/sender/mod.rs @@ -302,7 +302,9 @@ impl Sender { } #[cfg(feature = "mockable")] -#[allow(clippy::multiple_inherent_impl)] +// TODO: Try remove on next Rust version upgrade. +#[expect(clippy::allow_attributes, reason = "`#[expect]` is not considered")] +#[allow(clippy::multiple_inherent_impl, reason = "feature gated")] impl Sender { /// Indicates whether general media exchange state of this [`Sender`] is in /// [`StableMediaExchangeState::Disabled`]. diff --git a/src/peer/media/transitable_state/controller.rs b/src/peer/media/transitable_state/controller.rs index ba289593e..b4691da23 100644 --- a/src/peer/media/transitable_state/controller.rs +++ b/src/peer/media/transitable_state/controller.rs @@ -111,7 +111,10 @@ where { Either::Left(_) => (), Either::Right(_) => { - #[allow(clippy::shadow_unrelated)] + #[expect( // false positive + clippy::shadow_unrelated, + reason = "actually related" + )] if let Some(this) = weak_this.upgrade() { let stable = this .state diff --git a/src/peer/mod.rs b/src/peer/mod.rs index c6c9d0376..331c84f4f 100644 --- a/src/peer/mod.rs +++ b/src/peer/mod.rs @@ -554,7 +554,10 @@ impl PeerConnection { stat.stats.hash(&mut hasher); let stat_hash = hasher.finish(); - #[allow(clippy::option_if_let_else)] // false positive: &mut + #[expect( // false positive + clippy::option_if_let_else, + reason = "false positive: &mut" + )] if let Some(last_hash) = stats_cache.get_mut(&stat.id) { if *last_hash == stat_hash { false @@ -789,14 +792,15 @@ impl PeerConnection { HashMap, Traced, > { - self.inner_update_local_stream(criteria).await.map_err(|e| { - drop(self.peer_events_sender.unbounded_send( - PeerEvent::FailedLocalMedia { - error: tracerr::map_from(e.clone()), - }, - )); - e - }) + self.inner_update_local_stream(criteria) + .await + .inspect_err(|e| { + drop(self.peer_events_sender.unbounded_send( + PeerEvent::FailedLocalMedia { + error: tracerr::map_from(e.clone()), + }, + )); + }) } /// Returns [`MediaStreamSettings`] for the provided [`MediaKind`] and @@ -1035,7 +1039,9 @@ impl PeerConnection { } #[cfg(feature = "mockable")] -#[allow(clippy::multiple_inherent_impl)] +// TODO: Try remove on next Rust version upgrade. +#[expect(clippy::allow_attributes, reason = "`#[expect]` is not considered")] +#[allow(clippy::multiple_inherent_impl, reason = "feature gated")] impl PeerConnection { /// Returns [`RtcStats`] of this [`PeerConnection`]. /// diff --git a/src/peer/repo.rs b/src/peer/repo.rs index bb4717e5b..1888dec68 100644 --- a/src/peer/repo.rs +++ b/src/peer/repo.rs @@ -43,15 +43,15 @@ impl Component { /// Notifies all [`peer::Component`]s about a RPC connection loss. pub fn connection_lost(&self) { - #[allow(clippy::iter_over_hash_type)] // order doesn't matter here + #[expect(clippy::iter_over_hash_type, reason = "order doesn't matter")] for peer in self.peers.borrow().values() { peer.state().connection_lost(); } } - /// Notifies all [`peer::Component`]s about a RPC connection restore. + /// Notifies all [`peer::Component`]s about an RPC connection restore. pub fn connection_recovered(&self) { - #[allow(clippy::iter_over_hash_type)] // order doesn't matter here + #[expect(clippy::iter_over_hash_type, reason = "order doesn't matter")] for peer in self.peers.borrow().values() { peer.state().connection_recovered(); } @@ -64,7 +64,7 @@ impl Component { state.0.borrow_mut().remove_not_present(&new_state.peers); - #[allow(clippy::iter_over_hash_type)] // order doesn't matter here + #[expect(clippy::iter_over_hash_type, reason = "order doesn't matter")] for (id, peer_state) in new_state.peers { let peer = state.0.borrow().get(&id).cloned(); if let Some(p) = peer { @@ -161,8 +161,10 @@ impl Repository { peers: Rc>>, ) -> TaskHandle { let (fut, abort) = future::abortable(async move { - // Cannot annotate `async` block with `-> !`. - #[allow(clippy::infinite_loop)] // intentional + #[expect( // intentional + clippy::infinite_loop, + reason = "cannot annotate `async` block with `-> !`" + )] loop { platform::delay_for(Duration::from_secs(1)).await; diff --git a/src/peer/stream_update_criteria.rs b/src/peer/stream_update_criteria.rs index d818558c8..273f084ca 100644 --- a/src/peer/stream_update_criteria.rs +++ b/src/peer/stream_update_criteria.rs @@ -1,7 +1,5 @@ //! [`MediaKind`] + [`MediaSourceKind`] criteria for local stream updates. -#![allow(clippy::same_name_method)] // uncontrolled names in the generated code - use std::ops::BitOrAssign; use medea_client_api_proto::{Direction, MediaSourceKind, MediaType, Track}; diff --git a/src/peer/tracks_request.rs b/src/peer/tracks_request.rs index 2b68c4e6f..48e741a0e 100644 --- a/src/peer/tracks_request.rs +++ b/src/peer/tracks_request.rs @@ -288,7 +288,7 @@ impl TryFrom for SimpleTracksRequest { TooManyDisplayVideoTracks, }; - #[allow(clippy::else_if_without_else)] + #[expect(clippy::else_if_without_else, reason = "more readable")] if value.device_video.len() > 1 { return Err(TooManyDeviceVideoTracks); } else if value.display_video.len() > 1 { @@ -307,15 +307,15 @@ impl TryFrom for SimpleTracksRequest { device_video: None, display_video: None, }; - #[allow(clippy::iter_over_hash_type)] // order doesn't matter here + #[expect(clippy::iter_over_hash_type, reason = "order doesn't matter")] for (id, audio) in value.audio { drop(req.audio.replace((id, audio))); } - #[allow(clippy::iter_over_hash_type)] // order doesn't matter here + #[expect(clippy::iter_over_hash_type, reason = "order doesn't matter")] for (id, device) in value.device_video { drop(req.device_video.replace((id, device))); } - #[allow(clippy::iter_over_hash_type)] // order doesn't matter here + #[expect(clippy::iter_over_hash_type, reason = "order doesn't matter")] for (id, display) in value.display_video { drop(req.display_video.replace((id, display))); } diff --git a/src/platform/dart/codec_capability.rs b/src/platform/dart/codec_capability.rs index d08af0a9a..e6d6bf9ba 100644 --- a/src/platform/dart/codec_capability.rs +++ b/src/platform/dart/codec_capability.rs @@ -73,7 +73,7 @@ impl CodecCapability { } .unwrap(); - #[allow(clippy::map_err_ignore)] + #[expect(clippy::map_err_ignore, reason = "not useful")] let res: DartHandle = unsafe { FutureFromDart::execute(fut) } .await .map_err(|_| Error::FailedToGetCapabilities)?; diff --git a/src/platform/dart/constraints.rs b/src/platform/dart/constraints.rs index 6fafc1adb..68a8b196e 100644 --- a/src/platform/dart/constraints.rs +++ b/src/platform/dart/constraints.rs @@ -274,7 +274,7 @@ impl DisplayMediaStreamConstraints { } } -#[allow(clippy::fallible_impl_from)] // intentional +#[expect(clippy::fallible_impl_from, reason = "FFI error is unexpected")] impl From for MediaTrackConstraints { fn from(from: AudioTrackConstraints) -> Self { let optional = { @@ -337,7 +337,7 @@ impl From for MediaTrackConstraints { } } -#[allow(clippy::fallible_impl_from)] // intentional +#[expect(clippy::fallible_impl_from, reason = "FFI error is unexpected")] impl From for MediaTrackConstraints { fn from(from: DeviceVideoTrackConstraints) -> Self { let optional = { @@ -409,7 +409,7 @@ impl From for MediaTrackConstraints { } } -#[allow(clippy::fallible_impl_from)] // intentional +#[expect(clippy::fallible_impl_from, reason = "FFI error is unexpected")] impl From for MediaTrackConstraints { fn from(from: DisplayVideoTrackConstraints) -> Self { let optional = { diff --git a/src/platform/dart/executor/task.rs b/src/platform/dart/executor/task.rs index 7987b67e4..fd70967cb 100644 --- a/src/platform/dart/executor/task.rs +++ b/src/platform/dart/executor/task.rs @@ -101,7 +101,10 @@ impl Task { /// `Rc` instead of `Arc` since we are sure /// that everything will run on a single thread. fn into_raw_waker(this: Rc) -> RawWaker { - #![allow(clippy::missing_docs_in_private_items)] + #![expect( // not visible + clippy::missing_docs_in_private_items, + reason = "not visible at all" + )] // Refer to `RawWakerVTable::new()` documentation for better // understanding of what the following functions do. diff --git a/src/platform/dart/ice_candidate.rs b/src/platform/dart/ice_candidate.rs index dcdcf3f37..61133d2b6 100644 --- a/src/platform/dart/ice_candidate.rs +++ b/src/platform/dart/ice_candidate.rs @@ -208,7 +208,7 @@ impl IceCandidate { } /// Returns SDP M line index of this [`IceCandidate`]. - #[allow(clippy::unwrap_in_result)] + #[expect(clippy::unwrap_in_result, reason = "unreleated")] #[must_use] pub fn sdp_m_line_index(&self) -> Option { Some(unsafe { @@ -221,7 +221,7 @@ impl IceCandidate { /// Returns SDP MID of this [`IceCandidate`]. #[must_use] - #[allow(clippy::unwrap_in_result)] // intentional + #[expect(clippy::unwrap_in_result, reason = "unrelated")] pub fn sdp_mid(&self) -> Option { let mid = unsafe { ice_candidate::sdp_mid(self.0.get()) }.unwrap(); Some(unsafe { dart_string_into_rust(mid) }) diff --git a/src/platform/dart/ice_server.rs b/src/platform/dart/ice_server.rs index a15d6e5fe..d083658f2 100644 --- a/src/platform/dart/ice_server.rs +++ b/src/platform/dart/ice_server.rs @@ -45,7 +45,7 @@ impl RtcIceServers { } } -#[allow(clippy::fallible_impl_from)] // intentional +#[expect(clippy::fallible_impl_from, reason = "FFI error is unexpected")] impl From for RtcIceServers where I: IntoIterator, diff --git a/src/platform/dart/media_device_info.rs b/src/platform/dart/media_device_info.rs index 6af2ce1c6..c57f0d925 100644 --- a/src/platform/dart/media_device_info.rs +++ b/src/platform/dart/media_device_info.rs @@ -94,7 +94,7 @@ impl MediaDeviceInfo { /// same [groupId][1]. /// /// [1]: https://w3.org/TR/mediacapture-streams#dom-mediadeviceinfo-groupid - #[allow(clippy::unwrap_in_result)] + #[expect(clippy::unwrap_in_result, reason = "unrelated")] #[must_use] pub fn group_id(&self) -> Option { let group_id = @@ -112,9 +112,9 @@ impl MediaDeviceInfo { impl TryFrom for MediaDeviceInfo { type Error = NotInput; - #[allow(clippy::unwrap_in_result)] // intentional + #[expect(clippy::unwrap_in_result, reason = "unrelated")] fn try_from(value: DartHandle) -> Result { - #[allow(clippy::map_err_ignore)] // intentional + #[expect(clippy::map_err_ignore, reason = "not useful")] let kind = unsafe { media_device_info::kind(value.get()) } .unwrap() .try_into() diff --git a/src/platform/dart/media_devices.rs b/src/platform/dart/media_devices.rs index 4e4a0f753..89905d81a 100644 --- a/src/platform/dart/media_devices.rs +++ b/src/platform/dart/media_devices.rs @@ -84,7 +84,7 @@ mod media_devices { } } -#[allow(clippy::fallible_impl_from)] // intentional +#[expect(clippy::fallible_impl_from, reason = "FFI error is unexpected")] impl From for GetUserMediaError { fn from(err: Error) -> Self { let kind = unsafe { diff --git a/src/platform/dart/media_display_info.rs b/src/platform/dart/media_display_info.rs index 71aa0db60..2981280db 100644 --- a/src/platform/dart/media_display_info.rs +++ b/src/platform/dart/media_display_info.rs @@ -43,7 +43,7 @@ impl MediaDisplayInfo { } /// Returns a title describing the represented display. - #[allow(clippy::unwrap_in_result)] + #[expect(clippy::unwrap_in_result, reason = "unrelated")] #[must_use] pub fn title(&self) -> Option { let title = unsafe { media_display_info::title(self.0.get()) }.unwrap(); diff --git a/src/platform/dart/media_track.rs b/src/platform/dart/media_track.rs index 384acec03..7fcee3759 100644 --- a/src/platform/dart/media_track.rs +++ b/src/platform/dart/media_track.rs @@ -164,7 +164,7 @@ pub struct MediaStreamTrack { impl MediaStreamTrack { /// Creates a new [`MediaStreamTrack`]. #[must_use] - pub fn new( + pub const fn new( inner: DartHandle, source_kind: Option, ) -> Self { @@ -189,9 +189,9 @@ impl MediaStreamTrack { /// Returns [device ID][1] of this [`MediaStreamTrack`]. /// /// [1]: https://w3.org/TR/mediacapture-streams#dfn-deviceid + #[expect(clippy::unwrap_in_result, reason = "unrelated")] #[inline] #[must_use] - #[allow(clippy::unwrap_in_result)] // intentional pub fn device_id(&self) -> Option { let device_id = unsafe { media_stream_track::device_id(self.inner.get()) }.unwrap(); @@ -213,7 +213,7 @@ impl MediaStreamTrack { /// Returns [facing mode][1] of this [`MediaStreamTrack`]. /// /// [1]: https://tinyurl.com/w3-streams#dom-mediatracksettings-facingmode - #[allow(clippy::unwrap_in_result)] + #[expect(clippy::unwrap_in_result, reason = "unrelated")] #[must_use] pub fn facing_mode(&self) -> Option { let facing_mode = @@ -229,7 +229,7 @@ impl MediaStreamTrack { /// Returns [height][1] of this [`MediaStreamTrack`]. /// /// [1]: https://tinyurl.com/w3-streams#dom-mediatracksettings-height - #[allow(clippy::unwrap_in_result)] + #[expect(clippy::unwrap_in_result, reason = "unrelated")] #[must_use] pub fn height(&self) -> Option { let height = @@ -240,7 +240,7 @@ impl MediaStreamTrack { /// Returns [width][1] of this [`MediaStreamTrack`]. /// /// [1]: https://tinyurl.com/w3-streams#dom-mediatracksettings-width - #[allow(clippy::unwrap_in_result)] + #[expect(clippy::unwrap_in_result, reason = "unrelated")] #[must_use] pub fn width(&self) -> Option { let width = diff --git a/src/platform/dart/mod.rs b/src/platform/dart/mod.rs index fe0734b3f..4c6d30268 100644 --- a/src/platform/dart/mod.rs +++ b/src/platform/dart/mod.rs @@ -1,15 +1,15 @@ //! Multiplatform Dart runtime specific functionality. -// TODO: Remove allows when implementing platform code. -#![allow( +// TODO: Needs refactoring. +#![expect( clippy::as_conversions, clippy::missing_docs_in_private_items, clippy::missing_panics_doc, clippy::undocumented_unsafe_blocks, - clippy::unused_self, clippy::unwrap_used, clippy::needless_pass_by_value, - unused_variables + unused_variables, + reason = "needs refactoring" )] pub mod codec_capability; diff --git a/src/platform/dart/peer_connection.rs b/src/platform/dart/peer_connection.rs index e16eaf826..bee6349e6 100644 --- a/src/platform/dart/peer_connection.rs +++ b/src/platform/dart/peer_connection.rs @@ -195,7 +195,8 @@ impl RtcPeerConnection { } /// Returns [`RtcStats`] of this [`RtcPeerConnection`]. - #[allow(clippy::missing_errors_doc, clippy::unused_async)] + // TODO: Needs refactoring. + #[expect(clippy::missing_errors_doc, reason = "needs refactoring")] pub async fn get_stats(&self) -> RtcPeerConnectionResult { let fut = unsafe { peer_connection::get_stats(self.handle.get()) }.unwrap(); @@ -312,7 +313,6 @@ impl RtcPeerConnection { } /// Returns [`PeerConnectionState`] of this [`RtcPeerConnection`]. - #[allow(clippy::unwrap_in_result)] #[must_use] pub fn connection_state(&self) -> PeerConnectionState { let conn_state = diff --git a/src/platform/dart/rtc_stats.rs b/src/platform/dart/rtc_stats.rs index 61a9e425f..bdc811290 100644 --- a/src/platform/dart/rtc_stats.rs +++ b/src/platform/dart/rtc_stats.rs @@ -11,8 +11,6 @@ pub struct RtcStats(pub Vec); #[cfg(feature = "mockable")] pub mod mock { - #![allow(clippy::missing_safety_doc)] - use crate::api::DartValueArg; #[no_mangle] diff --git a/src/platform/dart/send_encoding_parameters.rs b/src/platform/dart/send_encoding_parameters.rs index a77597765..921b0860a 100644 --- a/src/platform/dart/send_encoding_parameters.rs +++ b/src/platform/dart/send_encoding_parameters.rs @@ -124,7 +124,6 @@ impl SendEncodingParameters { /// Sets [activeness][1] of these [`SendEncodingParameters`]. /// /// [1]: https://w3.org/TR/webrtc#dom-rtcrtpencodingparameters-active - #[allow(clippy::needless_pass_by_ref_mut)] // semantically correct pub fn set_active(&mut self, active: bool) { let handle = self.0.get(); unsafe { send_encoding_parameters::set_active(handle, active) } @@ -134,7 +133,6 @@ impl SendEncodingParameters { /// Sets [maxBitrate][1] of these [`SendEncodingParameters`]. /// /// [1]: https://w3.org/TR/webrtc#dom-rtcrtpencodingparameters-maxbitrate - #[allow(clippy::needless_pass_by_ref_mut)] // semantically correct pub fn set_max_bitrate(&mut self, max_bitrate: i64) { let handle = self.0.get(); unsafe { @@ -146,7 +144,6 @@ impl SendEncodingParameters { /// Sets [scaleResolutionDownBy][1] of these [`SendEncodingParameters`]. /// /// [1]: https://tinyurl.com/ypzzc75t - #[allow(clippy::needless_pass_by_ref_mut)] // semantically correct pub fn set_scale_resolution_down_by( &mut self, scale_resolution_down_by: i64, @@ -164,7 +161,6 @@ impl SendEncodingParameters { /// Sets [scalabilityMode][1] of these [`SendEncodingParameters`]. /// /// [1]: https://tinyurl.com/3zuaee45 - #[allow(clippy::needless_pass_by_ref_mut)] // semantically correct pub fn set_scalability_mode(&mut self, scalability_mode: ScalabilityMode) { let handle = self.0.get(); unsafe { diff --git a/src/platform/dart/transceiver.rs b/src/platform/dart/transceiver.rs index ad1a3599c..5565642fb 100644 --- a/src/platform/dart/transceiver.rs +++ b/src/platform/dart/transceiver.rs @@ -193,7 +193,7 @@ impl Transceiver { /// Returns [`mid`] of this [`Transceiver`]. /// /// [`mid`]: https://w3.org/TR/webrtc#dom-rtptransceiver-mid - #[allow(clippy::unwrap_in_result)] + #[expect(clippy::unwrap_in_result, reason = "unrelated")] #[must_use] pub fn mid(&self) -> Option { let mid = unsafe { transceiver::mid(self.0.get()) }.unwrap(); diff --git a/src/platform/dart/transport.rs b/src/platform/dart/transport.rs index ea5fe20cf..609a63e61 100644 --- a/src/platform/dart/transport.rs +++ b/src/platform/dart/transport.rs @@ -137,7 +137,7 @@ impl Default for WebSocketRpcTransport { impl RpcTransport for WebSocketRpcTransport { async fn connect(&self, url: ApiUrl) -> TransportResult<()> { // TODO: Propagate execution error. - #[allow(clippy::map_err_ignore)] + #[expect(clippy::map_err_ignore, reason = "needs refactoring")] let handle = { let on_message = Callback::from_fn_mut({ let weak_subs = Rc::downgrade(&self.on_message_subs); @@ -212,7 +212,7 @@ impl RpcTransport for WebSocketRpcTransport { self.close_reason.set(reason); } - #[allow(clippy::unwrap_in_result)] + #[expect(clippy::unwrap_in_result, reason = "unrelated")] fn send(&self, msg: &ClientMsg) -> TransportResult<()> { let state = self.socket_state.get(); let handle = self diff --git a/src/platform/dart/utils/callback.rs b/src/platform/dart/utils/callback.rs index 286da12d6..ac41f34c1 100644 --- a/src/platform/dart/utils/callback.rs +++ b/src/platform/dart/utils/callback.rs @@ -173,7 +173,7 @@ impl Callback { /// Converts this [`Callback`] into a [`Dart_Handle`], so it can be passed /// to Dart. - #[allow(clippy::cast_possible_wrap)] + #[expect(clippy::cast_possible_wrap, reason = "overflow is unexpected")] #[must_use] pub fn into_dart(self) -> Dart_Handle { let is_finalizable = !matches!(&self.0, Kind::FnOnce(_)); @@ -218,7 +218,7 @@ extern "C" fn callback_finalizer(_: *mut c_void, cb: *mut c_void) { #[cfg(feature = "mockable")] pub mod tests { - #![allow(clippy::missing_safety_doc)] + #![expect(clippy::missing_safety_doc, reason = "only for testing")] use dart_sys::Dart_Handle; diff --git a/src/platform/dart/utils/completer.rs b/src/platform/dart/utils/completer.rs index 7158fcaeb..a3864d5e0 100644 --- a/src/platform/dart/utils/completer.rs +++ b/src/platform/dart/utils/completer.rs @@ -76,12 +76,15 @@ mod completer { /// /// # Panics /// -/// Panics if the `DELAYED_FUTURE_FUNCTION` isn't set by the Dart side. This is -/// should be impossible case. +/// Panics if the `DELAYED_FUTURE_FUNCTION` isn't set by the Dart side. This +/// should be an impossible case. /// /// [`Future`]: std::future::Future pub async fn delay_for(delay: Duration) { - #[allow(clippy::cast_possible_truncation)] + #[expect( // overflow is unexpected + clippy::cast_possible_truncation, + reason = "overflow is unexpected", + )] let delay = delay.as_millis() as i32; let delayed = unsafe { completer::delayed(delay) }.unwrap(); let delayed_fut = unsafe { FutureFromDart::execute::<()>(delayed) }; diff --git a/src/platform/dart/utils/dart_api.rs b/src/platform/dart/utils/dart_api.rs index 0eb7e6b6d..7a26e1e84 100644 --- a/src/platform/dart/utils/dart_api.rs +++ b/src/platform/dart/utils/dart_api.rs @@ -37,7 +37,7 @@ pub unsafe fn new_persistent_handle( object: Dart_Handle, ) -> Dart_PersistentHandle { let func = unsafe { - #[allow(clippy::expect_used)] + #[expect(clippy::expect_used, reason = "FFI should be initialized")] Dart_NewPersistentHandle_DL .expect("`dart_api_dl` has not been initialized") }; @@ -56,7 +56,7 @@ pub unsafe fn handle_from_persistent( object: Dart_PersistentHandle, ) -> Dart_Handle { let func = unsafe { - #[allow(clippy::expect_used)] + #[expect(clippy::expect_used, reason = "FFI should be initialized")] Dart_HandleFromPersistent_DL .expect("`dart_api_dl` has not been initialized") }; @@ -70,7 +70,7 @@ pub unsafe fn handle_from_persistent( /// [`initialize_api`] must be called before this function. pub unsafe fn delete_persistent_handle(object: Dart_Handle) { let func = unsafe { - #[allow(clippy::expect_used)] + #[expect(clippy::expect_used, reason = "FFI should be initialized")] Dart_DeletePersistentHandle_DL .expect("`dart_api_dl` has not been initialized") }; @@ -102,7 +102,7 @@ pub unsafe fn post_c_object( message: *mut Dart_CObject, ) -> bool { let func = unsafe { - #[allow(clippy::expect_used)] + #[expect(clippy::expect_used, reason = "FFI should be initialized")] Dart_PostCObject_DL.expect("`dart_api_dl` has not been initialized") }; unsafe { func(port_id, message) } @@ -135,7 +135,7 @@ pub unsafe fn new_finalizable_handle( callback: Dart_HandleFinalizer, ) -> Dart_FinalizableHandle { let func = unsafe { - #[allow(clippy::expect_used)] + #[expect(clippy::expect_used, reason = "FFI should be initialized")] Dart_NewFinalizableHandle_DL .expect("`dart_api_dl` has not been initialized") }; @@ -151,7 +151,7 @@ pub unsafe fn new_finalizable_handle( /// [`initialize_api`] must be called before this function. pub unsafe fn is_error(handle: Dart_Handle) -> bool { let func = unsafe { - #[allow(clippy::expect_used)] + #[expect(clippy::expect_used, reason = "FFI should be initialized")] Dart_IsError_DL.expect("`dart_api_dl` has not been initialized") }; unsafe { func(handle) } @@ -169,7 +169,7 @@ pub unsafe fn is_error(handle: Dart_Handle) -> bool { /// [`initialize_api`] must be called before this function. pub unsafe fn get_error(handle: Dart_Handle) -> *const ffi::c_char { let func = unsafe { - #[allow(clippy::expect_used)] + #[expect(clippy::expect_used, reason = "FFI should be initialized")] Dart_GetError_DL.expect("`dart_api_dl` has not been initialized") }; unsafe { func(handle) } @@ -192,7 +192,7 @@ pub unsafe fn get_error(handle: Dart_Handle) -> *const ffi::c_char { /// [1]: https://api.dart.dev/dart-ffi/NativeApi/initializeApiDLData.html pub unsafe fn propagate_error(mut handle: Dart_Handle) { let is_error = unsafe { - #[allow(clippy::expect_used)] // intentional + #[expect(clippy::expect_used, reason = "FFI should be initialized")] Dart_IsError_DL.expect("`dart_api_dl` has not been initialized") }; @@ -200,7 +200,7 @@ pub unsafe fn propagate_error(mut handle: Dart_Handle) { if !is_error { let make_unhandled = unsafe { - #[allow(clippy::expect_used)] // intentional + #[expect(clippy::expect_used, reason = "FFI should be initialized")] Dart_NewUnhandledExceptionError_DL .expect("`dart_api_dl` has not been initialized") }; @@ -209,7 +209,7 @@ pub unsafe fn propagate_error(mut handle: Dart_Handle) { }; let propagate = unsafe { - #[allow(clippy::expect_used)] // intentional + #[expect(clippy::expect_used, reason = "FFI should be initialized")] Dart_PropagateError_DL.expect("`dart_api_dl` has not been initialized") }; unsafe { diff --git a/src/platform/dart/utils/dart_future.rs b/src/platform/dart/utils/dart_future.rs index cc3e7d3bc..53382958d 100644 --- a/src/platform/dart/utils/dart_future.rs +++ b/src/platform/dart/utils/dart_future.rs @@ -153,10 +153,7 @@ impl FutureFromDart { /// [`Future`]: https://api.dart.dev/dart-async/Future-class.html #[derive(Debug)] #[repr(transparent)] -pub struct DartFuture( - #[allow(dead_code)] Dart_Handle, // read by Dart side - PhantomData<*const O>, -); +pub struct DartFuture(Dart_Handle, PhantomData<*const O>); impl DartFuture { /// Wraps the given [`DartFuture`] into a [`DartOpaque`] value, so it can be @@ -209,7 +206,7 @@ where #[cfg(feature = "mockable")] pub mod tests { - #![allow(clippy::missing_safety_doc)] + #![expect(clippy::missing_safety_doc, reason = "for testing only")] use dart_sys::Dart_Handle; diff --git a/src/platform/dart/utils/handle.rs b/src/platform/dart/utils/handle.rs index 4813266bf..e78103082 100644 --- a/src/platform/dart/utils/handle.rs +++ b/src/platform/dart/utils/handle.rs @@ -80,7 +80,7 @@ impl DartHandle { } impl fmt::Display for DartHandle { - #[allow(clippy::unwrap_in_result)] // intentional + #[expect(clippy::unwrap_in_result, reason = "unrelated")] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let string = unsafe { handle::to_string(self.get()) }.unwrap(); let string = unsafe { dart_string_into_rust(string) }; diff --git a/src/platform/dart/utils/list.rs b/src/platform/dart/utils/list.rs index 2bb2cd002..b4dd8eae0 100644 --- a/src/platform/dart/utils/list.rs +++ b/src/platform/dart/utils/list.rs @@ -72,10 +72,13 @@ impl DartList { } /// Returns an element by the provided `index` from this [`DartList`]. - #[allow(clippy::unwrap_in_result)] + #[expect(clippy::unwrap_in_result, reason = "unrelated")] #[must_use] pub fn get(&self, index: usize) -> Option { - #[allow(clippy::cast_possible_truncation)] + #[expect( // intended + clippy::cast_possible_truncation, + reason = "overflow is unexpected" + )] let item_ptr = unsafe { list::get(self.0.get(), index as u32) }.unwrap(); unsafe { item_ptr.unbox() }.try_into().unwrap() diff --git a/src/platform/transceiver.rs b/src/platform/transceiver.rs index 389691962..78c1e8866 100644 --- a/src/platform/transceiver.rs +++ b/src/platform/transceiver.rs @@ -2,9 +2,6 @@ //! //! [1]: https://w3.org/TR/webrtc#dom-rtcrtptransceiverdirection -// Because of uncontrolled names in the generated code. -#![allow(clippy::same_name_method)] - use bitflags::bitflags; use medea_client_api_proto::Direction as DirectionProto; #[cfg(target_family = "wasm")] diff --git a/src/platform/transport.rs b/src/platform/transport.rs index 2e655a655..699953ee9 100644 --- a/src/platform/transport.rs +++ b/src/platform/transport.rs @@ -1,5 +1,7 @@ //! Platform-agnostic functionality of RPC transport. +#![cfg_attr(feature = "mockable", expect(unused_lifetimes, reason = "codegen"))] + use async_trait::async_trait; use derive_more::Display; use futures::stream::LocalBoxStream; @@ -40,10 +42,8 @@ impl TransportState { } /// RPC transport between a client and a server. -#[allow(unused_lifetimes)] #[async_trait(?Send)] #[cfg_attr(feature = "mockable", mockall::automock)] -#[cfg_attr(feature = "mockable", allow(clippy::missing_docs_in_private_items))] pub trait RpcTransport { /// Initiates a new [WebSocket] connection to the provided `url`. /// diff --git a/src/platform/wasm/codec_capability.rs b/src/platform/wasm/codec_capability.rs index 7bb5724ff..446f8d652 100644 --- a/src/platform/wasm/codec_capability.rs +++ b/src/platform/wasm/codec_capability.rs @@ -32,7 +32,7 @@ impl CodecCapability { /// capabilities. /// /// [RTCRtpSender]: https://w3.org/TR/webrtc#dom-rtcrtpsender - #[allow(clippy::unused_async)] // for platform code uniformity + #[expect(clippy::unused_async, reason = "`cfg` code uniformity")] pub async fn get_sender_codec_capabilities( kind: MediaKind, ) -> Result, Error> { diff --git a/src/platform/wasm/media_devices.rs b/src/platform/wasm/media_devices.rs index 363fd1ec7..cc3e6117d 100644 --- a/src/platform/wasm/media_devices.rs +++ b/src/platform/wasm/media_devices.rs @@ -2,12 +2,12 @@ //! //! [1]: https://w3.org/TR/mediacapture-streams#mediadevices -#![allow(clippy::unwrap_used)] +#![expect(clippy::unwrap_used, reason = "JS interop error is unexpected")] use std::{cell::RefCell, rc::Rc}; -use wasm_bindgen_futures::JsFuture; use tracerr::Traced; +use wasm_bindgen_futures::JsFuture; use web_sys::{Event, MediaDevices as SysMediaDevices}; use crate::{ @@ -114,8 +114,8 @@ impl MediaDevices { } /// Unimplemented on WASM targets. - #[allow(clippy::missing_errors_doc)] - #[allow(clippy::unused_async)] // for platform code uniformity + #[expect(clippy::missing_errors_doc, reason = "unimplemented")] + #[expect(clippy::unused_async, reason = "`cfg` code uniformity")] pub async fn enumerate_displays( &self, ) -> Result, Traced> { @@ -227,7 +227,7 @@ impl MediaDevices { /// # Panics /// /// Always. - #[allow(clippy::unused_async)] // for platform code uniformity + #[expect(clippy::unused_async, reason = "`cfg` code uniformity")] pub async fn set_output_audio_id( &self, _: String, @@ -263,7 +263,7 @@ impl MediaDevices { /// Always returns `false` since accessing microphone cannot be implemented /// on web platform. - #[allow(clippy::unused_async)] // for platform code uniformity + #[expect(clippy::unused_async, reason = "`cfg` code uniformity")] pub async fn microphone_volume_is_available(&self) -> bool { false } @@ -278,7 +278,7 @@ impl MediaDevices { /// # Panics /// /// Always. - #[allow(clippy::unused_async)] // for platform code uniformity + #[expect(clippy::unused_async, reason = "`cfg` code uniformity")] pub async fn microphone_volume( &self, ) -> Result> { @@ -297,7 +297,7 @@ impl MediaDevices { /// # Panics /// /// Always. - #[allow(clippy::unused_async)] // for platform code uniformity + #[expect(clippy::unused_async, reason = "`cfg` code uniformity")] pub async fn set_microphone_volume( &self, _: i64, diff --git a/src/platform/wasm/media_track.rs b/src/platform/wasm/media_track.rs index cfe28c83c..a95df20b9 100644 --- a/src/platform/wasm/media_track.rs +++ b/src/platform/wasm/media_track.rs @@ -93,7 +93,7 @@ impl MediaStreamTrack { /// [1]: https://w3.org/TR/mediacapture-streams#dom-mediastreamtrackstate /// [2]: https://w3.org/TR/mediacapture-streams#mediastreamtrack /// [3]: https://tinyurl.com/w3-streams#dom-mediastreamtrack-readystate - #[allow(clippy::unused_async)] // for platform code uniformity + #[expect(clippy::unused_async, reason = "`cfg` code uniformity")] pub async fn ready_state(&self) -> MediaStreamTrackState { let state = self.sys_track.ready_state(); match state { @@ -151,10 +151,11 @@ impl MediaStreamTrack { /// [2]: https://w3.org/TR/mediacapture-streams#mediastreamtrack #[must_use] pub fn height(&self) -> Option { - #[allow( + #[expect( // no other sane way clippy::as_conversions, clippy::cast_possible_truncation, - clippy::cast_sign_loss + clippy::cast_sign_loss, + reason = "no other sane way" )] get_property_by_name(&self.sys_track.get_settings(), "height", |h| { h.as_f64().map(|v| v as u32) @@ -167,10 +168,11 @@ impl MediaStreamTrack { /// [2]: https://w3.org/TR/mediacapture-streams#mediastreamtrack #[must_use] pub fn width(&self) -> Option { - #[allow( + #[expect( // no other sane way clippy::as_conversions, clippy::cast_possible_truncation, - clippy::cast_sign_loss + clippy::cast_sign_loss, + reason = "no other sane way" )] get_property_by_name(&self.sys_track.get_settings(), "width", |w| { w.as_f64().map(|v| v as u32) @@ -252,21 +254,17 @@ impl MediaStreamTrack { let mut on_ended = self.on_ended.borrow_mut(); drop(match f { None => on_ended.take(), - Some(f) => { - on_ended.replace( - // PANIC: Unwrapping is OK here, because this function - // shouldn't error ever. - #[allow(clippy::unwrap_used)] // intentional - EventListener::new_once( - Rc::clone(&self.sys_track), - "ended", - move |_| { - f(); - }, - ) - .unwrap(), + Some(f) => on_ended.replace( + #[expect(clippy::unwrap_used, reason = "shouldn't error ever")] + EventListener::new_once( + Rc::clone(&self.sys_track), + "ended", + move |_| { + f(); + }, ) - } + .unwrap(), + ), }); } diff --git a/src/platform/wasm/mod.rs b/src/platform/wasm/mod.rs index 4ff21b784..5ff8fb5fb 100644 --- a/src/platform/wasm/mod.rs +++ b/src/platform/wasm/mod.rs @@ -76,7 +76,7 @@ where /// If fails to interact with JS side. /// /// [`Future`]: std::future::Future -#[allow(clippy::unwrap_used)] +#[expect(clippy::unwrap_used, reason = "JS interop error is unexpected")] pub async fn delay_for(delay: Duration) { let delay_ms = delay.as_millis().try_into().unwrap_or(i32::MAX); JsFuture::from(Promise::new(&mut |yes, _| { @@ -115,8 +115,7 @@ where #[must_use] pub fn window() -> Window { // Cannot use `lazy_static` since `window` is `!Sync`. - // Safe to unwrap. - #![allow(clippy::unwrap_used)] // intentional + #![expect(clippy::unwrap_used, reason = "`window` is always present")] web_sys::window().unwrap() } diff --git a/src/platform/wasm/peer_connection.rs b/src/platform/wasm/peer_connection.rs index 127628a0d..a8a924073 100644 --- a/src/platform/wasm/peer_connection.rs +++ b/src/platform/wasm/peer_connection.rs @@ -2,7 +2,7 @@ //! //! [1]: https://w3.org/TR/webrtc#dom-rtcpeerconnection -#![allow(clippy::unwrap_used)] +#![expect(clippy::unwrap_used, reason = "JS interop error is unexpected")] use std::{ cell::{Cell, RefCell}, @@ -123,7 +123,7 @@ impl RtcPeerConnection { /// /// Errors with [`RtcPeerConnectionError::PeerCreationError`] if /// [`SysRtcPeerConnection`] creation fails. - #[allow(clippy::unused_async)] // for platform code uniformity + #[expect(clippy::unused_async, reason = "`cfg` code uniformity")] pub async fn new( ice_servers: I, is_force_relayed: bool, @@ -618,7 +618,7 @@ impl RtcPeerConnection { /// /// [1]: https://w3.org/TR/webrtc#dom-rtcrtptransceiver /// [2]: https://w3.org/TR/webrtc#transceivers-set - #[allow(clippy::unused_async)] // for platform code uniformity + #[expect(clippy::unused_async, reason = "`cfg` code uniformity")] pub async fn add_transceiver( &self, kind: MediaKind, diff --git a/src/platform/wasm/send_encoding_parameters.rs b/src/platform/wasm/send_encoding_parameters.rs index 8069c3cd5..794e9a9ae 100644 --- a/src/platform/wasm/send_encoding_parameters.rs +++ b/src/platform/wasm/send_encoding_parameters.rs @@ -14,8 +14,8 @@ pub struct SendEncodingParameters(RtcRtpEncodingParameters); impl SendEncodingParameters { /// Creates new [`SendEncodingParameters`]. + #[expect(clippy::needless_pass_by_value, reason = "`cfg` code uniformity")] #[must_use] - #[allow(clippy::needless_pass_by_value)] pub fn new(rid: String, active: bool) -> Self { let mut params = RtcRtpEncodingParameters::new(); _ = params.rid(&rid); diff --git a/src/platform/wasm/transceiver.rs b/src/platform/wasm/transceiver.rs index c55619a1f..9c073a484 100644 --- a/src/platform/wasm/transceiver.rs +++ b/src/platform/wasm/transceiver.rs @@ -96,7 +96,7 @@ impl Transceiver { /// Indicates whether the provided [`TransceiverDirection`] is enabled for /// this [`Transceiver`]. - #[allow(clippy::unused_async)] // for platform code uniformity + #[expect(clippy::unused_async, reason = "`cfg` code uniformity")] pub async fn has_direction(&self, direction: TransceiverDirection) -> bool { self.direction().contains(direction) } @@ -146,20 +146,20 @@ impl Transceiver { /// /// [RTCRtpSender]: https://w3.org/TR/webrtc#dom-rtcrtpsender /// [1]: https://w3.org/TR/webrtc#dom-rtcrtpsender-setparameters - #[allow(clippy::missing_panics_doc)] + #[expect(clippy::missing_panics_doc, reason = "not happens")] pub async fn update_send_encodings( &self, encodings: Vec, ) -> Result<(), Error> { let params = self.0.sender().get_parameters(); - #[allow(clippy::unwrap_used)] // intentional + #[expect(clippy::unwrap_used, reason = "always present")] let encs = get_property_by_name(¶ms, "encodings", |v| { v.is_array().then_some(Array::from(&v)) }) .unwrap(); for mut enc in encs.iter().map(RtcRtpEncodingParameters::from) { - #[allow(clippy::unwrap_used)] // intentional + #[expect(clippy::unwrap_used, reason = "always present")] let rid = get_property_by_name(&enc, "rid", |v| v.as_string()).unwrap(); diff --git a/src/platform/wasm/transport.rs b/src/platform/wasm/transport.rs index 3a190a7d6..95dfe0998 100644 --- a/src/platform/wasm/transport.rs +++ b/src/platform/wasm/transport.rs @@ -2,7 +2,8 @@ //! //! [WebSocket]: https://developer.mozilla.org/ru/docs/WebSockets -#![allow(clippy::unwrap_used)] +// TODO: Needs refactoring. +#![expect(clippy::unwrap_used, reason = "needs refactoring")] use std::{cell::RefCell, rc::Rc}; diff --git a/src/platform/wasm/utils/event_listener.rs b/src/platform/wasm/utils/event_listener.rs index 1035a9c31..a39331eea 100644 --- a/src/platform/wasm/utils/event_listener.rs +++ b/src/platform/wasm/utils/event_listener.rs @@ -54,7 +54,7 @@ where where F: FnMut(A) + 'static, { - #[allow(clippy::as_conversions)] + #[expect(clippy::as_conversions, reason = "no other way")] let closure = Closure::wrap(Box::new(closure) as Box); target @@ -112,7 +112,7 @@ where /// Drops [`EventListener`]'s closure and unregisters appropriate event /// handler. fn drop(&mut self) { - #[allow(clippy::as_conversions)] + #[expect(clippy::as_conversions, reason = "no other way")] if let Err(err) = (self.target.as_ref() as &web_sys::EventTarget) .remove_event_listener_with_callback( self.event_name, diff --git a/src/room.rs b/src/room.rs index 4fc25cef6..9ebccabd2 100644 --- a/src/room.rs +++ b/src/room.rs @@ -291,7 +291,6 @@ impl RoomHandle { /// # Errors /// /// See [`HandleDetachedError`] for details. - #[cfg_attr(not(target_family = "wasm"), allow(unused_qualifications))] pub fn on_close( &self, f: platform::Function, @@ -337,7 +336,6 @@ impl RoomHandle { /// # Errors /// /// See [`HandleDetachedError`] for details. - #[cfg_attr(not(target_family = "wasm"), allow(unused_qualifications))] pub fn on_connection_loss( &self, f: platform::Function, @@ -456,8 +454,6 @@ impl RoomHandle { direction, source_kind, ); - // false positive: output expression is not input one - #[allow(clippy::redundant_closure_call)] tracerr::map_from_and_wrap!()(e) })?; if !inner.send_constraints.is_track_enabled(kind, source_kind) { @@ -987,11 +983,9 @@ struct InnerRoom { on_failed_local_media: Rc>, /// Callback invoked when a [`RpcSession`] loses connection. - #[cfg_attr(not(target_family = "wasm"), allow(unused_qualifications))] on_connection_loss: platform::Callback, /// Callback invoked when this [`Room`] is closed. - #[cfg_attr(not(target_family = "wasm"), allow(unused_qualifications))] on_close: Rc>, /// Reason of [`Room`] closing. @@ -1330,10 +1324,8 @@ impl InnerRoom { .media_manager .get_tracks(req) .await - .map_err(|e| { + .inspect_err(|e| { self.on_failed_local_media.call1(e.clone()); - - e }) .map_err(tracerr::map_from_and_wrap!())?; for (track, is_new) in tracks { @@ -1465,8 +1457,6 @@ impl InnerRoom { e.as_ref(), UpdateLocalStreamError::CouldNotGetLocalMedia(_) ) { - // false positive: output expression is not input one - #[allow(clippy::redundant_closure_call)] return Err(E::errored(tracerr::map_from_and_wrap!()( e.clone(), ))); @@ -1480,16 +1470,11 @@ impl InnerRoom { ) .await .map_err(|err| { - // false positive: output expression is not input - // one - #[allow(clippy::redundant_closure_call)] err.recovery_failed(tracerr::map_from_and_wrap!()( e.clone(), )) })?; - // false positive: output expression is not input one - #[allow(clippy::redundant_closure_call)] E::recovered(tracerr::map_from_and_wrap!()(e.clone())) } else if stop_first { self.disable_senders_without_tracks( @@ -1509,12 +1494,8 @@ impl InnerRoom { } })?; - // false positive: output expression is not input one - #[allow(clippy::redundant_closure_call)] E::errored(tracerr::map_from_and_wrap!()(e.clone())) } else { - // false positive: output expression is not input one - #[allow(clippy::redundant_closure_call)] E::errored(tracerr::map_from_and_wrap!()(e.clone())) }; @@ -1936,7 +1917,9 @@ impl Drop for InnerRoom { } #[cfg(feature = "mockable")] -#[allow(clippy::multiple_inherent_impl)] +// TODO: Try remove on next Rust version upgrade. +#[expect(clippy::allow_attributes, reason = "`#[expect]` is not considered")] +#[allow(clippy::multiple_inherent_impl, reason = "feature gated")] impl Room { /// Returns [`PeerConnection`] stored in repository by its ID. /// diff --git a/src/rpc/rpc_session.rs b/src/rpc/rpc_session.rs index 3af18a9d2..c489745c8 100644 --- a/src/rpc/rpc_session.rs +++ b/src/rpc/rpc_session.rs @@ -91,7 +91,6 @@ impl Caused for ConnectionLostReason { /// Client to talk with server via Client API RPC. #[async_trait(?Send)] #[cfg_attr(feature = "mockable", mockall::automock)] -#[cfg_attr(feature = "mockable", allow(clippy::missing_docs_in_private_items))] pub trait RpcSession { /// Tries to upgrade [`SessionState`] of this [`RpcSession`] to /// [`SessionState::Opened`]. diff --git a/src/utils/component.rs b/src/utils/component.rs index 934124bae..4b4e9f792 100644 --- a/src/utils/component.rs +++ b/src/utils/component.rs @@ -171,7 +171,7 @@ impl WatchersSpawner { } /// Creates new [`WatchersSpawner`] for the provided object and state. - fn new(state: Rc, obj: Rc) -> Self { + const fn new(state: Rc, obj: Rc) -> Self { Self { state, obj,