Fix (new) clippy warnings

This commit is contained in:
Guillaume Gomez 2021-07-30 21:23:46 +02:00
parent 38dfeb9b00
commit e2264a3f3f
30 changed files with 41 additions and 11 deletions

View file

@ -347,7 +347,7 @@ clippy:
extends: .img-stable extends: .img-stable
stage: 'extras' stage: 'extras'
variables: variables:
CLIPPY_LINTS: -A clippy::missing_safety_doc -A clippy::manual_range_contains -A clippy::upper_case_acronyms -A clippy::wrong_self_convention -D warnings CLIPPY_LINTS: -D warnings
script: script:
- cargo clippy --version - cargo clippy --version
# Keep features in sync with above # Keep features in sync with above

View file

@ -28,7 +28,7 @@ fn example_main() {
let mut context = gst::ParseContext::new(); let mut context = gst::ParseContext::new();
let pipeline = let pipeline =
match gst::parse_launch_full(&pipeline_str, Some(&mut context), gst::ParseFlags::empty()) { match gst::parse_launch_full(pipeline_str, Some(&mut context), gst::ParseFlags::empty()) {
Ok(pipeline) => pipeline, Ok(pipeline) => pipeline,
Err(err) => { Err(err) => {
if let Some(gst::ParseError::NoSuchElement) = err.kind::<gst::ParseError>() { if let Some(gst::ParseError::NoSuchElement) = err.kind::<gst::ParseError>() {

View file

@ -79,7 +79,7 @@ fn create_pipeline(uri: String, out_path: std::path::PathBuf) -> Result<gst::Pip
})?; })?;
let caps = sample.caps().expect("Sample without caps"); let caps = sample.caps().expect("Sample without caps");
let info = gst_video::VideoInfo::from_caps(&caps).expect("Failed to parse caps"); let info = gst_video::VideoInfo::from_caps(caps).expect("Failed to parse caps");
// Make sure that we only get a single buffer // Make sure that we only get a single buffer
if got_snapshot { if got_snapshot {

View file

@ -75,6 +75,7 @@ void main() {
#[allow(clippy::unused_unit)] #[allow(clippy::unused_unit)]
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
#[allow(clippy::manual_non_exhaustive)] #[allow(clippy::manual_non_exhaustive)]
#[allow(clippy::upper_case_acronyms)]
pub(crate) mod gl { pub(crate) mod gl {
pub use self::Gles2 as Gl; pub use self::Gles2 as Gl;
include!(concat!(env!("OUT_DIR"), "/test_gl_bindings.rs")); include!(concat!(env!("OUT_DIR"), "/test_gl_bindings.rs"));

View file

@ -1,6 +1,7 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
#![cfg_attr(feature = "dox", feature(doc_cfg))] #![cfg_attr(feature = "dox", feature(doc_cfg))]
#![allow(clippy::missing_safety_doc)]
#![doc = include_str!("../README.md")] #![doc = include_str!("../README.md")]
pub use ffi; pub use ffi;

View file

@ -1,6 +1,7 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
#![cfg_attr(feature = "dox", feature(doc_cfg))] #![cfg_attr(feature = "dox", feature(doc_cfg))]
#![allow(clippy::missing_safety_doc)]
#![doc = include_str!("../README.md")] #![doc = include_str!("../README.md")]
pub use ffi; pub use ffi;

View file

@ -1,6 +1,7 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
#![cfg_attr(feature = "dox", feature(doc_cfg))] #![cfg_attr(feature = "dox", feature(doc_cfg))]
#![allow(clippy::missing_safety_doc)]
#![doc = include_str!("../README.md")] #![doc = include_str!("../README.md")]
pub use ffi; pub use ffi;

View file

@ -1,6 +1,7 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
#![cfg_attr(feature = "dox", feature(doc_cfg))] #![cfg_attr(feature = "dox", feature(doc_cfg))]
#![allow(clippy::missing_safety_doc)]
#![doc = include_str!("../README.md")] #![doc = include_str!("../README.md")]
pub use ffi; pub use ffi;

View file

@ -1,6 +1,7 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
#![cfg_attr(feature = "dox", feature(doc_cfg))] #![cfg_attr(feature = "dox", feature(doc_cfg))]
#![allow(clippy::missing_safety_doc)]
#![doc = include_str!("../README.md")] #![doc = include_str!("../README.md")]
pub use ffi; pub use ffi;

View file

@ -1,6 +1,7 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
#![cfg_attr(feature = "dox", feature(doc_cfg))] #![cfg_attr(feature = "dox", feature(doc_cfg))]
#![allow(clippy::missing_safety_doc)]
#![doc = include_str!("../README.md")] #![doc = include_str!("../README.md")]
pub use ffi; pub use ffi;

View file

@ -7,6 +7,7 @@
// except according to those terms. // except according to those terms.
#![cfg_attr(all(not(doctest), doc), feature(doc_cfg))] #![cfg_attr(all(not(doctest), doc), feature(doc_cfg))]
#![allow(clippy::missing_safety_doc)]
pub use ffi; pub use ffi;
pub use gst_gl; pub use gst_gl;

View file

@ -1,6 +1,7 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
#![cfg_attr(feature = "dox", feature(doc_cfg))] #![cfg_attr(feature = "dox", feature(doc_cfg))]
#![allow(clippy::missing_safety_doc)]
#![doc = include_str!("../README.md")] #![doc = include_str!("../README.md")]
pub use ffi; pub use ffi;

View file

@ -7,6 +7,7 @@
// except according to those terms. // except according to those terms.
#![cfg_attr(all(not(doctest), doc), feature(doc_cfg))] #![cfg_attr(all(not(doctest), doc), feature(doc_cfg))]
#![allow(clippy::missing_safety_doc)]
pub use ffi; pub use ffi;
pub use gst_gl; pub use gst_gl;

View file

@ -7,6 +7,7 @@
// except according to those terms. // except according to those terms.
#![cfg_attr(all(not(doctest), doc), feature(doc_cfg))] #![cfg_attr(all(not(doctest), doc), feature(doc_cfg))]
#![allow(clippy::missing_safety_doc)]
pub use ffi; pub use ffi;
pub use gst_gl; pub use gst_gl;

View file

@ -1,6 +1,7 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
#![cfg_attr(feature = "dox", feature(doc_cfg))] #![cfg_attr(feature = "dox", feature(doc_cfg))]
#![allow(clippy::missing_safety_doc)]
#![doc = include_str!("../README.md")] #![doc = include_str!("../README.md")]
pub use ffi; pub use ffi;

View file

@ -1,6 +1,7 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
#![cfg_attr(feature = "dox", feature(doc_cfg))] #![cfg_attr(feature = "dox", feature(doc_cfg))]
#![allow(clippy::missing_safety_doc)]
#![doc = include_str!("../README.md")] #![doc = include_str!("../README.md")]
pub use ffi; pub use ffi;

View file

@ -1,6 +1,7 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
#![cfg_attr(feature = "dox", feature(doc_cfg))] #![cfg_attr(feature = "dox", feature(doc_cfg))]
#![allow(clippy::missing_safety_doc)]
#![doc = include_str!("../README.md")] #![doc = include_str!("../README.md")]
pub use ffi; pub use ffi;

View file

@ -1,6 +1,7 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
#![cfg_attr(feature = "dox", feature(doc_cfg))] #![cfg_attr(feature = "dox", feature(doc_cfg))]
#![allow(clippy::manual_range_contains)]
#![doc = include_str!("../README.md")] #![doc = include_str!("../README.md")]
pub use ffi; pub use ffi;

View file

@ -1,6 +1,7 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
#![cfg_attr(feature = "dox", feature(doc_cfg))] #![cfg_attr(feature = "dox", feature(doc_cfg))]
#![allow(clippy::missing_safety_doc)]
#![doc = include_str!("../README.md")] #![doc = include_str!("../README.md")]
pub use ffi; pub use ffi;

View file

@ -1,6 +1,7 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
#![cfg_attr(feature = "dox", feature(doc_cfg))] #![cfg_attr(feature = "dox", feature(doc_cfg))]
#![allow(clippy::missing_safety_doc)]
#![doc = include_str!("../README.md")] #![doc = include_str!("../README.md")]
pub use ffi; pub use ffi;

View file

@ -1,6 +1,7 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
#![cfg_attr(feature = "dox", feature(doc_cfg))] #![cfg_attr(feature = "dox", feature(doc_cfg))]
#![allow(clippy::missing_safety_doc)]
#![doc = include_str!("../README.md")] #![doc = include_str!("../README.md")]
pub use ffi; pub use ffi;

View file

@ -1,6 +1,7 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
#![cfg_attr(feature = "dox", feature(doc_cfg))] #![cfg_attr(feature = "dox", feature(doc_cfg))]
#![allow(clippy::missing_safety_doc)]
#![doc = include_str!("../README.md")] #![doc = include_str!("../README.md")]
pub use ffi; pub use ffi;

View file

@ -1,6 +1,7 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
#![cfg_attr(feature = "dox", feature(doc_cfg))] #![cfg_attr(feature = "dox", feature(doc_cfg))]
#![allow(clippy::missing_safety_doc)]
#![doc = include_str!("../README.md")] #![doc = include_str!("../README.md")]
pub use ffi; pub use ffi;

View file

@ -20,8 +20,8 @@ const CAPS_FEATURES_VARIANT_SOME_ID: u32 = 1;
const CAPS_FEATURES_VARIANT_SOME_STR: &str = "Some"; const CAPS_FEATURES_VARIANT_SOME_STR: &str = "Some";
const CAPS_FEATURES_VARIANT_NAMES: &[&str] = &[ const CAPS_FEATURES_VARIANT_NAMES: &[&str] = &[
&CAPS_FEATURES_VARIANT_ANY_STR, CAPS_FEATURES_VARIANT_ANY_STR,
&CAPS_FEATURES_VARIANT_SOME_STR, CAPS_FEATURES_VARIANT_SOME_STR,
]; ];
struct CapsFeaturesForIterSe<'a>(&'a CapsFeaturesRef); struct CapsFeaturesForIterSe<'a>(&'a CapsFeaturesRef);
@ -55,7 +55,7 @@ impl Serialize for CapsFeaturesRef {
stringify!(CapsFeatures), stringify!(CapsFeatures),
CAPS_FEATURES_VARIANT_SOME_ID, CAPS_FEATURES_VARIANT_SOME_ID,
CAPS_FEATURES_VARIANT_SOME_STR, CAPS_FEATURES_VARIANT_SOME_STR,
&CapsFeaturesForIterSe(&self), &CapsFeaturesForIterSe(self),
) )
} }
} }

View file

@ -27,9 +27,9 @@ const CAPS_VARIANT_SOME_ID: u32 = 2;
const CAPS_VARIANT_SOME_STR: &str = "Some"; const CAPS_VARIANT_SOME_STR: &str = "Some";
const CAPS_VARIANT_NAMES: &[&str] = &[ const CAPS_VARIANT_NAMES: &[&str] = &[
&CAPS_VARIANT_ANY_STR, CAPS_VARIANT_ANY_STR,
&CAPS_VARIANT_EMPTY_STR, CAPS_VARIANT_EMPTY_STR,
&CAPS_VARIANT_SOME_STR, CAPS_VARIANT_SOME_STR,
]; ];
struct CapsItemSe<'a>(&'a StructureRef, Option<&'a CapsFeaturesRef>); struct CapsItemSe<'a>(&'a StructureRef, Option<&'a CapsFeaturesRef>);
@ -86,7 +86,7 @@ impl Serialize for CapsRef {
stringify!(Caps), stringify!(Caps),
CAPS_VARIANT_SOME_ID, CAPS_VARIANT_SOME_ID,
CAPS_VARIANT_SOME_STR, CAPS_VARIANT_SOME_STR,
&CapsForIterSe(&self), &CapsForIterSe(self),
) )
} }
} }

View file

@ -1,5 +1,7 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
#![allow(clippy::upper_case_acronyms)]
use std::convert::{TryFrom, TryInto}; use std::convert::{TryFrom, TryInto};
use glib::translate::{FromGlib, IntoGlib}; use glib::translate::{FromGlib, IntoGlib};

View file

@ -2,6 +2,8 @@
#![cfg_attr(feature = "dox", feature(doc_cfg))] #![cfg_attr(feature = "dox", feature(doc_cfg))]
#![recursion_limit = "256"] #![recursion_limit = "256"]
#![allow(clippy::missing_safety_doc)]
#![allow(clippy::manual_range_contains)]
#![doc = include_str!("../README.md")] #![doc = include_str!("../README.md")]
// Re-exported for the subclass gst_plugin_define! macro // Re-exported for the subclass gst_plugin_define! macro

View file

@ -1,5 +1,7 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
#![allow(clippy::upper_case_acronyms)]
use glib::{Date, ToValue}; use glib::{Date, ToValue};
use serde::de; use serde::de;

View file

@ -1,5 +1,7 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
#![allow(clippy::upper_case_acronyms)]
use glib::translate::{from_glib, ToGlibPtr}; use glib::translate::{from_glib, ToGlibPtr};
use glib::{Date, SendValue, ToValue}; use glib::{Date, SendValue, ToValue};
@ -104,7 +106,7 @@ impl<'a> Serialize for TagsSer<'a> {
fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> { fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
let mut tup = serializer.serialize_tuple(2)?; let mut tup = serializer.serialize_tuple(2)?;
tup.serialize_element(self.0)?; tup.serialize_element(self.0)?;
tup.serialize_element(&TagValuesSer::from(&self))?; tup.serialize_element(&TagValuesSer::from(self))?;
tup.end() tup.end()
} }
} }

View file

@ -1,5 +1,7 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
#![allow(clippy::upper_case_acronyms)]
use glib::{Date, StaticType, ToValue}; use glib::{Date, StaticType, ToValue};
use num_rational::Rational32; use num_rational::Rational32;