Skip to content
This repository has been archived by the owner on Aug 25, 2021. It is now read-only.

Draft: Upgrade stable Rust to 1.54 version #215

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
486 changes: 260 additions & 226 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 @@ -68,7 +68,7 @@ smart-default = "0.6"
subtle = { version = "2.2", default-features = false }
tokio = { version = "1.5", features = ["signal", "time"] }
toml = "0.5"
tonic = "0.4"
tonic = "0.5"
url = "2.1"
[dependencies.deadpool]
version = "0.8"
Expand Down
2 changes: 1 addition & 1 deletion crates/medea-macro/src/dispatchable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ pub fn expand(item: Item, args: &Args) -> TokenStream {

let handler_kind = args.dispatch_with_handler_arg();
let method_doc = item.dispatch_with_method_doc();
let handler_trait = item.handler_trait(&args);
let handler_trait = item.handler_trait(args);
let maybe_async = args.maybe_async_token();
let maybe_await = args.maybe_await_token();
let orig_enum = item.orig_enum;
Expand Down
4 changes: 2 additions & 2 deletions crates/medea-reactive/src/field/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ where

#[inline]
fn deref(&self) -> &Self::Target {
&self.data
self.data
}
}

Expand All @@ -402,7 +402,7 @@ where
#[inline]
fn drop(&mut self) {
if self.data != &self.value_before_mutation {
self.subs.on_modify(&self.data);
self.subs.on_modify(self.data);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ where
I: IntoIterator<Item = Factory<'static, T>>,
T: 'static,
{
#[allow(clippy::needless_collect)]
let futures: Vec<_> = futures.into_iter().collect();
AllProcessed::new(Box::new(move || {
let futures = futures.iter().map(AsRef::as_ref).map(|f| f());
Expand Down
2 changes: 1 addition & 1 deletion jason/src/api/dart/audio_track_constraints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub unsafe extern "C" fn AudioTrackConstraints__device_id(
mut this: ptr::NonNull<AudioTrackConstraints>,
device_id: ptr::NonNull<c_char>,
) {
this.as_mut().device_id(c_str_into_string(device_id))
this.as_mut().device_id(c_str_into_string(device_id));
}

/// Frees the data behind the provided pointer.
Expand Down
2 changes: 1 addition & 1 deletion jason/src/api/dart/reconnect_handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl From<Traced<SessionError>> for DartError {
SE::AuthorizationFailed => Some(Kind::AuthorizationFailed),
SE::ConnectionLost(reason) => {
if let Reason::ConnectError(err) = reason {
cause = err.into_inner().js_cause()
cause = err.into_inner().js_cause();
};
Some(Kind::ConnectionLost)
}
Expand Down
2 changes: 1 addition & 1 deletion jason/src/api/wasm/local_media_track.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl LocalMediaTrack {
/// [1]: https://w3.org/TR/mediacapture-streams#dom-mediastreamtrack
#[must_use]
pub fn get_track(&self) -> web_sys::MediaStreamTrack {
Clone::clone(&self.0.get_track().as_ref())
Clone::clone(self.0.get_track().as_ref())
}

/// Returns a [`MediaKind::Audio`] if this [`LocalMediaTrack`] represents an
Expand Down
6 changes: 3 additions & 3 deletions jason/src/api/wasm/media_stream_settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ impl MediaStreamSettings {
///
/// [1]: https://w3.org/TR/mediacapture-streams#mediastreamtrack
pub fn audio(&mut self, constraints: AudioTrackConstraints) {
self.0.audio(constraints.into())
self.0.audio(constraints.into());
}

/// Set constraints that will be used to obtain a local video sourced from
Expand Down Expand Up @@ -103,14 +103,14 @@ impl DeviceVideoTrackConstraints {
///
/// [1]: https://w3.org/TR/mediacapture-streams#dom-constraindomstring
pub fn ideal_facing_mode(&mut self, facing_mode: FacingMode) {
self.0.ideal_facing_mode(facing_mode.into())
self.0.ideal_facing_mode(facing_mode.into());
}

/// Sets an exact [`height`][1] constraint.
///
/// [1]: https://tinyurl.com/w3-streams#def-constraint-height
pub fn exact_height(&mut self, height: u32) {
self.0.exact_height(height)
self.0.exact_height(height);
}

/// Sets an ideal [`height`][1] constraint.
Expand Down
4 changes: 2 additions & 2 deletions jason/src/api/wasm/remote_media_track.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ impl RemoteMediaTrack {

/// Sets callback, invoked when this [`RemoteMediaTrack`] is enabled.
pub fn on_enabled(&self, cb: js_sys::Function) {
self.0.on_enabled(cb.into())
self.0.on_enabled(cb.into());
}

/// Sets callback, invoked when this [`RemoteMediaTrack`] is disabled.
pub fn on_disabled(&self, cb: js_sys::Function) {
self.0.on_disabled(cb.into())
self.0.on_disabled(cb.into());
}

/// Sets callback to invoke when this [`RemoteMediaTrack`] is muted.
Expand Down
6 changes: 3 additions & 3 deletions jason/src/media/constraints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,14 @@ impl LocalTracksConstraints {
&self,
settings: &MediaStreamSettings,
) -> LocalStreamUpdateCriteria {
self.0.borrow().calculate_kinds_diff(&settings)
self.0.borrow().calculate_kinds_diff(settings)
}

/// Constrains the underlying [`MediaStreamSettings`] with the given `other`
/// [`MediaStreamSettings`].
#[inline]
pub fn constrain(&self, other: MediaStreamSettings) {
self.0.borrow_mut().constrain(other)
self.0.borrow_mut().constrain(other);
}

/// Clones the underlying [`MediaStreamSettings`].
Expand Down Expand Up @@ -150,7 +150,7 @@ impl LocalTracksConstraints {
) {
self.0
.borrow_mut()
.set_media_exchange_state_by_kinds(state, kinds)
.set_media_exchange_state_by_kinds(state, kinds);
}

/// Indicates whether provided [`MediaType`] is enabled in the underlying
Expand Down
2 changes: 1 addition & 1 deletion jason/src/peer/media/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ impl MediaConnections {
{
if let Some(mid) = receiver.mid() {
if let Some(trnscvr) = inner.peer.get_transceiver_by_mid(&mid) {
receiver.replace_transceiver(trnscvr)
receiver.replace_transceiver(trnscvr);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion jason/src/peer/media/receiver/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ impl Component {
) -> Result<(), Infallible> {
receiver.muted.set(muted);
if let Some(track) = receiver.track.borrow().as_ref() {
track.set_muted(muted)
track.set_muted(muted);
}
Ok(())
}
Expand Down
6 changes: 3 additions & 3 deletions jason/src/peer/media/transitable_state/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,9 @@ where
pub fn when_stabilized(self: Rc<Self>) -> Processed<'static, ()> {
Processed::new(Box::new(move || {
let stable = self.subscribe_stable();
Box::pin(
async move { stable.fuse().select_next_some().map(drop).await },
)
Box::pin(async move {
stable.fuse().select_next_some().map(drop).await;
})
}))
}

Expand Down
4 changes: 2 additions & 2 deletions jason/src/peer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ impl PeerConnection {
id,
&sender,
peer_connection_state,
)
);
},
));

Expand Down Expand Up @@ -451,7 +451,7 @@ impl PeerConnection {
/// [`Sender`]: sender::Sender
#[inline]
pub async fn drop_send_tracks(&self, kinds: LocalStreamUpdateCriteria) {
self.media_connections.drop_send_tracks(kinds).await
self.media_connections.drop_send_tracks(kinds).await;
}

/// Filters out already sent stats, and send new stats from the provided
Expand Down
2 changes: 1 addition & 1 deletion jason/src/peer/stream_update_criteria.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl LocalStreamUpdateCriteria {
#[inline]
pub fn add(&mut self, media_kind: MediaKind, source_kind: MediaSourceKind) {
self.0
.bitor_assign(Self::from_kinds(media_kind, Some(source_kind)).0)
.bitor_assign(Self::from_kinds(media_kind, Some(source_kind)).0);
}

/// Checks whether this [`LocalStreamUpdateCriteria`] contains the provided
Expand Down
2 changes: 1 addition & 1 deletion jason/src/platform/callback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl Callback<()> {
#[inline]
pub fn call0(&self) {
if let Some(f) = self.0.borrow().as_ref() {
f.call0()
f.call0();
};
}
}
Expand Down
6 changes: 3 additions & 3 deletions jason/src/platform/dart/constraints.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Media tracks and streams constraints functionality.

use derive_more::{AsRef, Into};
use derive_more::AsRef;

use crate::media::{
AudioTrackConstraints, DeviceVideoTrackConstraints,
Expand All @@ -10,7 +10,7 @@ use crate::media::{
/// [MediaStreamConstraints][1] wrapper.
///
/// [1]: https://w3.org/TR/mediacapture-streams/#dom-mediastreamconstraints
#[derive(AsRef, Debug, Into)]
#[derive(AsRef, Debug)]
pub struct MediaStreamConstraints;

impl MediaStreamConstraints {
Expand Down Expand Up @@ -49,7 +49,7 @@ impl Default for MediaStreamConstraints {
/// [DisplayMediaStreamConstraints][1] wrapper.
///
/// [1]: https://w3.org/TR/screen-capture/#dom-displaymediastreamconstraints
#[derive(AsRef, Debug, Into)]
#[derive(AsRef, Debug)]
pub struct DisplayMediaStreamConstraints();

impl Default for DisplayMediaStreamConstraints {
Expand Down
4 changes: 3 additions & 1 deletion jason/src/platform/dart/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ impl Drop for Error {
#[inline]
fn drop(&mut self) {
if Rc::strong_count(&self.0) == 1 {
unsafe { Dart_DeletePersistentHandle_DL_Trampolined(*self.0) }
unsafe {
Dart_DeletePersistentHandle_DL_Trampolined(*self.0);
}
}
}
}
6 changes: 4 additions & 2 deletions jason/src/platform/dart/executor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ pub unsafe extern "C" fn rust_executor_poll_task(
/// specific [`Task`].
#[no_mangle]
pub unsafe extern "C" fn rust_executor_drop_task(task: ptr::NonNull<Task>) {
drop(Rc::from_raw(task.as_ptr()))
drop(Rc::from_raw(task.as_ptr()));
}

/// Commands an external Dart executor to poll the provided [`Task`].
Expand All @@ -94,6 +94,8 @@ fn task_wake(task: ptr::NonNull<Task>) {
unsafe { Dart_PostCObject_DL_Trampolined(wake_port, &mut task_addr) };
if !enqueued {
log::warn!("Could not send message to Dart's native port");
unsafe { rust_executor_drop_task(task) };
unsafe {
rust_executor_drop_task(task);
}
}
}
3 changes: 3 additions & 0 deletions jason/src/platform/dart/media_devices.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use crate::platform::{
///
/// [1]: https://tinyurl.com/w3-streams#dom-mediadevices-enumeratedevices
/// [2]: https://w3.org/TR/mediacapture-streams#mediadevices
#[allow(clippy::unused_async)]
pub async fn enumerate_devices() -> Result<Vec<InputDeviceInfo>, Traced<Error>>
{
unimplemented!()
Expand All @@ -37,6 +38,7 @@ pub async fn enumerate_devices() -> Result<Vec<InputDeviceInfo>, Traced<Error>>
///
/// [1]: https://w3.org/TR/mediacapture-streams#dom-mediadevices-getusermedia
/// [2]: https://w3.org/TR/mediacapture-streams#mediadevices
#[allow(clippy::unused_async)]
pub async fn get_user_media(
caps: MediaStreamConstraints,
) -> Result<Vec<MediaStreamTrack>, Traced<Error>> {
Expand All @@ -56,6 +58,7 @@ pub async fn get_user_media(
///
/// [1]: https://w3.org/TR/screen-capture/#dom-mediadevices-getdisplaymedia
/// [2]: https://w3.org/TR/mediacapture-streams#mediadevices
#[allow(clippy::unused_async)]
pub async fn get_display_media(
caps: DisplayMediaStreamConstraints,
) -> Result<Vec<MediaStreamTrack>, Traced<Error>> {
Expand Down
1 change: 1 addition & 0 deletions jason/src/platform/dart/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ pub fn init_logger() {
/// [`Future`] which resolves after the provided [`Duration`].
///
/// [`Future`]: std::future::Future
#[allow(clippy::unused_async)]
pub async fn delay_for(delay: Duration) {
unimplemented!()
}
4 changes: 3 additions & 1 deletion jason/src/platform/dart/utils/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ impl<T: Into<DartValue>> Function<T> {
impl<T> Drop for Function<T> {
/// Manually deallocates saved [`Dart_PersistentHandle`] so it won't leak.
fn drop(&mut self) {
unsafe { Dart_DeletePersistentHandle_DL_Trampolined(self.dart_fn) };
unsafe {
Dart_DeletePersistentHandle_DL_Trampolined(self.dart_fn);
}
}
}
2 changes: 1 addition & 1 deletion jason/src/platform/wasm/media_track.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ impl MediaStreamTrack {
/// [3]: https://tinyurl.com/w3-streams#idl-def-MediaStreamTrackState.ended
#[inline]
pub fn stop(&self) {
self.sys_track.stop()
self.sys_track.stop();
}

/// Returns an [`enabled`][1] attribute of the underlying
Expand Down
2 changes: 1 addition & 1 deletion jason/src/platform/wasm/peer_connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ impl RtcPeerConnection {
sdp_m_line_index: Option<u16>,
sdp_mid: &Option<String>,
) -> Result<()> {
let mut cand_init = RtcIceCandidateInit::new(&candidate);
let mut cand_init = RtcIceCandidateInit::new(candidate);
cand_init
.sdp_m_line_index(sdp_m_line_index)
.sdp_mid(sdp_mid.as_ref().map(String::as_ref));
Expand Down
2 changes: 1 addition & 1 deletion jason/src/platform/wasm/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ struct InnerSocket {

impl InnerSocket {
fn new(url: &str) -> Result<Self> {
let socket = SysWebSocket::new(&url)
let socket = SysWebSocket::new(url)
.map_err(Into::into)
.map_err(TransportError::CreateSocket)
.map_err(tracerr::wrap!())?;
Expand Down
2 changes: 1 addition & 1 deletion jason/src/platform/wasm/utils/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ impl<A: Into<wasm_bindgen::JsValue>> Callback<A> {
#[inline]
pub fn call1<T: Into<A>>(&self, arg: T) {
if let Some(f) = self.0.borrow().as_ref() {
f.call1(arg.into())
f.call1(arg.into());
};
}
}
Expand Down
2 changes: 1 addition & 1 deletion jason/src/room.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1150,7 +1150,7 @@ impl InnerRoom {
self.recv_constraints.set_enabled(exchange == Enabled, kind);
}
(Recv, Mute(_)) => {
unreachable!("Receivers muting is not implemented")
unreachable!("Receivers muting is not implemented");
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion jason/src/rpc/rpc_session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ impl WebSocketRpcSession {
let this = upgrade_or_break!(weak_this);
msg.dispatch_with(this.as_ref());
}
})
});
}
}

Expand Down
6 changes: 3 additions & 3 deletions jason/src/rpc/websocket/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ impl WebSocketRpcClient {
log::error!(
"Failed to update socket settings because Heartbeat is \
None",
)
);
}
None
}
Expand Down Expand Up @@ -425,7 +425,7 @@ impl WebSocketRpcClient {
platform::spawn(async move {
while let Some(msg) = on_socket_message.next().await {
if let Some(this) = weak_this.upgrade() {
this.on_transport_message(msg)
this.on_transport_message(msg);
}
}
});
Expand Down Expand Up @@ -555,7 +555,7 @@ impl WebSocketRpcClient {
/// dropped.
#[inline]
pub fn set_close_reason(&self, close_reason: ClientDisconnect) {
self.0.borrow_mut().close_reason = close_reason
self.0.borrow_mut().close_reason = close_reason;
}
}

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 @@ -32,4 +32,4 @@ slog-scope = "4.3"
slog-stdlog = "4.0"
slog-term = "2.5"
smart-default = "0.6"
tonic = "0.4"
tonic = "0.5"
Loading