gstreamer: Remove unnecessary cast in gst::element_imp_error! and others

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1187>
This commit is contained in:
Sebastian Dröge 2023-01-10 20:55:43 +02:00 committed by GStreamer Marge Bot
parent 608cae3703
commit 0fccb73eb6

View file

@ -1491,76 +1491,52 @@ macro_rules! element_info(
#[macro_export] #[macro_export]
macro_rules! element_imp_error( macro_rules! element_imp_error(
($imp:expr, $err:expr, ($msg:expr), [$debug:expr]) => { { ($imp:expr, $err:expr, ($msg:expr), [$debug:expr]) => { {
use $crate::glib::Cast;
let obj = $imp.obj(); let obj = $imp.obj();
let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap();
$crate::element_error!(obj, $err, ($msg), [$debug]); $crate::element_error!(obj, $err, ($msg), [$debug]);
}}; }};
($imp:expr, $err:expr, ($msg:expr)) => { { ($imp:expr, $err:expr, ($msg:expr)) => { {
use $crate::glib::Cast;
let obj = $imp.obj(); let obj = $imp.obj();
let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap();
$crate::element_error!(obj, $err, ($msg)); $crate::element_error!(obj, $err, ($msg));
}}; }};
($imp:expr, $err:expr, [$debug:expr]) => { { ($imp:expr, $err:expr, [$debug:expr]) => { {
use $crate::glib::Cast;
let obj = $imp.obj(); let obj = $imp.obj();
let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap();
$crate::element_error!(obj, $err, [$debug]); $crate::element_error!(obj, $err, [$debug]);
}}; }};
($imp:expr, $err:expr, ($($msg:tt)*), [$($debug:tt)*]) => { { ($imp:expr, $err:expr, ($($msg:tt)*), [$($debug:tt)*]) => { {
use $crate::glib::Cast;
let obj = $imp.obj(); let obj = $imp.obj();
let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap();
$crate::element_error!(obj, $err, ($($msg)*), [$($debug)*]); $crate::element_error!(obj, $err, ($($msg)*), [$($debug)*]);
}}; }};
($imp:expr, $err:expr, ($($msg:tt)*)) => { { ($imp:expr, $err:expr, ($($msg:tt)*)) => { {
use $crate::glib::Cast;
let obj = $imp.obj(); let obj = $imp.obj();
let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap();
$crate::element_error!(obj, $err, ($($msg)*)); $crate::element_error!(obj, $err, ($($msg)*));
}}; }};
($imp:expr, $err:expr, [$($debug:tt)*]) => { { ($imp:expr, $err:expr, [$($debug:tt)*]) => { {
use $crate::glib::Cast;
let obj = $imp.obj(); let obj = $imp.obj();
let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap();
$crate::element_error!(obj, $err, [$($debug)*]); $crate::element_error!(obj, $err, [$($debug)*]);
}}; }};
($imp:expr, $err:expr, ($msg:expr), [$debug:expr], details: $details:expr) => { { ($imp:expr, $err:expr, ($msg:expr), [$debug:expr], details: $details:expr) => { {
use $crate::glib::Cast;
let obj = $imp.obj(); let obj = $imp.obj();
let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap();
$crate::element_error!(obj, $err, ($msg), [$debug], details: $details); $crate::element_error!(obj, $err, ($msg), [$debug], details: $details);
}}; }};
($imp:expr, $err:expr, ($msg:expr), details: $details:expr) => { { ($imp:expr, $err:expr, ($msg:expr), details: $details:expr) => { {
use $crate::glib::Cast;
let obj = $imp.obj(); let obj = $imp.obj();
let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap();
$crate::element_error!(obj, $err, ($msg), details: $details); $crate::element_error!(obj, $err, ($msg), details: $details);
}}; }};
($imp:expr, $err:expr, [$debug:expr], details: $details:expr) => { { ($imp:expr, $err:expr, [$debug:expr], details: $details:expr) => { {
use $crate::glib::Cast;
let obj = $imp.obj(); let obj = $imp.obj();
let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap();
$crate::element_error!(obj, $err, [$debug], details: $details); $crate::element_error!(obj, $err, [$debug], details: $details);
}}; }};
($imp:expr, $err:expr, ($($msg:tt)*), [$($debug:tt)*], details: $details:expr) => { { ($imp:expr, $err:expr, ($($msg:tt)*), [$($debug:tt)*], details: $details:expr) => { {
use $crate::glib::Cast;
let obj = $imp.obj(); let obj = $imp.obj();
let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap();
$crate::element_error!(obj, $err, ($($msg)*), [$($debug)*], details: $details); $crate::element_error!(obj, $err, ($($msg)*), [$($debug)*], details: $details);
}}; }};
($imp:expr, $err:expr, ($($msg:tt)*), details: $details:expr) => { { ($imp:expr, $err:expr, ($($msg:tt)*), details: $details:expr) => { {
use $crate::glib::Cast;
let obj = $imp.obj(); let obj = $imp.obj();
let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap();
$crate::element_error!(obj, $err, ($($msg)*), details: $details); $crate::element_error!(obj, $err, ($($msg)*), details: $details);
}}; }};
($imp:expr, $err:expr, [$($debug:tt)*], details: $details:expr) => { { ($imp:expr, $err:expr, [$($debug:tt)*], details: $details:expr) => { {
use $crate::glib::Cast;
let obj = $imp.obj(); let obj = $imp.obj();
let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap();
$crate::element_error!(obj, $err, [$($debug)*], details: $details); $crate::element_error!(obj, $err, [$($debug)*], details: $details);
}}; }};
); );
@ -1570,76 +1546,52 @@ macro_rules! element_imp_error(
#[macro_export] #[macro_export]
macro_rules! element_imp_warning( macro_rules! element_imp_warning(
($imp:expr, $err:expr, ($msg:expr), [$debug:expr]) => { { ($imp:expr, $err:expr, ($msg:expr), [$debug:expr]) => { {
use $crate::glib::Cast;
let obj = $imp.obj(); let obj = $imp.obj();
let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap();
$crate::element_warning!(obj, $err, ($msg), [$debug]); $crate::element_warning!(obj, $err, ($msg), [$debug]);
}}; }};
($imp:expr, $err:expr, ($msg:expr)) => { { ($imp:expr, $err:expr, ($msg:expr)) => { {
use $crate::glib::Cast;
let obj = $imp.obj(); let obj = $imp.obj();
let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap();
$crate::element_warning!(obj, $err, ($msg)); $crate::element_warning!(obj, $err, ($msg));
}}; }};
($imp:expr, $err:expr, [$debug:expr]) => { { ($imp:expr, $err:expr, [$debug:expr]) => { {
use $crate::glib::Cast;
let obj = $imp.obj(); let obj = $imp.obj();
let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap();
$crate::element_warning!(obj, $err, [$debug]); $crate::element_warning!(obj, $err, [$debug]);
}}; }};
($imp:expr, $err:expr, ($($msg:tt)*), [$($debug:tt)*]) => { { ($imp:expr, $err:expr, ($($msg:tt)*), [$($debug:tt)*]) => { {
use $crate::glib::Cast;
let obj = $imp.obj(); let obj = $imp.obj();
let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap();
$crate::element_warning!(obj, $err, ($($msg)*), [$($debug)*]); $crate::element_warning!(obj, $err, ($($msg)*), [$($debug)*]);
}}; }};
($imp:expr, $err:expr, ($($msg:tt)*)) => { { ($imp:expr, $err:expr, ($($msg:tt)*)) => { {
use $crate::glib::Cast;
let obj = $imp.obj(); let obj = $imp.obj();
let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap();
$crate::element_warning!(obj, $err, ($($msg)*)); $crate::element_warning!(obj, $err, ($($msg)*));
}}; }};
($imp:expr, $err:expr, [$($debug:tt)*]) => { { ($imp:expr, $err:expr, [$($debug:tt)*]) => { {
use $crate::glib::Cast;
let obj = $imp.obj(); let obj = $imp.obj();
let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap();
$crate::element_warning!(obj, $err, [$($debug)*]); $crate::element_warning!(obj, $err, [$($debug)*]);
}}; }};
($imp:expr, $err:expr, ($msg:expr), [$debug:expr], details: $details:expr) => { { ($imp:expr, $err:expr, ($msg:expr), [$debug:expr], details: $details:expr) => { {
use $crate::glib::Cast;
let obj = $imp.obj(); let obj = $imp.obj();
let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap();
$crate::element_warning!(obj, $err, ($msg), [$debug], details: $details); $crate::element_warning!(obj, $err, ($msg), [$debug], details: $details);
}}; }};
($imp:expr, $err:expr, ($msg:expr), details: $details:expr) => { { ($imp:expr, $err:expr, ($msg:expr), details: $details:expr) => { {
use $crate::glib::Cast;
let obj = $imp.obj(); let obj = $imp.obj();
let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap();
$crate::element_warning!(obj, $err, ($msg), details: $details); $crate::element_warning!(obj, $err, ($msg), details: $details);
}}; }};
($imp:expr, $err:expr, [$debug:expr], details: $details:expr) => { { ($imp:expr, $err:expr, [$debug:expr], details: $details:expr) => { {
use $crate::glib::Cast;
let obj = $imp.obj(); let obj = $imp.obj();
let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap();
$crate::element_warning!(obj, $err, [$debug], details: $details); $crate::element_warning!(obj, $err, [$debug], details: $details);
}}; }};
($imp:expr, $err:expr, ($($msg:tt)*), [$($debug:tt)*], details: $details:expr) => { { ($imp:expr, $err:expr, ($($msg:tt)*), [$($debug:tt)*], details: $details:expr) => { {
use $crate::glib::Cast;
let obj = $imp.obj(); let obj = $imp.obj();
let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap();
$crate::element_warning!(obj, $err, ($($msg)*), [$($debug)*], details: $details); $crate::element_warning!(obj, $err, ($($msg)*), [$($debug)*], details: $details);
}}; }};
($imp:expr, $err:expr, ($($msg:tt)*), details: $details:expr) => { { ($imp:expr, $err:expr, ($($msg:tt)*), details: $details:expr) => { {
use $crate::glib::Cast;
let obj = $imp.obj(); let obj = $imp.obj();
let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap();
$crate::element_warning!(obj, $err, ($($msg)*), details: $details); $crate::element_warning!(obj, $err, ($($msg)*), details: $details);
}}; }};
($imp:expr, $err:expr, [$($debug:tt)*], details: $details:expr) => { { ($imp:expr, $err:expr, [$($debug:tt)*], details: $details:expr) => { {
use $crate::glib::Cast;
let obj = $imp.obj(); let obj = $imp.obj();
let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap();
$crate::element_warning!(obj, $err, [$($debug)*], details: $details); $crate::element_warning!(obj, $err, [$($debug)*], details: $details);
}}; }};
); );
@ -1649,76 +1601,52 @@ macro_rules! element_imp_warning(
#[macro_export] #[macro_export]
macro_rules! element_imp_info( macro_rules! element_imp_info(
($imp:expr, $err:expr, ($msg:expr), [$debug:expr]) => { { ($imp:expr, $err:expr, ($msg:expr), [$debug:expr]) => { {
use $crate::glib::Cast;
let obj = $imp.obj(); let obj = $imp.obj();
let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap();
$crate::element_info!(obj, $err, ($msg), [$debug]); $crate::element_info!(obj, $err, ($msg), [$debug]);
}}; }};
($imp:expr, $err:expr, ($msg:expr)) => { { ($imp:expr, $err:expr, ($msg:expr)) => { {
use $crate::glib::Cast;
let obj = $imp.obj(); let obj = $imp.obj();
let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap();
$crate::element_info!(obj, $err, ($msg)); $crate::element_info!(obj, $err, ($msg));
}}; }};
($imp:expr, $err:expr, [$debug:expr]) => { { ($imp:expr, $err:expr, [$debug:expr]) => { {
use $crate::glib::Cast;
let obj = $imp.obj(); let obj = $imp.obj();
let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap();
$crate::element_info!(obj, $err, [$debug]); $crate::element_info!(obj, $err, [$debug]);
}}; }};
($imp:expr, $err:expr, ($($msg:tt)*), [$($debug:tt)*]) => { { ($imp:expr, $err:expr, ($($msg:tt)*), [$($debug:tt)*]) => { {
use $crate::glib::Cast;
let obj = $imp.obj(); let obj = $imp.obj();
let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap();
$crate::element_info!(obj, $err, ($($msg)*), [$($debug)*]); $crate::element_info!(obj, $err, ($($msg)*), [$($debug)*]);
}}; }};
($imp:expr, $err:expr, ($($msg:tt)*)) => { { ($imp:expr, $err:expr, ($($msg:tt)*)) => { {
use $crate::glib::Cast;
let obj = $imp.obj(); let obj = $imp.obj();
let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap();
$crate::element_info!(obj, $err, ($($msg)*)); $crate::element_info!(obj, $err, ($($msg)*));
}}; }};
($imp:expr, $err:expr, [$($debug:tt)*]) => { { ($imp:expr, $err:expr, [$($debug:tt)*]) => { {
use $crate::glib::Cast;
let obj = $imp.obj(); let obj = $imp.obj();
let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap();
$crate::element_info!(obj, $err, [$($debug)*]); $crate::element_info!(obj, $err, [$($debug)*]);
}}; }};
($imp:expr, $err:expr, ($msg:expr), [$debug:expr], details: $details:expr) => { { ($imp:expr, $err:expr, ($msg:expr), [$debug:expr], details: $details:expr) => { {
use $crate::glib::Cast;
let obj = $imp.obj(); let obj = $imp.obj();
let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap();
$crate::element_info!(obj, $err, ($msg), [$debug], details: $details); $crate::element_info!(obj, $err, ($msg), [$debug], details: $details);
}}; }};
($imp:expr, $err:expr, ($msg:expr), details: $details:expr) => { { ($imp:expr, $err:expr, ($msg:expr), details: $details:expr) => { {
use $crate::glib::Cast;
let obj = $imp.obj(); let obj = $imp.obj();
let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap();
$crate::element_info!(obj, $err, ($msg), details: $details); $crate::element_info!(obj, $err, ($msg), details: $details);
}}; }};
($imp:expr, $err:expr, [$debug:expr], details: $details:expr) => { { ($imp:expr, $err:expr, [$debug:expr], details: $details:expr) => { {
use $crate::glib::Cast;
let obj = $imp.obj(); let obj = $imp.obj();
let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap();
$crate::element_info!(obj, $err, [$debug], details: $details); $crate::element_info!(obj, $err, [$debug], details: $details);
}}; }};
($imp:expr, $err:expr, ($($msg:tt)*), [$($debug:tt)*], details: $details:expr) => { { ($imp:expr, $err:expr, ($($msg:tt)*), [$($debug:tt)*], details: $details:expr) => { {
use $crate::glib::Cast;
let obj = $imp.obj(); let obj = $imp.obj();
let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap();
$crate::element_info!(obj, $err, ($($msg)*), [$($debug)*], details: $details); $crate::element_info!(obj, $err, ($($msg)*), [$($debug)*], details: $details);
}}; }};
($imp:expr, $err:expr, ($($msg:tt)*), details: $details:expr) => { { ($imp:expr, $err:expr, ($($msg:tt)*), details: $details:expr) => { {
use $crate::glib::Cast;
let obj = $imp.obj(); let obj = $imp.obj();
let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap();
$crate::element_info!(obj, $err, ($($msg)*), details: $details); $crate::element_info!(obj, $err, ($($msg)*), details: $details);
}}; }};
($imp:expr, $err:expr, [$($debug:tt)*], details: $details:expr) => { { ($imp:expr, $err:expr, [$($debug:tt)*], details: $details:expr) => { {
use $crate::glib::Cast;
let obj = $imp.obj(); let obj = $imp.obj();
let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap();
$crate::element_info!(obj, $err, [$($debug)*], details: $details); $crate::element_info!(obj, $err, [$($debug)*], details: $details);
}}; }};
); );