gstreamer/format,value: Skip init in functions that contain self

These functions were changed to return Self instead of the direct name
of the type, and are hence caught by the init checker.

Also remove some tabs that sit in the macro but are not cleaned up by
the formatter.
This commit is contained in:
Marijn Suijten 2021-01-07 20:47:31 +01:00
parent 4cb6b64e2d
commit c4a06e515b
2 changed files with 7 additions and 4 deletions

View file

@ -298,7 +298,7 @@ macro_rules! impl_format_value_traits(
impl From<$name> for GenericFormattedValue { impl From<$name> for GenericFormattedValue {
fn from(v: $name) -> Self { fn from(v: $name) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
GenericFormattedValue::$format_value(v) GenericFormattedValue::$format_value(v)
} }
} }
@ -307,7 +307,7 @@ macro_rules! impl_format_value_traits(
type Error = TryFromGenericFormattedValueError; type Error = TryFromGenericFormattedValueError;
fn try_from(v: GenericFormattedValue) -> Result<$name, Self::Error> { fn try_from(v: GenericFormattedValue) -> Result<$name, Self::Error> {
skip_assert_initialized!(); skip_assert_initialized!();
if let GenericFormattedValue::$format_value(v) = v { if let GenericFormattedValue::$format_value(v) = v {
Ok(v) Ok(v)
} else { } else {
@ -320,20 +320,21 @@ macro_rules! impl_format_value_traits(
impl From<u64> for $name { impl From<u64> for $name {
fn from(v: u64) -> Self { fn from(v: u64) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
$name(Some(v)) $name(Some(v))
} }
} }
impl From<Option<u64>> for $name { impl From<Option<u64>> for $name {
fn from(v: Option<u64>) -> Self { fn from(v: Option<u64>) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
$name(v) $name(v)
} }
} }
impl From<$name> for Option<u64> { impl From<$name> for Option<u64> {
fn from(v: $name) -> Self { fn from(v: $name) -> Self {
skip_assert_initialized!();
v.0 v.0
} }
} }
@ -568,6 +569,7 @@ impl From<i64> for Undefined {
impl From<Undefined> for i64 { impl From<Undefined> for i64 {
fn from(u: Undefined) -> Self { fn from(u: Undefined) -> Self {
skip_assert_initialized!();
u.0 u.0
} }
} }

View file

@ -218,6 +218,7 @@ impl From<(i32, i32)> for Fraction {
impl From<Fraction> for (i32, i32) { impl From<Fraction> for (i32, i32) {
fn from(f: Fraction) -> Self { fn from(f: Fraction) -> Self {
skip_assert_initialized!();
f.0.into() f.0.into()
} }
} }