Fix various clippy warnings

This commit is contained in:
Sebastian Dröge 2019-07-11 18:50:37 +03:00
parent f63d50546a
commit d8325212f4
9 changed files with 15 additions and 16 deletions

View file

@ -468,8 +468,8 @@ impl App {
appsink,
glupload,
bus,
events_loop: events_loop,
windowed_context: windowed_context,
events_loop,
windowed_context,
shared_context,
})
}

View file

@ -49,7 +49,7 @@ fn make_element(
factory_name: &'static str,
element_name: Option<&str>,
) -> Result<gst::Element, Error> {
match gst::ElementFactory::make(factory_name, element_name.into()) {
match gst::ElementFactory::make(factory_name, element_name) {
Some(elem) => Ok(elem),
None => Err(Error::from(MissingElement(factory_name))),
}

View file

@ -46,7 +46,7 @@ fn make_element(
factory_name: &'static str,
element_name: Option<&str>,
) -> Result<gst::Element, Error> {
match gst::ElementFactory::make(factory_name, element_name.into()) {
match gst::ElementFactory::make(factory_name, element_name) {
Some(elem) => Ok(elem),
None => Err(Error::from(MissingElement(factory_name))),
}

View file

@ -12,7 +12,6 @@ use gst_sys;
use glib::translate::*;
use gst;
use gst::prelude::*;
use glib::subclass::prelude::*;
use gst::subclass::prelude::*;

View file

@ -1016,7 +1016,7 @@ macro_rules! define_iter_mut(
// example removes the message that was returned here at an earlier time. The compiler
// would be correct to complain in that case, but we don't provide such a function.
let message = unsafe {
mem::transmute::<(&mut SDPMessageRef), (&'a mut SDPMessageRef)>(&mut self.message)
&mut *(&mut self.message as *mut &'a mut SDPMessageRef as *mut SDPMessageRef)
};
if self.idx >= self.len {
return None;
@ -1041,7 +1041,7 @@ macro_rules! define_iter_mut(
impl<'a> DoubleEndedIterator for $name<'a> {
fn next_back(&mut self) -> Option<Self::Item> {
let message = unsafe {
mem::transmute::<(&mut SDPMessageRef), (&'a mut SDPMessageRef)>(&mut self.message)
&mut *(&mut self.message as *mut &'a mut SDPMessageRef as *mut SDPMessageRef)
};
if self.idx == self.len {
return None;

View file

@ -5,7 +5,7 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
#![allow(clippy::cast_ptr_alignment)]
pub mod video_decoder;
pub mod video_encoder;

View file

@ -516,10 +516,10 @@ where
let imp = instance.get_impl();
let wrap: VideoDecoder = from_glib_borrow(ptr);
gst_video_sys::gst_video_codec_state_ref(state);
let mut wrap_state = VideoCodecState::<Readable>::new(state);
let wrap_state = VideoCodecState::<Readable>::new(state);
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.set_format(&wrap, &mut wrap_state) {
match imp.set_format(&wrap, &wrap_state) {
Ok(()) => true,
Err(err) => {
err.log_with_object(&wrap);
@ -545,13 +545,12 @@ where
let imp = instance.get_impl();
let wrap: VideoDecoder = from_glib_borrow(ptr);
gst_video_sys::gst_video_codec_frame_ref(frame);
let mut wrap_frame = VideoCodecFrame::new(frame, &wrap);
let mut wrap_adapter: gst_base::Adapter = from_glib_borrow(adapter);
let wrap_frame = VideoCodecFrame::new(frame, &wrap);
let wrap_adapter: gst_base::Adapter = from_glib_borrow(adapter);
let at_eos: bool = from_glib(at_eos);
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
imp.parse(&wrap, &mut wrap_frame, &mut wrap_adapter, at_eos)
.into()
imp.parse(&wrap, &wrap_frame, &wrap_adapter, at_eos).into()
})
.to_glib()
}

View file

@ -470,10 +470,10 @@ where
let imp = instance.get_impl();
let wrap: VideoEncoder = from_glib_borrow(ptr);
gst_video_sys::gst_video_codec_state_ref(state);
let mut wrap_state = VideoCodecState::<Readable>::new(state);
let wrap_state = VideoCodecState::<Readable>::new(state);
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
match imp.set_format(&wrap, &mut wrap_state) {
match imp.set_format(&wrap, &wrap_state) {
Ok(()) => true,
Err(err) => {
err.log_with_object(&wrap);

View file

@ -608,6 +608,7 @@ impl ToGlib for MessageType {
#[doc(hidden)]
impl FromGlib<gst_sys::GstMessageType> for MessageType {
#[allow(clippy::unreadable_literal)]
fn from_glib(value: gst_sys::GstMessageType) -> Self {
skip_assert_initialized!();
match value {