Use impl for some Into* trait bounds

This commit is contained in:
Marijn Suijten 2021-09-21 23:54:11 +02:00
parent 669bf52291
commit 226419003d
4 changed files with 25 additions and 44 deletions

View file

@ -214,8 +214,8 @@ impl fmt::Debug for VideoOverlayCompositionRef {
impl VideoOverlayComposition {
#[doc(alias = "gst_video_overlay_composition_new")]
pub fn new<'a, T: IntoIterator<Item = &'a VideoOverlayRectangle>>(
rects: T,
pub fn new<'a>(
rects: impl IntoIterator<Item = &'a VideoOverlayRectangle>,
) -> Result<Self, glib::error::BoolError> {
assert_initialized_main_thread!();
unsafe {

View file

@ -58,10 +58,7 @@ impl Caps {
}
#[allow(clippy::should_implement_trait)]
pub fn from_iter<'a, I>(iter: I) -> Self
where
I: IntoIterator<Item = &'a StructureRef>,
{
pub fn from_iter<'a>(iter: impl IntoIterator<Item = &'a StructureRef>) -> Self {
assert_initialized_main_thread!();
let mut caps = Caps::new_empty();
@ -71,10 +68,9 @@ impl Caps {
caps
}
pub fn from_iter_with_features<'a, 'b, I>(iter: I) -> Self
where
I: IntoIterator<Item = (&'a StructureRef, &'b CapsFeaturesRef)>,
{
pub fn from_iter_with_features<'a, 'b>(
iter: impl IntoIterator<Item = (&'a StructureRef, &'b CapsFeaturesRef)>,
) -> Self {
assert_initialized_main_thread!();
let mut caps = Caps::new_empty();

View file

@ -109,22 +109,14 @@ fn validate(
impl DateTime {
#[doc(alias = "gst_date_time_new")]
pub fn new<
TZ: Into<Option<f32>>,
Y: Into<i32>,
MO: Into<Option<i32>>,
D: Into<Option<i32>>,
H: Into<Option<i32>>,
MI: Into<Option<i32>>,
S: Into<Option<f64>>,
>(
tzoffset: TZ,
year: Y,
month: MO,
day: D,
hour: H,
minute: MI,
seconds: S,
pub fn new(
tzoffset: impl Into<Option<f32>>,
year: impl Into<i32>,
month: impl Into<Option<i32>>,
day: impl Into<Option<i32>>,
hour: impl Into<Option<i32>>,
minute: impl Into<Option<i32>>,
seconds: impl Into<Option<f64>>,
) -> Result<DateTime, glib::BoolError> {
assert_initialized_main_thread!();
@ -153,20 +145,13 @@ impl DateTime {
}
#[doc(alias = "gst_date_time_new_local_time")]
pub fn new_local_time<
Y: Into<i32>,
MO: Into<Option<i32>>,
D: Into<Option<i32>>,
H: Into<Option<i32>>,
MI: Into<Option<i32>>,
S: Into<Option<f64>>,
>(
year: Y,
month: MO,
day: D,
hour: H,
minute: MI,
seconds: S,
pub fn new_local_time(
year: impl Into<i32>,
month: impl Into<Option<i32>>,
day: impl Into<Option<i32>>,
hour: impl Into<Option<i32>>,
minute: impl Into<Option<i32>>,
seconds: impl Into<Option<f64>>,
) -> Result<DateTime, glib::BoolError> {
assert_initialized_main_thread!();

View file

@ -100,10 +100,10 @@ impl Structure {
}
#[allow(clippy::should_implement_trait)]
pub fn from_iter<'a, 'b, I>(name: &str, iter: I) -> Structure
where
I: IntoIterator<Item = (&'a str, &'b SendValue)>,
{
pub fn from_iter<'a, 'b>(
name: &str,
iter: impl IntoIterator<Item = (&'a str, &'b SendValue)>,
) -> Structure {
assert_initialized_main_thread!();
let mut structure = Structure::new_empty(name);