Skip to content

Commit

Permalink
rust: fix basic warnings and clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-abramov committed Dec 31, 2023
1 parent eb15187 commit f270ad8
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions livekit-ffi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use std::{borrow::Cow, sync::Arc};
use std::{borrow::Cow};

use lazy_static::lazy_static;
use livekit::prelude::*;
use prost::Message;
use server::FfiDataBuffer;


use thiserror::Error;

mod conversion;
Expand Down
2 changes: 1 addition & 1 deletion livekit-ffi/src/server/room.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ impl RoomInner {
server.async_runtime.spawn(async move {
let cb = proto::PublishDataCallback {
async_id,
error: Some(format!("failed to send data, room closed: {}", err).into()),
error: Some(format!("failed to send data, room closed: {}", err)),
};

let _ = server.send_event(proto::ffi_event::Message::PublishData(cb)).await;
Expand Down
2 changes: 1 addition & 1 deletion livekit/src/room/e2ee/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ impl E2eeManager {
let state_changed = self.state_changed.clone();
frame_cryptor.on_state_change(Some(Box::new(move |participant_identity, state| {
if let Some(state_changed) = state_changed.lock().as_ref() {
state_changed(participant_identity.try_into().unwrap(), state);
state_changed(participant_identity.into(), state);
}
})));
}
Expand Down
4 changes: 2 additions & 2 deletions livekit/src/room/participant/local_participant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use crate::{
options::{compute_video_encodings, video_layers_from_encodings, TrackPublishOptions},
prelude::*,
rtc_engine::RtcEngine,
DataPacket, DataPacketKind,
DataPacket,
};

type LocalTrackPublishedHandler = Box<dyn Fn(LocalParticipant, LocalTrackPublication) + Send>;
Expand Down Expand Up @@ -272,7 +272,7 @@ impl LocalParticipant {

pub async fn publish_data(&self, packet: DataPacket) -> RoomResult<()> {
let data = proto::DataPacket {
kind: DataPacketKind::from(packet.kind) as i32,
kind: packet.kind as i32,
value: Some(proto::data_packet::Value::User(proto::UserPacket {
payload: packet.payload,
topic: packet.topic,
Expand Down
2 changes: 1 addition & 1 deletion livekit/src/room/publication/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ pub(super) fn new_inner(
let info = PublicationInfo {
track,
proto_info: info.clone(),
source: info.source().try_into().unwrap(),
source: info.source().into(),
kind: info.r#type().try_into().unwrap(),
encryption_type: info.encryption().into(),
name: info.name,
Expand Down
4 changes: 2 additions & 2 deletions webrtc-sys/src/rtc_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ mod tests {

assert_eq!(error.error_type, RtcErrorType::InternalError);
assert_eq!(error.error_detail, RtcErrorDetailType::DataChannelFailure);
assert_eq!(error.has_sctp_cause_code, true);
assert!(error.has_sctp_cause_code);
assert_eq!(error.sctp_cause_code, 24);
assert_eq!(error.message, "this is not a test, I repeat, this is not a test");
}
Expand All @@ -129,7 +129,7 @@ mod tests {

assert_eq!(error.error_type, RtcErrorType::InvalidModification);
assert_eq!(error.error_detail, RtcErrorDetailType::None);
assert_eq!(error.has_sctp_cause_code, false);
assert!(!error.has_sctp_cause_code);
assert_eq!(error.sctp_cause_code, 0);
assert_eq!(error.message, "exception is thrown!");
}
Expand Down

0 comments on commit f270ad8

Please sign in to comment.