Skip to content

Commit

Permalink
fix clippy warning
Browse files Browse the repository at this point in the history
  • Loading branch information
yngrtc committed Sep 7, 2024
1 parent 7d5ee0a commit 76f780a
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 23 deletions.
6 changes: 1 addition & 5 deletions interceptor/src/nack/generator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,7 @@ impl InterceptorBuilder for GeneratorBuilder {
let (close_tx, close_rx) = mpsc::channel(1);
Ok(Arc::new(Generator {
internal: Arc::new(GeneratorInternal {
log2_size_minus_6: if let Some(log2_size_minus_6) = self.log2_size_minus_6 {
log2_size_minus_6
} else {
13 - 6 // 8192 = 1 << 13
},
log2_size_minus_6: self.log2_size_minus_6.unwrap_or(13 - 6), // 8192 = 1 << 13
skip_last_n: self.skip_last_n.unwrap_or_default(),
interval: if let Some(interval) = self.interval {
interval
Expand Down
6 changes: 1 addition & 5 deletions interceptor/src/nack/responder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,7 @@ impl InterceptorBuilder for ResponderBuilder {
fn build(&self, _id: &str) -> Result<Arc<dyn Interceptor + Send + Sync>> {
Ok(Arc::new(Responder {
internal: Arc::new(ResponderInternal {
log2_size: if let Some(log2_size) = self.log2_size {
log2_size
} else {
13 // 8192 = 1 << 13
},
log2_size: self.log2_size.unwrap_or(13), // 8192 = 1 << 13
streams: Arc::new(Mutex::new(HashMap::new())),
}),
}))
Expand Down
5 changes: 1 addition & 4 deletions rtcp/src/raw_packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ impl fmt::Display for RawPacket {
impl Packet for RawPacket {
/// Header returns the Header associated with this packet.
fn header(&self) -> Header {
match Header::unmarshal(&mut self.0.clone()) {
Ok(h) => h,
Err(_) => Header::default(),
}
Header::unmarshal(&mut self.0.clone()).unwrap_or_default()
}

/// destination_ssrc returns an array of SSRC values that this packet refers to.
Expand Down
6 changes: 1 addition & 5 deletions turn/src/server/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -952,11 +952,7 @@ pub(crate) fn rand_seq(n: usize) -> String {
for b in &mut buf {
*b = letters[rand::random::<usize>() % letters.len()];
}
if let Ok(s) = String::from_utf8(buf) {
s
} else {
String::new()
}
String::from_utf8(buf).unwrap_or_default()
}

pub(crate) fn build_nonce() -> Result<String> {
Expand Down
5 changes: 1 addition & 4 deletions util/src/vnet/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -445,10 +445,7 @@ impl Net {

Net::VNet(Arc::new(Mutex::new(vnet)))
} else {
let interfaces = match ifaces::ifaces() {
Ok(ifs) => ifs,
Err(_) => vec![],
};
let interfaces = ifaces::ifaces().unwrap_or_default();

let mut m: HashMap<String, Vec<IpNet>> = HashMap::new();
for iface in interfaces {
Expand Down

0 comments on commit 76f780a

Please sign in to comment.