Skip to content

Commit a5a51ef

Browse files
rust: fix basic warnings and clippy
1 parent eb15187 commit a5a51ef

File tree

6 files changed

+8
-10
lines changed

6 files changed

+8
-10
lines changed

livekit-ffi/src/lib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,10 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
use std::{borrow::Cow, sync::Arc};
15+
use std::borrow::Cow;
1616

1717
use lazy_static::lazy_static;
1818
use livekit::prelude::*;
19-
use prost::Message;
20-
use server::FfiDataBuffer;
2119
use thiserror::Error;
2220

2321
mod conversion;

livekit-ffi/src/server/room.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ impl RoomInner {
217217
server.async_runtime.spawn(async move {
218218
let cb = proto::PublishDataCallback {
219219
async_id,
220-
error: Some(format!("failed to send data, room closed: {}", err).into()),
220+
error: Some(format!("failed to send data, room closed: {}", err)),
221221
};
222222

223223
let _ = server.send_event(proto::ffi_event::Message::PublishData(cb)).await;

livekit/src/room/e2ee/manager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ impl E2eeManager {
131131
let state_changed = self.state_changed.clone();
132132
frame_cryptor.on_state_change(Some(Box::new(move |participant_identity, state| {
133133
if let Some(state_changed) = state_changed.lock().as_ref() {
134-
state_changed(participant_identity.try_into().unwrap(), state);
134+
state_changed(participant_identity.into(), state);
135135
}
136136
})));
137137
}

livekit/src/room/participant/local_participant.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use crate::{
2525
options::{compute_video_encodings, video_layers_from_encodings, TrackPublishOptions},
2626
prelude::*,
2727
rtc_engine::RtcEngine,
28-
DataPacket, DataPacketKind,
28+
DataPacket,
2929
};
3030

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

273273
pub async fn publish_data(&self, packet: DataPacket) -> RoomResult<()> {
274274
let data = proto::DataPacket {
275-
kind: DataPacketKind::from(packet.kind) as i32,
275+
kind: packet.kind as i32,
276276
value: Some(proto::data_packet::Value::User(proto::UserPacket {
277277
payload: packet.payload,
278278
topic: packet.topic,

livekit/src/room/publication/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ pub(super) fn new_inner(
117117
let info = PublicationInfo {
118118
track,
119119
proto_info: info.clone(),
120-
source: info.source().try_into().unwrap(),
120+
source: info.source().into(),
121121
kind: info.r#type().try_into().unwrap(),
122122
encryption_type: info.encryption().into(),
123123
name: info.name,

webrtc-sys/src/rtc_error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ mod tests {
117117

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

130130
assert_eq!(error.error_type, RtcErrorType::InvalidModification);
131131
assert_eq!(error.error_detail, RtcErrorDetailType::None);
132-
assert_eq!(error.has_sctp_cause_code, false);
132+
assert!(!error.has_sctp_cause_code);
133133
assert_eq!(error.sctp_cause_code, 0);
134134
assert_eq!(error.message, "exception is thrown!");
135135
}

0 commit comments

Comments
 (0)