Fix various clippy warnings

This commit is contained in:
Sebastian Dröge 2017-12-20 21:36:50 +02:00
parent 07ce2d64b8
commit 22c5f93d3b
20 changed files with 29 additions and 59 deletions

View file

@ -9,10 +9,7 @@
use glib;
use gst;
use gst::prelude::*;
use gst_base;
use gst_base::prelude::*;
use gst_audio;
use gst_audio::prelude::*;
use gst_plugin::properties::*;
use gst_plugin::object::*;
@ -27,7 +24,7 @@ use byte_slice_cast::*;
use num_traits::float::Float;
use num_traits::cast::{FromPrimitive, ToPrimitive};
const DEFAULT_MAX_DELAY: u64 = 1 * gst::SECOND_VAL;
const DEFAULT_MAX_DELAY: u64 = gst::SECOND_VAL;
const DEFAULT_DELAY: u64 = 500 * gst::MSECOND_VAL;
const DEFAULT_INTENSITY: f64 = 0.5;
const DEFAULT_FEEDBACK: f64 = 0.0;

View file

@ -12,7 +12,6 @@ extern crate byte_slice_cast;
extern crate glib;
#[macro_use]
extern crate gst_plugin;
#[macro_use]
extern crate gstreamer as gst;
extern crate gstreamer_audio as gst_audio;
extern crate gstreamer_base as gst_base;

View file

@ -11,14 +11,12 @@ use std::fs::File;
use url::Url;
use std::io::Write;
use std::convert::From;
use gst_plugin::error::*;
use gst_plugin_simple::sink::*;
use gst_plugin_simple::UriValidator;
use gst;
use gst::prelude::*;
#[derive(Debug)]
enum StreamingState {

View file

@ -16,7 +16,6 @@ use gst_plugin_simple::source::*;
use gst_plugin_simple::UriValidator;
use gst;
use gst::prelude::*;
#[derive(Debug)]
enum StreamingState {

View file

@ -21,7 +21,6 @@ use gst_plugin::element::*;
use gst_plugin_simple::demuxer::*;
use gst;
use gst::prelude::*;
use num_rational::Rational32;
@ -97,14 +96,14 @@ impl AudioFormat {
aac_sequence_header: &Option<gst::Buffer>,
) -> AudioFormat {
let numeric_rate = match (data_header.sound_format, data_header.sound_rate) {
(flavors::SoundFormat::NELLYMOSER_16KHZ_MONO, _) => 16000,
(flavors::SoundFormat::NELLYMOSER_8KHZ_MONO, _) => 8000,
(flavors::SoundFormat::MP3_8KHZ, _) => 8000,
(flavors::SoundFormat::SPEEX, _) => 16000,
(_, flavors::SoundRate::_5_5KHZ) => 5512,
(_, flavors::SoundRate::_11KHZ) => 11025,
(_, flavors::SoundRate::_22KHZ) => 22050,
(_, flavors::SoundRate::_44KHZ) => 44100,
(flavors::SoundFormat::NELLYMOSER_16KHZ_MONO, _) => 16_000,
(flavors::SoundFormat::NELLYMOSER_8KHZ_MONO, _) => 8_000,
(flavors::SoundFormat::MP3_8KHZ, _) => 8_000,
(flavors::SoundFormat::SPEEX, _) => 16_000,
(_, flavors::SoundRate::_5_5KHZ) => 5_512,
(_, flavors::SoundRate::_11KHZ) => 11_025,
(_, flavors::SoundRate::_22KHZ) => 22_050,
(_, flavors::SoundRate::_44KHZ) => 44_100,
};
let numeric_width = match data_header.sound_size {
@ -188,7 +187,7 @@ impl AudioFormat {
data.write_all(&[0; 14]).unwrap();
data.write_u32le(1).unwrap(); // version
data.write_u32le(80).unwrap(); // header size
data.write_u32le(16000).unwrap(); // sample rate
data.write_u32le(16_000).unwrap(); // sample rate
data.write_u32le(1).unwrap(); // mode = wideband
data.write_u32le(4).unwrap(); // mode bitstream version
data.write_u32le(1).unwrap(); // channels
@ -1026,9 +1025,7 @@ impl FlvDemux {
}
let tag_header = match flavors::tag_header(&data[4..]) {
IResult::Error(_) | IResult::Incomplete(_) => {
unimplemented!();
}
IResult::Error(_) | IResult::Incomplete(_) => unimplemented!(),
IResult::Done(_, tag_header) => tag_header,
};
@ -1042,9 +1039,7 @@ impl FlvDemux {
gst_trace!(self.cat, obj: demuxer, "Found audio tag");
let data_header = match flavors::audio_data_header(&data[15..]) {
IResult::Error(_) | IResult::Incomplete(_) => {
unimplemented!();
}
IResult::Error(_) | IResult::Incomplete(_) => unimplemented!(),
IResult::Done(_, data_header) => data_header,
};
@ -1054,9 +1049,7 @@ impl FlvDemux {
gst_trace!(self.cat, obj: demuxer, "Found video tag");
let data_header = match flavors::video_data_header(&data[15..]) {
IResult::Error(_) | IResult::Incomplete(_) => {
unimplemented!();
}
IResult::Error(_) | IResult::Incomplete(_) => unimplemented!(),
IResult::Done(_, data_header) => data_header,
};

View file

@ -20,7 +20,6 @@ extern crate num_rational;
extern crate url;
use gst_plugin_simple::demuxer::*;
use gst::prelude::*;
mod flvdemux;

View file

@ -18,7 +18,6 @@ use gst_plugin_simple::source::*;
use gst_plugin_simple::UriValidator;
use gst;
use gst::prelude::*;
#[derive(Debug)]
enum StreamingState {

View file

@ -19,7 +19,6 @@ use gst_plugin::element::*;
use gst;
use gst::prelude::*;
use gst_base;
use gst_base::prelude::*;
pub type StreamIndex = u32;

View file

@ -7,7 +7,6 @@
// except according to those terms.
extern crate glib;
#[macro_use]
extern crate gst_plugin;
#[macro_use]
extern crate gstreamer as gst;

View file

@ -13,7 +13,6 @@ use url::Url;
use glib;
use gst;
use gst::prelude::*;
use gst_base;
use gst_base::prelude::*;
use gst_plugin::object::*;

View file

@ -15,7 +15,6 @@ use url::Url;
use glib;
use gst;
use gst::prelude::*;
use gst_base;
use gst_base::prelude::*;
use gst_plugin::object::*;

View file

@ -227,14 +227,14 @@ fn create_ui(app: &gtk::Application) {
let position = video_sink
.query_position::<gst::ClockTime>()
.unwrap_or(0.into());
.unwrap_or_else(|| 0.into());
position_label.set_text(&format!("Position: {:.1}", position));
let recording_duration = togglerecord
.get_static_pad("src")
.unwrap()
.query_position::<gst::ClockTime>()
.unwrap_or(0.into());
.unwrap_or_else(|| 0.into());
recorded_duration_label.set_text(&format!("Recorded: {:.1}", recording_duration));
glib::Continue(true)

View file

@ -271,7 +271,7 @@ impl ToggleRecord {
.downcast::<Element>()
.unwrap();
let togglerecord = element.get_impl().downcast_ref::<ToggleRecord>().unwrap();
element.catch_panic(fallback, |element| f(togglerecord, &element))
element.catch_panic(fallback, |element| f(togglerecord, element))
}
fn set_pad_functions(sinkpad: &gst::Pad, srcpad: &gst::Pad) {

View file

@ -173,10 +173,9 @@ fn setup_sender_receiver(
i += 1;
},
SendData::Gaps(n) => for _ in 0..n {
let event = gst::Event::new_gap(
(offset + i * 20 * gst::MSECOND).into(),
(20 * gst::MSECOND).into(),
).build();
let event =
gst::Event::new_gap(offset + i * 20 * gst::MSECOND, 20 * gst::MSECOND)
.build();
let _ = sinkpad.send_event(event);
i += 1;
},
@ -215,7 +214,7 @@ fn recv_buffers(
EventView::Gap(ref e) => {
let (ts, _) = e.get();
res.push((segment.to_running_time(ts), ts.into()));
res.push((segment.to_running_time(ts), ts));
n_buffers += 1;
if wait_buffers > 0 && n_buffers == wait_buffers {
return res;
@ -433,7 +432,7 @@ fn test_one_stream_open_close_open() {
let pts_off = if index >= 10 {
10 * 20 * gst::MSECOND
} else {
0 * gst::MSECOND
0.into()
};
let index = index as u64;
@ -813,7 +812,7 @@ fn test_two_stream_open_close_open() {
let pts_off = if index >= 10 {
10 * 20 * gst::MSECOND
} else {
0 * gst::MSECOND
0.into()
};
let index = index as u64;
@ -829,7 +828,7 @@ fn test_two_stream_open_close_open() {
let pts_off = if index >= 10 {
10 * 20 * gst::MSECOND
} else {
0 * gst::MSECOND
0.into()
};
let index = index as u64;
@ -914,7 +913,7 @@ fn test_two_stream_open_close_open_gaps() {
let pts_off = if index >= 10 {
10 * 20 * gst::MSECOND
} else {
0 * gst::MSECOND
0.into()
};
let index = index as u64;
@ -930,7 +929,7 @@ fn test_two_stream_open_close_open_gaps() {
let pts_off = if index >= 10 {
10 * 20 * gst::MSECOND
} else {
0 * gst::MSECOND
0.into()
};
let index = index as u64;
@ -1113,7 +1112,7 @@ fn test_three_stream_open_close_open() {
let pts_off = if index >= 10 {
10 * 20 * gst::MSECOND
} else {
0 * gst::MSECOND
0.into()
};
let index = index as u64;
@ -1129,7 +1128,7 @@ fn test_three_stream_open_close_open() {
let pts_off = if index >= 10 {
10 * 20 * gst::MSECOND
} else {
0 * gst::MSECOND
0.into()
};
let index = index as u64;
@ -1144,7 +1143,7 @@ fn test_three_stream_open_close_open() {
let pts_off = if index >= 10 {
10 * 20 * gst::MSECOND
} else {
0 * gst::MSECOND
0.into()
};
let index = index as u64;

View file

@ -13,7 +13,6 @@ use std::fmt;
use std::error::Error;
use gst;
use gst::prelude::*;
lazy_static! {
static ref CAT: gst::DebugCategory = {
@ -25,6 +24,7 @@ lazy_static! {
};
}
#[derive(Default, Debug)]
pub struct Adapter {
deque: VecDeque<gst::MappedBuffer<gst::buffer::Readable>>,
size: usize,

View file

@ -19,7 +19,6 @@ use glib::translate::*;
use gst;
use gst::prelude::*;
use gst_base;
use gst_base::prelude::*;
use object::*;
use element::*;

View file

@ -19,7 +19,6 @@ use glib::translate::*;
use gst;
use gst::prelude::*;
use gst_base;
use gst_base::prelude::*;
use object::*;
use element::*;

View file

@ -19,7 +19,6 @@ use glib::translate::*;
use gst;
use gst::prelude::*;
use gst_base;
use gst_base::prelude::*;
use object::*;
use element::*;

View file

@ -10,13 +10,8 @@ use std::error::Error;
use std::fmt::{Display, Formatter};
use std::fmt::Error as FmtError;
use glib_ffi;
use gst_ffi;
use glib;
use glib::translate::ToGlibPtr;
use gst;
use gst::prelude::*;
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum FlowError {

View file

@ -15,7 +15,6 @@ use libc;
use glib;
use glib::translate::*;
use gst;
use gst::prelude::*;
use object::*;
use anyimpl::*;