Skip to content

Commit

Permalink
Upgrade to 1.81 Rust
Browse files Browse the repository at this point in the history
- bump up MSRV to 1.81
- tune Clippy lints
- update Cargo deps
- upgrade Chrome to 127.0 version and Firefox to 130.0 version
  • Loading branch information
tyranron committed Sep 11, 2024
1 parent 8642361 commit fe29ee2
Show file tree
Hide file tree
Showing 107 changed files with 550 additions and 526 deletions.
281 changes: 126 additions & 155 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>"]
license = "MPL-2.0"
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion crates/medea-macro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>"]
license = "BlueOak-1.0.0"
Expand Down
4 changes: 4 additions & 0 deletions crates/medea-macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion crates/medea-reactive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>"]
license = "BlueOak-1.0.0"
Expand Down
4 changes: 2 additions & 2 deletions crates/medea-reactive/src/collections/hash_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -341,7 +341,7 @@ impl<K, V, S: SubscribersStore<(K, V), O>, O> Drop for HashMap<K, V, S, O> {
/// 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));
}
Expand Down
4 changes: 2 additions & 2 deletions crates/medea-reactive/src/collections/hash_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
}
Expand Down
3 changes: 2 additions & 1 deletion crates/medea-reactive/src/collections/mod.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crates/medea-reactive/src/collections/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion crates/medea-reactive/src/field/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down
6 changes: 3 additions & 3 deletions crates/medea-reactive/src/field/mod.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -219,7 +220,6 @@ pub trait OnObservableFieldModification<D> {
/// Subscriber that implements subscribing and [`Whenable`] in [`Vec`].
///
/// This structure should be wrapped into [`Vec`].
#[allow(variant_size_differences)]
pub enum UniversalSubscriber<D> {
/// Subscriber for [`Whenable`].
When {
Expand Down Expand Up @@ -311,7 +311,7 @@ impl<D: Clone> OnObservableFieldModification<D>
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()
Expand Down
4 changes: 4 additions & 0 deletions crates/medea-reactive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub struct Guard(Rc<ObservableCell<u32>>);
impl Guard {
/// Creates new [`Guard`] on the given `counter`.
fn new(counter: Rc<ObservableCell<u32>>) -> Self {
#[allow(clippy::expect_used)] // intentional
#[expect(clippy::expect_used, reason = "overflowing is unexpected")]
counter.mutate(|mut c| {
*c = c
.checked_add(1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub type Factory<'a, T> = Box<dyn Fn() -> 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<I, T>(futures: I) -> AllProcessed<'static>
where
I: IntoIterator<Item = Factory<'static, T>>,
Expand Down Expand Up @@ -80,7 +80,7 @@ impl<T> 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
Expand Down
2 changes: 1 addition & 1 deletion e2e/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>"]
publish = false
Expand Down
3 changes: 2 additions & 1 deletion e2e/src/browser/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ impl From<JsResult> for Result<Json> {
/// 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`].
Expand Down
4 changes: 3 additions & 1 deletion e2e/src/browser/mock/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion e2e/src/browser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T> = std::result::Result<T, Error>;

/// [WebDriver] handle of a browser window.
Expand Down
11 changes: 9 additions & 2 deletions e2e/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions e2e/src/object/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -96,7 +97,7 @@ impl<T> Drop for Object<T> {
impl<T> Object<T> {
/// 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,
Expand Down
2 changes: 1 addition & 1 deletion e2e/src/object/remote_track.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub enum MediaDirection {

impl From<MediaDirection> 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
}
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub enum Error {
Reqwest(reqwest::Error),
}

#[allow(clippy::absolute_paths)] // intentional
#[expect(clippy::absolute_paths, reason = "one liner")]
type Result<T> = std::result::Result<T, Error>;

/// Client of a Control API.
Expand Down
2 changes: 1 addition & 1 deletion mock/control-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>"]
license = "BlueOak-1.0.0"
Expand Down
2 changes: 1 addition & 1 deletion mock/control-api/src/api/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<proto::member::Element> for Endpoint {
fn from(proto: proto::member::Element) -> Self {
match proto.el.unwrap() {
Expand Down
12 changes: 8 additions & 4 deletions mock/control-api/src/api/member.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down
Loading

0 comments on commit fe29ee2

Please sign in to comment.