mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-12-26 01:50:33 +00:00
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 std::convert::TryInto;
|
||||
use std::env;
|
||||
|
||||
#[path = "../examples-common.rs"]
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
use glib::prelude::*;
|
||||
|
||||
use std::convert;
|
||||
use std::ops;
|
||||
|
||||
#[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;
|
||||
|
||||
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;
|
||||
|
||||
fn try_from(v: &'a gst::StructureRef) -> Result<Self, Self::Error> {
|
||||
|
|
|
@ -292,8 +292,6 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_add_get_audio_clipping_meta() {
|
||||
use std::convert::TryInto;
|
||||
|
||||
gst::init().unwrap();
|
||||
|
||||
let mut buffer = gst::Buffer::with_size(1024).unwrap();
|
||||
|
|
|
@ -5,7 +5,6 @@ use crate::BaseParseFrame;
|
|||
use glib::prelude::*;
|
||||
use glib::translate::*;
|
||||
use gst::FormattedValue;
|
||||
use std::convert::TryFrom;
|
||||
use std::mem;
|
||||
|
||||
pub trait BaseParseExtManual: 'static {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
// Take a look at the license at the top of the repository in the LICENSE file.
|
||||
|
||||
use glib::translate::*;
|
||||
use std::convert::TryFrom;
|
||||
use std::fmt;
|
||||
use std::marker::PhantomData;
|
||||
use std::ptr;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
// Take a look at the license at the top of the repository in the LICENSE file.
|
||||
|
||||
use std::convert::TryFrom;
|
||||
use std::mem;
|
||||
|
||||
use crate::prelude::*;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
use glib::translate::ToGlibPtr;
|
||||
|
||||
use std::convert;
|
||||
use std::ops;
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
fn try_from(v: &'a gst::StructureRef) -> Result<Self, Self::Error> {
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
use glib::translate::*;
|
||||
|
||||
use std::convert::TryFrom;
|
||||
use std::fmt;
|
||||
use std::mem;
|
||||
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;
|
||||
|
||||
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")))]
|
||||
#[test]
|
||||
fn test_display() {
|
||||
use std::str::FromStr;
|
||||
|
||||
gst::init().unwrap();
|
||||
|
||||
format!("{}", crate::VideoColorimetry::from_str("sRGB").unwrap());
|
||||
format!("{}", "sRGB".parse::<crate::VideoColorimetry>().unwrap());
|
||||
format!("{}", crate::VideoFieldOrder::TopFieldFirst);
|
||||
format!("{}", crate::VideoInterlaceMode::Progressive);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
use glib::translate::*;
|
||||
use gst::prelude::*;
|
||||
use std::cmp;
|
||||
use std::convert::{TryFrom, TryInto};
|
||||
use std::fmt;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
@ -607,8 +606,6 @@ impl fmt::Debug for VideoTimeCodeMeta {
|
|||
#[cfg(feature = "v1_16")]
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_add_get_set_meta() {
|
||||
gst::init().unwrap();
|
||||
|
|
|
@ -13,7 +13,6 @@ use glib::prelude::*;
|
|||
use glib::translate::*;
|
||||
use libc::c_void;
|
||||
use std::cmp;
|
||||
use std::convert;
|
||||
use std::ptr;
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
fn try_from(id: ClockId) -> Result<PeriodicClockId, glib::BoolError> {
|
||||
|
|
|
@ -6,7 +6,6 @@ use muldiv::MulDiv;
|
|||
use num_integer::div_rem;
|
||||
use opt_ops::prelude::*;
|
||||
use std::borrow::Borrow;
|
||||
use std::convert::{From, TryFrom};
|
||||
use std::io::{self, prelude::*};
|
||||
use std::ops;
|
||||
use std::time::Duration;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
use glib::translate::*;
|
||||
use std::cmp;
|
||||
use std::convert;
|
||||
use std::fmt;
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
fn try_from(v: DateTime) -> Result<glib::DateTime, glib::BoolError> {
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
#![allow(clippy::upper_case_acronyms)]
|
||||
|
||||
use std::convert::{TryFrom, TryInto};
|
||||
|
||||
use glib::translate::{FromGlib, IntoGlib};
|
||||
use glib::value::{ToValue, ToValueOptional};
|
||||
use glib::StaticType;
|
||||
|
|
|
@ -6,7 +6,6 @@ use glib::translate::{FromGlib, GlibNoneError, IntoGlib, OptionIntoGlib, TryFrom
|
|||
use muldiv::MulDiv;
|
||||
use opt_ops::prelude::*;
|
||||
use std::borrow::Borrow;
|
||||
use std::convert::TryFrom;
|
||||
use std::fmt;
|
||||
use std::ops;
|
||||
use thiserror::Error;
|
||||
|
|
|
@ -61,7 +61,6 @@ mod tests {
|
|||
use crate::ClockTime;
|
||||
use crate::Format;
|
||||
use crate::GenericFormattedValue;
|
||||
use std::convert::TryFrom;
|
||||
|
||||
#[test]
|
||||
fn test_serialize() {
|
||||
|
|
|
@ -1506,7 +1506,6 @@ declare_concrete_query!(Other, T);
|
|||
mod tests {
|
||||
use super::*;
|
||||
use crate::ClockTime;
|
||||
use std::convert::TryInto;
|
||||
|
||||
#[test]
|
||||
fn test_writability() {
|
||||
|
|
|
@ -889,7 +889,6 @@ impl Builder {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::str::FromStr;
|
||||
|
||||
#[test]
|
||||
fn new_set_get() {
|
||||
|
@ -969,7 +968,7 @@ mod tests {
|
|||
|
||||
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::<u32>("f2"), Ok(123));
|
||||
|
||||
|
@ -984,7 +983,7 @@ mod tests {
|
|||
|
||||
let a = None::<&Structure>.to_value();
|
||||
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());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue