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
drop(first_buf);
self.internal_buffer.clear();
Ok(Some(buffer))

View file

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

View file

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

View file

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

View file

@ -43,12 +43,12 @@ lazy_static! {
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_BYTES: u32 = 1024 * 1024;
const DEFAULT_MAX_SIZE_TIME: u64 = gst::SECOND_VAL;
const DEFAULT_CONTEXT: &'static str = "";
const DEFAULT_CONTEXT: &str = "";
const DEFAULT_CONTEXT_WAIT: u32 = 0;
#[derive(Debug, Clone)]
@ -395,7 +395,7 @@ impl ProxySink {
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;
while let Some(item) = items.pop_front() {
if let Err(item) = queue.push(item) {
@ -695,7 +695,7 @@ impl ObjectSubclass for ProxySink {
gst::DebugColorFlags::empty(),
"Thread-sharing proxy sink",
),
sink_pad: sink_pad,
sink_pad,
state: Mutex::new(StateSink::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() {
q.get_filter()
.map(|f| f.intersect_with_mode(caps, gst::CapsIntersectMode::First))
.unwrap_or(caps.clone())
.unwrap_or_else(|| caps.clone())
} else {
q.get_filter()
.map(|f| f.to_owned())
.unwrap_or(gst::Caps::new_any())
.unwrap_or_else(|| gst::Caps::new_any())
};
q.set_result(&caps);
@ -1223,7 +1223,7 @@ impl ObjectSubclass for ProxySrc {
gst::DebugColorFlags::empty(),
"Thread-sharing proxy source",
),
src_pad: src_pad,
src_pad,
state: Mutex::new(StateSrc::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_BYTES: u32 = 1024 * 1024;
const DEFAULT_MAX_SIZE_TIME: u64 = gst::SECOND_VAL;
const DEFAULT_CONTEXT: &'static str = "";
const DEFAULT_CONTEXT: &str = "";
const DEFAULT_CONTEXT_WAIT: u32 = 0;
#[derive(Debug, Clone)]
@ -846,8 +846,8 @@ impl ObjectSubclass for Queue {
gst::DebugColorFlags::empty(),
"Thread-sharing queue",
),
sink_pad: sink_pad,
src_pad: src_pad,
sink_pad,
src_pad,
state: Mutex::new(State::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> {
element: element.clone(),
state: SocketState::Unscheduled,
reader: reader,
buffer_pool: buffer_pool,
reader,
buffer_pool,
current_task: None,
shutdown_receiver: None,
clock: None,

View file

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

View file

@ -52,14 +52,14 @@ use std::os::windows::io::{AsRawSocket, FromRawSocket, IntoRawSocket, RawSocket}
use iocontext::*;
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_REUSE: bool = true;
const DEFAULT_CAPS: Option<gst::Caps> = None;
const DEFAULT_MTU: u32 = 1500;
const DEFAULT_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;
// 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 {
q.get_filter()
.map(|f| f.intersect_with_mode(caps, gst::CapsIntersectMode::First))
.unwrap_or(caps.clone())
.unwrap_or_else(|| caps.clone())
} else {
q.get_filter()
.map(|f| f.to_owned())
.unwrap_or(gst::Caps::new_any())
.unwrap_or_else(|| gst::Caps::new_any())
};
q.set_result(&caps);
@ -927,7 +927,7 @@ impl ObjectSubclass for UdpSrc {
gst::DebugColorFlags::empty(),
"Thread-sharing UDP source",
),
src_pad: src_pad,
src_pad,
state: Mutex::new(State::default()),
settings: Mutex::new(Settings::default()),
}

View file

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