forked from mirrors/gstreamer-rs
Remove unneeded std::convert::TryFrom/TryInto and std::str::FromStr imports
This commit is contained in:
parent
082d109f27
commit
cdfe4b3d67
18 changed files with 12 additions and 35 deletions
|
@ -14,7 +14,6 @@
|
||||||
|
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
|
|
||||||
use std::convert::TryInto;
|
|
||||||
use std::env;
|
use std::env;
|
||||||
|
|
||||||
#[path = "../examples-common.rs"]
|
#[path = "../examples-common.rs"]
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
use glib::prelude::*;
|
use glib::prelude::*;
|
||||||
|
|
||||||
use std::convert;
|
|
||||||
use std::ops;
|
use std::ops;
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
|
@ -40,7 +39,7 @@ impl Default for AudioConverterConfig {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl convert::TryFrom<gst::Structure> for AudioConverterConfig {
|
impl TryFrom<gst::Structure> for AudioConverterConfig {
|
||||||
type Error = glib::BoolError;
|
type Error = glib::BoolError;
|
||||||
|
|
||||||
fn try_from(v: gst::Structure) -> Result<Self, Self::Error> {
|
fn try_from(v: gst::Structure) -> Result<Self, Self::Error> {
|
||||||
|
@ -53,7 +52,7 @@ impl convert::TryFrom<gst::Structure> for AudioConverterConfig {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> convert::TryFrom<&'a gst::StructureRef> for AudioConverterConfig {
|
impl<'a> TryFrom<&'a gst::StructureRef> for AudioConverterConfig {
|
||||||
type Error = glib::BoolError;
|
type Error = glib::BoolError;
|
||||||
|
|
||||||
fn try_from(v: &'a gst::StructureRef) -> Result<Self, Self::Error> {
|
fn try_from(v: &'a gst::StructureRef) -> Result<Self, Self::Error> {
|
||||||
|
|
|
@ -292,8 +292,6 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_add_get_audio_clipping_meta() {
|
fn test_add_get_audio_clipping_meta() {
|
||||||
use std::convert::TryInto;
|
|
||||||
|
|
||||||
gst::init().unwrap();
|
gst::init().unwrap();
|
||||||
|
|
||||||
let mut buffer = gst::Buffer::with_size(1024).unwrap();
|
let mut buffer = gst::Buffer::with_size(1024).unwrap();
|
||||||
|
|
|
@ -5,7 +5,6 @@ use crate::BaseParseFrame;
|
||||||
use glib::prelude::*;
|
use glib::prelude::*;
|
||||||
use glib::translate::*;
|
use glib::translate::*;
|
||||||
use gst::FormattedValue;
|
use gst::FormattedValue;
|
||||||
use std::convert::TryFrom;
|
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
|
||||||
pub trait BaseParseExtManual: 'static {
|
pub trait BaseParseExtManual: 'static {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// 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.
|
||||||
|
|
||||||
use glib::translate::*;
|
use glib::translate::*;
|
||||||
use std::convert::TryFrom;
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// 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.
|
||||||
|
|
||||||
use std::convert::TryFrom;
|
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
use glib::translate::ToGlibPtr;
|
use glib::translate::ToGlibPtr;
|
||||||
|
|
||||||
use std::convert;
|
|
||||||
use std::ops;
|
use std::ops;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
|
@ -128,7 +127,7 @@ impl Default for VideoConverterConfig {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl convert::TryFrom<gst::Structure> for VideoConverterConfig {
|
impl TryFrom<gst::Structure> for VideoConverterConfig {
|
||||||
type Error = glib::BoolError;
|
type Error = glib::BoolError;
|
||||||
|
|
||||||
fn try_from(v: gst::Structure) -> Result<Self, Self::Error> {
|
fn try_from(v: gst::Structure) -> Result<Self, Self::Error> {
|
||||||
|
@ -141,7 +140,7 @@ impl convert::TryFrom<gst::Structure> for VideoConverterConfig {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> convert::TryFrom<&'a gst::StructureRef> for VideoConverterConfig {
|
impl<'a> TryFrom<&'a gst::StructureRef> for VideoConverterConfig {
|
||||||
type Error = glib::BoolError;
|
type Error = glib::BoolError;
|
||||||
|
|
||||||
fn try_from(v: &'a gst::StructureRef) -> Result<Self, Self::Error> {
|
fn try_from(v: &'a gst::StructureRef) -> Result<Self, Self::Error> {
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
use glib::translate::*;
|
use glib::translate::*;
|
||||||
|
|
||||||
use std::convert::TryFrom;
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
|
@ -222,7 +222,7 @@ impl From<crate::VideoMultiviewFramePacking> for crate::VideoMultiviewMode {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::convert::TryFrom<crate::VideoMultiviewMode> for crate::VideoMultiviewFramePacking {
|
impl TryFrom<crate::VideoMultiviewMode> for crate::VideoMultiviewFramePacking {
|
||||||
type Error = glib::BoolError;
|
type Error = glib::BoolError;
|
||||||
|
|
||||||
fn try_from(v: crate::VideoMultiviewMode) -> Result<Self, glib::BoolError> {
|
fn try_from(v: crate::VideoMultiviewMode) -> Result<Self, glib::BoolError> {
|
||||||
|
@ -1122,11 +1122,9 @@ mod tests {
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_12")))]
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_12")))]
|
||||||
#[test]
|
#[test]
|
||||||
fn test_display() {
|
fn test_display() {
|
||||||
use std::str::FromStr;
|
|
||||||
|
|
||||||
gst::init().unwrap();
|
gst::init().unwrap();
|
||||||
|
|
||||||
format!("{}", crate::VideoColorimetry::from_str("sRGB").unwrap());
|
format!("{}", "sRGB".parse::<crate::VideoColorimetry>().unwrap());
|
||||||
format!("{}", crate::VideoFieldOrder::TopFieldFirst);
|
format!("{}", crate::VideoFieldOrder::TopFieldFirst);
|
||||||
format!("{}", crate::VideoInterlaceMode::Progressive);
|
format!("{}", crate::VideoInterlaceMode::Progressive);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
use glib::translate::*;
|
use glib::translate::*;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
use std::convert::{TryFrom, TryInto};
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
@ -607,8 +606,6 @@ impl fmt::Debug for VideoTimeCodeMeta {
|
||||||
#[cfg(feature = "v1_16")]
|
#[cfg(feature = "v1_16")]
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_add_get_set_meta() {
|
fn test_add_get_set_meta() {
|
||||||
gst::init().unwrap();
|
gst::init().unwrap();
|
||||||
|
|
|
@ -13,7 +13,6 @@ use glib::prelude::*;
|
||||||
use glib::translate::*;
|
use glib::translate::*;
|
||||||
use libc::c_void;
|
use libc::c_void;
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
use std::convert;
|
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
use futures_core::{Future, Stream};
|
use futures_core::{Future, Stream};
|
||||||
|
@ -118,7 +117,7 @@ impl From<SingleShotClockId> for ClockId {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl convert::TryFrom<ClockId> for SingleShotClockId {
|
impl TryFrom<ClockId> for SingleShotClockId {
|
||||||
type Error = glib::BoolError;
|
type Error = glib::BoolError;
|
||||||
|
|
||||||
fn try_from(id: ClockId) -> Result<SingleShotClockId, glib::BoolError> {
|
fn try_from(id: ClockId) -> Result<SingleShotClockId, glib::BoolError> {
|
||||||
|
@ -228,7 +227,7 @@ impl From<PeriodicClockId> for ClockId {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl convert::TryFrom<ClockId> for PeriodicClockId {
|
impl TryFrom<ClockId> for PeriodicClockId {
|
||||||
type Error = glib::BoolError;
|
type Error = glib::BoolError;
|
||||||
|
|
||||||
fn try_from(id: ClockId) -> Result<PeriodicClockId, glib::BoolError> {
|
fn try_from(id: ClockId) -> Result<PeriodicClockId, glib::BoolError> {
|
||||||
|
|
|
@ -6,7 +6,6 @@ use muldiv::MulDiv;
|
||||||
use num_integer::div_rem;
|
use num_integer::div_rem;
|
||||||
use opt_ops::prelude::*;
|
use opt_ops::prelude::*;
|
||||||
use std::borrow::Borrow;
|
use std::borrow::Borrow;
|
||||||
use std::convert::{From, TryFrom};
|
|
||||||
use std::io::{self, prelude::*};
|
use std::io::{self, prelude::*};
|
||||||
use std::ops;
|
use std::ops;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
use glib::translate::*;
|
use glib::translate::*;
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
use std::convert;
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
use crate::DateTime;
|
use crate::DateTime;
|
||||||
|
@ -514,7 +513,7 @@ impl From<glib::DateTime> for DateTime {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> convert::TryFrom<&'a DateTime> for glib::DateTime {
|
impl<'a> TryFrom<&'a DateTime> for glib::DateTime {
|
||||||
type Error = glib::BoolError;
|
type Error = glib::BoolError;
|
||||||
|
|
||||||
fn try_from(v: &'a DateTime) -> Result<glib::DateTime, glib::BoolError> {
|
fn try_from(v: &'a DateTime) -> Result<glib::DateTime, glib::BoolError> {
|
||||||
|
@ -523,7 +522,7 @@ impl<'a> convert::TryFrom<&'a DateTime> for glib::DateTime {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl convert::TryFrom<DateTime> for glib::DateTime {
|
impl TryFrom<DateTime> for glib::DateTime {
|
||||||
type Error = glib::BoolError;
|
type Error = glib::BoolError;
|
||||||
|
|
||||||
fn try_from(v: DateTime) -> Result<glib::DateTime, glib::BoolError> {
|
fn try_from(v: DateTime) -> Result<glib::DateTime, glib::BoolError> {
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
#![allow(clippy::upper_case_acronyms)]
|
#![allow(clippy::upper_case_acronyms)]
|
||||||
|
|
||||||
use std::convert::{TryFrom, TryInto};
|
|
||||||
|
|
||||||
use glib::translate::{FromGlib, IntoGlib};
|
use glib::translate::{FromGlib, IntoGlib};
|
||||||
use glib::value::{ToValue, ToValueOptional};
|
use glib::value::{ToValue, ToValueOptional};
|
||||||
use glib::StaticType;
|
use glib::StaticType;
|
||||||
|
|
|
@ -6,7 +6,6 @@ use glib::translate::{FromGlib, GlibNoneError, IntoGlib, OptionIntoGlib, TryFrom
|
||||||
use muldiv::MulDiv;
|
use muldiv::MulDiv;
|
||||||
use opt_ops::prelude::*;
|
use opt_ops::prelude::*;
|
||||||
use std::borrow::Borrow;
|
use std::borrow::Borrow;
|
||||||
use std::convert::TryFrom;
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::ops;
|
use std::ops;
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
|
@ -61,7 +61,6 @@ mod tests {
|
||||||
use crate::ClockTime;
|
use crate::ClockTime;
|
||||||
use crate::Format;
|
use crate::Format;
|
||||||
use crate::GenericFormattedValue;
|
use crate::GenericFormattedValue;
|
||||||
use std::convert::TryFrom;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_serialize() {
|
fn test_serialize() {
|
||||||
|
|
|
@ -1506,7 +1506,6 @@ declare_concrete_query!(Other, T);
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::ClockTime;
|
use crate::ClockTime;
|
||||||
use std::convert::TryInto;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_writability() {
|
fn test_writability() {
|
||||||
|
|
|
@ -889,7 +889,6 @@ impl Builder {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use std::str::FromStr;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn new_set_get() {
|
fn new_set_get() {
|
||||||
|
@ -969,7 +968,7 @@ mod tests {
|
||||||
|
|
||||||
let a = "Test, f1=(string)abc, f2=(uint)123;";
|
let a = "Test, f1=(string)abc, f2=(uint)123;";
|
||||||
|
|
||||||
let s = Structure::from_str(a).unwrap();
|
let s = a.parse::<Structure>().unwrap();
|
||||||
assert_eq!(s.get::<&str>("f1"), Ok("abc"));
|
assert_eq!(s.get::<&str>("f1"), Ok("abc"));
|
||||||
assert_eq!(s.get::<u32>("f2"), Ok(123));
|
assert_eq!(s.get::<u32>("f2"), Ok(123));
|
||||||
|
|
||||||
|
@ -984,7 +983,7 @@ mod tests {
|
||||||
|
|
||||||
let a = None::<&Structure>.to_value();
|
let a = None::<&Structure>.to_value();
|
||||||
assert!(a.get::<Option<Structure>>().unwrap().is_none());
|
assert!(a.get::<Option<Structure>>().unwrap().is_none());
|
||||||
let b = Structure::from_str("foo").unwrap().to_value();
|
let b = "foo".parse::<Structure>().unwrap().to_value();
|
||||||
assert!(b.get::<Option<Structure>>().unwrap().is_some());
|
assert!(b.get::<Option<Structure>>().unwrap().is_some());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue