Fix various clippy warnings

This commit is contained in:
Sebastian Dröge 2019-02-21 20:12:09 +02:00
parent 5e80f2fab4
commit aa325ea98d
10 changed files with 35 additions and 36 deletions

View file

@ -213,7 +213,6 @@ impl State {
}; };
// Clear the internal buffer // Clear the internal buffer
drop(first_buf);
self.internal_buffer.clear(); self.internal_buffer.clear();
Ok(Some(buffer)) Ok(Some(buffer))

View file

@ -891,7 +891,7 @@ impl StreamingState {
); );
drop(data); drop(data);
adapter.flush((tag_header.data_size - 1) as usize); adapter.flush((tag_header.data_size - 1) as usize);
return Ok(true); Ok(true)
} }
Err(nom::Err::Incomplete(_)) => unreachable!(), Err(nom::Err::Incomplete(_)) => unreachable!(),
Ok((_, header)) => { Ok((_, header)) => {
@ -1060,7 +1060,7 @@ impl StreamingState {
); );
drop(data); drop(data);
adapter.flush((tag_header.data_size - 1) as usize); adapter.flush((tag_header.data_size - 1) as usize);
return Ok(None); Ok(None)
} }
Err(nom::Err::Incomplete(_)) => unreachable!(), Err(nom::Err::Incomplete(_)) => unreachable!(),
Ok((_, header)) => { Ok((_, header)) => {

View file

@ -36,7 +36,7 @@ use rand;
use iocontext::*; use iocontext::*;
const DEFAULT_CONTEXT: &'static str = ""; const DEFAULT_CONTEXT: &str = "";
const DEFAULT_CONTEXT_WAIT: u32 = 0; const DEFAULT_CONTEXT_WAIT: u32 = 0;
const DEFAULT_CAPS: Option<gst::Caps> = None; const DEFAULT_CAPS: Option<gst::Caps> = None;
const DEFAULT_MAX_BUFFERS: u32 = 10; const DEFAULT_MAX_BUFFERS: u32 = 10;
@ -219,11 +219,11 @@ impl AppSrc {
let caps = if let Some(ref caps) = state.configured_caps { let caps = if let Some(ref caps) = state.configured_caps {
q.get_filter() q.get_filter()
.map(|f| f.intersect_with_mode(caps, gst::CapsIntersectMode::First)) .map(|f| f.intersect_with_mode(caps, gst::CapsIntersectMode::First))
.unwrap_or(caps.clone()) .unwrap_or_else(|| caps.clone())
} else { } else {
q.get_filter() q.get_filter()
.map(|f| f.to_owned()) .map(|f| f.to_owned())
.unwrap_or(gst::Caps::new_any()) .unwrap_or_else(|| gst::Caps::new_any())
}; };
q.set_result(&caps); q.set_result(&caps);
@ -565,7 +565,7 @@ impl ObjectSubclass for AppSrc {
gst::DebugColorFlags::empty(), gst::DebugColorFlags::empty(),
"Thread-sharing app source", "Thread-sharing app source",
), ),
src_pad: src_pad, src_pad,
state: Mutex::new(State::default()), state: Mutex::new(State::default()),
settings: Mutex::new(Settings::default()), settings: Mutex::new(Settings::default()),
} }

View file

@ -106,9 +106,9 @@ impl DataQueue {
queue: VecDeque::new(), queue: VecDeque::new(),
cur_size_buffers: 0, cur_size_buffers: 0,
cur_size_bytes: 0, cur_size_bytes: 0,
max_size_buffers: max_size_buffers, max_size_buffers,
max_size_bytes: max_size_bytes, max_size_bytes,
max_size_time: max_size_time, max_size_time,
current_task: None, current_task: None,
shutdown_receiver: None, shutdown_receiver: None,
}))) })))

View file

@ -43,12 +43,12 @@ lazy_static! {
Mutex::new(HashMap::new()); Mutex::new(HashMap::new());
} }
const DEFAULT_PROXY_CONTEXT: &'static str = ""; const DEFAULT_PROXY_CONTEXT: &str = "";
const DEFAULT_MAX_SIZE_BUFFERS: u32 = 200; const DEFAULT_MAX_SIZE_BUFFERS: u32 = 200;
const DEFAULT_MAX_SIZE_BYTES: u32 = 1024 * 1024; const DEFAULT_MAX_SIZE_BYTES: u32 = 1024 * 1024;
const DEFAULT_MAX_SIZE_TIME: u64 = gst::SECOND_VAL; const DEFAULT_MAX_SIZE_TIME: u64 = gst::SECOND_VAL;
const DEFAULT_CONTEXT: &'static str = ""; const DEFAULT_CONTEXT: &str = "";
const DEFAULT_CONTEXT_WAIT: u32 = 0; const DEFAULT_CONTEXT_WAIT: u32 = 0;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
@ -395,7 +395,7 @@ impl ProxySink {
let res = if let Some((ref mut task, _, ref mut items)) = *pending_queue let res = if let Some((ref mut task, _, ref mut items)) = *pending_queue
{ {
if let &Some(ref queue) = queue { if let Some(ref queue) = queue {
let mut failed_item = None; let mut failed_item = None;
while let Some(item) = items.pop_front() { while let Some(item) = items.pop_front() {
if let Err(item) = queue.push(item) { if let Err(item) = queue.push(item) {
@ -695,7 +695,7 @@ impl ObjectSubclass for ProxySink {
gst::DebugColorFlags::empty(), gst::DebugColorFlags::empty(),
"Thread-sharing proxy sink", "Thread-sharing proxy sink",
), ),
sink_pad: sink_pad, sink_pad,
state: Mutex::new(StateSink::default()), state: Mutex::new(StateSink::default()),
settings: Mutex::new(SettingsSink::default()), settings: Mutex::new(SettingsSink::default()),
} }
@ -854,11 +854,11 @@ impl ProxySrc {
let caps = if let Some(ref caps) = self.src_pad.get_current_caps() { let caps = if let Some(ref caps) = self.src_pad.get_current_caps() {
q.get_filter() q.get_filter()
.map(|f| f.intersect_with_mode(caps, gst::CapsIntersectMode::First)) .map(|f| f.intersect_with_mode(caps, gst::CapsIntersectMode::First))
.unwrap_or(caps.clone()) .unwrap_or_else(|| caps.clone())
} else { } else {
q.get_filter() q.get_filter()
.map(|f| f.to_owned()) .map(|f| f.to_owned())
.unwrap_or(gst::Caps::new_any()) .unwrap_or_else(|| gst::Caps::new_any())
}; };
q.set_result(&caps); q.set_result(&caps);
@ -1223,7 +1223,7 @@ impl ObjectSubclass for ProxySrc {
gst::DebugColorFlags::empty(), gst::DebugColorFlags::empty(),
"Thread-sharing proxy source", "Thread-sharing proxy source",
), ),
src_pad: src_pad, src_pad,
state: Mutex::new(StateSrc::default()), state: Mutex::new(StateSrc::default()),
settings: Mutex::new(SettingsSrc::default()), settings: Mutex::new(SettingsSrc::default()),
} }

View file

@ -40,7 +40,7 @@ use iocontext::*;
const DEFAULT_MAX_SIZE_BUFFERS: u32 = 200; const DEFAULT_MAX_SIZE_BUFFERS: u32 = 200;
const DEFAULT_MAX_SIZE_BYTES: u32 = 1024 * 1024; const DEFAULT_MAX_SIZE_BYTES: u32 = 1024 * 1024;
const DEFAULT_MAX_SIZE_TIME: u64 = gst::SECOND_VAL; const DEFAULT_MAX_SIZE_TIME: u64 = gst::SECOND_VAL;
const DEFAULT_CONTEXT: &'static str = ""; const DEFAULT_CONTEXT: &str = "";
const DEFAULT_CONTEXT_WAIT: u32 = 0; const DEFAULT_CONTEXT_WAIT: u32 = 0;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
@ -846,8 +846,8 @@ impl ObjectSubclass for Queue {
gst::DebugColorFlags::empty(), gst::DebugColorFlags::empty(),
"Thread-sharing queue", "Thread-sharing queue",
), ),
sink_pad: sink_pad, sink_pad,
src_pad: src_pad, src_pad,
state: Mutex::new(State::default()), state: Mutex::new(State::default()),
settings: Mutex::new(Settings::default()), settings: Mutex::new(Settings::default()),
} }

View file

@ -70,8 +70,8 @@ impl<T: SocketRead + 'static> Socket<T> {
Socket(Arc::new(Mutex::new(SocketInner::<T> { Socket(Arc::new(Mutex::new(SocketInner::<T> {
element: element.clone(), element: element.clone(),
state: SocketState::Unscheduled, state: SocketState::Unscheduled,
reader: reader, reader,
buffer_pool: buffer_pool, buffer_pool,
current_task: None, current_task: None,
shutdown_receiver: None, shutdown_receiver: None,
clock: None, clock: None,

View file

@ -41,11 +41,11 @@ use rand;
use iocontext::*; use iocontext::*;
use socket::*; use socket::*;
const DEFAULT_ADDRESS: Option<&'static str> = Some("127.0.0.1"); const DEFAULT_ADDRESS: Option<&str> = Some("127.0.0.1");
const DEFAULT_PORT: u32 = 5000; const DEFAULT_PORT: u32 = 5000;
const DEFAULT_CAPS: Option<gst::Caps> = None; const DEFAULT_CAPS: Option<gst::Caps> = None;
const DEFAULT_CHUNK_SIZE: u32 = 4096; const DEFAULT_CHUNK_SIZE: u32 = 4096;
const DEFAULT_CONTEXT: &'static str = ""; const DEFAULT_CONTEXT: &str = "";
const DEFAULT_CONTEXT_WAIT: u32 = 0; const DEFAULT_CONTEXT_WAIT: u32 = 0;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
@ -142,7 +142,7 @@ pub struct TcpClientReader {
impl TcpClientReader { impl TcpClientReader {
pub fn new(connect_future: net::tcp::ConnectFuture) -> Self { pub fn new(connect_future: net::tcp::ConnectFuture) -> Self {
Self { Self {
connect_future: connect_future, connect_future,
socket: None, socket: None,
} }
} }
@ -256,11 +256,11 @@ impl TcpClientSrc {
let caps = if let Some(ref caps) = state.configured_caps { let caps = if let Some(ref caps) = state.configured_caps {
q.get_filter() q.get_filter()
.map(|f| f.intersect_with_mode(caps, gst::CapsIntersectMode::First)) .map(|f| f.intersect_with_mode(caps, gst::CapsIntersectMode::First))
.unwrap_or(caps.clone()) .unwrap_or_else(|| caps.clone())
} else { } else {
q.get_filter() q.get_filter()
.map(|f| f.to_owned()) .map(|f| f.to_owned())
.unwrap_or(gst::Caps::new_any()) .unwrap_or_else(|| gst::Caps::new_any())
}; };
q.set_result(&caps); q.set_result(&caps);
@ -618,7 +618,7 @@ impl ObjectSubclass for TcpClientSrc {
gst::DebugColorFlags::empty(), gst::DebugColorFlags::empty(),
"Thread-sharing TCP Client source", "Thread-sharing TCP Client source",
), ),
src_pad: src_pad, src_pad,
state: Mutex::new(State::default()), state: Mutex::new(State::default()),
settings: Mutex::new(Settings::default()), settings: Mutex::new(Settings::default()),
} }

View file

@ -52,14 +52,14 @@ use std::os::windows::io::{AsRawSocket, FromRawSocket, IntoRawSocket, RawSocket}
use iocontext::*; use iocontext::*;
use socket::*; use socket::*;
const DEFAULT_ADDRESS: Option<&'static str> = Some("127.0.0.1"); const DEFAULT_ADDRESS: Option<&str> = Some("127.0.0.1");
const DEFAULT_PORT: u32 = 5000; const DEFAULT_PORT: u32 = 5000;
const DEFAULT_REUSE: bool = true; const DEFAULT_REUSE: bool = true;
const DEFAULT_CAPS: Option<gst::Caps> = None; const DEFAULT_CAPS: Option<gst::Caps> = None;
const DEFAULT_MTU: u32 = 1500; const DEFAULT_MTU: u32 = 1500;
const DEFAULT_SOCKET: Option<GioSocketWrapper> = None; const DEFAULT_SOCKET: Option<GioSocketWrapper> = None;
const DEFAULT_USED_SOCKET: Option<GioSocketWrapper> = None; const DEFAULT_USED_SOCKET: Option<GioSocketWrapper> = None;
const DEFAULT_CONTEXT: &'static str = ""; const DEFAULT_CONTEXT: &str = "";
const DEFAULT_CONTEXT_WAIT: u32 = 0; const DEFAULT_CONTEXT_WAIT: u32 = 0;
// Send/Sync struct for passing around a gio::Socket // Send/Sync struct for passing around a gio::Socket
@ -378,11 +378,11 @@ impl UdpSrc {
let caps = if let Some(ref caps) = state.configured_caps { let caps = if let Some(ref caps) = state.configured_caps {
q.get_filter() q.get_filter()
.map(|f| f.intersect_with_mode(caps, gst::CapsIntersectMode::First)) .map(|f| f.intersect_with_mode(caps, gst::CapsIntersectMode::First))
.unwrap_or(caps.clone()) .unwrap_or_else(|| caps.clone())
} else { } else {
q.get_filter() q.get_filter()
.map(|f| f.to_owned()) .map(|f| f.to_owned())
.unwrap_or(gst::Caps::new_any()) .unwrap_or_else(|| gst::Caps::new_any())
}; };
q.set_result(&caps); q.set_result(&caps);
@ -927,7 +927,7 @@ impl ObjectSubclass for UdpSrc {
gst::DebugColorFlags::empty(), gst::DebugColorFlags::empty(),
"Thread-sharing UDP source", "Thread-sharing UDP source",
), ),
src_pad: src_pad, src_pad,
state: Mutex::new(State::default()), state: Mutex::new(State::default()),
settings: Mutex::new(Settings::default()), settings: Mutex::new(Settings::default()),
} }

View file

@ -813,9 +813,9 @@ impl BaseSrcImpl for SineSrc {
*state = State { *state = State {
info: state.info.clone(), info: state.info.clone(),
sample_offset: sample_offset, sample_offset,
sample_stop: sample_stop, sample_stop,
accumulator: accumulator, accumulator,
}; };
true true