From a0522c8193873df4b2881c874e3abe90c33f661b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 31 Aug 2023 09:04:05 +0300 Subject: [PATCH] ptp: Fix compilation with rustc 1.48 That's currently the minimum version we declare in meson.build but the latest changes introduced some usage of 1.62 features. Part-of: --- subprojects/gstreamer/libs/gst/helpers/ptp/io.rs | 13 ++++++++++--- subprojects/gstreamer/libs/gst/helpers/ptp/main.rs | 6 ++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/subprojects/gstreamer/libs/gst/helpers/ptp/io.rs b/subprojects/gstreamer/libs/gst/helpers/ptp/io.rs index 6474ee34ea..d5999bc8e6 100644 --- a/subprojects/gstreamer/libs/gst/helpers/ptp/io.rs +++ b/subprojects/gstreamer/libs/gst/helpers/ptp/io.rs @@ -327,8 +327,11 @@ mod imp { Ok(PollResult { ready_sockets: &*ready_sockets, sockets: &self.sockets, - stdin: (self.pollfd[self.pollfd.len() - 1].revents & POLLIN != 0) - .then_some(&self.stdin), + stdin: if self.pollfd[self.pollfd.len() - 1].revents & POLLIN != 0 { + Some(&self.stdin) + } else { + None + }, stdout: &self.stdout, }) } @@ -866,7 +869,11 @@ mod imp { Ok(PollResult { ready_sockets: &*ready_sockets, sockets: &self.sockets, - stdin: (res == self.handles.len() - 1).then_some(&self.stdin), + stdin: if res == self.handles.len() - 1 { + Some(&self.stdin) + } else { + None + }, stdout: &self.stdout, }) } diff --git a/subprojects/gstreamer/libs/gst/helpers/ptp/main.rs b/subprojects/gstreamer/libs/gst/helpers/ptp/main.rs index e568ed4962..7784e47a41 100644 --- a/subprojects/gstreamer/libs/gst/helpers/ptp/main.rs +++ b/subprojects/gstreamer/libs/gst/helpers/ptp/main.rs @@ -127,7 +127,7 @@ fn run() -> Result<(), Error> { let general_socket = create_socket(PTP_GENERAL_PORT).context("Failed creating general socket")?; - for socket in [&event_socket, &general_socket] { + for socket in [&event_socket, &general_socket].iter() { net::join_multicast_v4(socket, &PTP_MULTICAST_ADDR, iface) .context("Failed to join multicast group")?; } @@ -201,7 +201,9 @@ fn run() -> Result<(), Error> { Err(err) => { bail!( source: err, - "Failed reading from {:?} socket for interface {}", type_, idx, + "Failed reading from {:?} socket for interface {}", + type_, + idx, ); } Ok((read, addr)) => (read, addr),