From 153d1bba161fe885f06778c8edcd0d7427ea62df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sat, 19 Oct 2024 17:30:28 +0300 Subject: [PATCH] examples: Update to derive_more 1.0 Part-of: --- .gitlab-ci.yml | 3 +- Cargo.lock | 43 +++++++++------------ examples/Cargo.toml | 2 +- examples/src/bin/appsink.rs | 4 +- examples/src/bin/appsrc.rs | 4 +- examples/src/bin/decodebin.rs | 4 +- examples/src/bin/discoverer.rs | 4 +- examples/src/bin/encodebin.rs | 4 +- examples/src/bin/overlay-composition-d2d.rs | 4 +- examples/src/bin/overlay-composition.rs | 4 +- examples/src/bin/pango-cairo.rs | 4 +- examples/src/bin/rtpfecclient.rs | 10 ++--- examples/src/bin/rtpfecserver.rs | 8 ++-- examples/src/bin/rtsp-server-custom-auth.rs | 4 +- examples/src/bin/rtsp-server-record.rs | 6 +-- examples/src/bin/rtsp-server-subclass.rs | 4 +- examples/src/bin/rtsp-server.rs | 6 +-- examples/src/bin/subclass.rs | 4 +- examples/src/bin/tagsetter.rs | 6 +-- examples/src/bin/thumbnail.rs | 4 +- examples/src/bin/transmux.rs | 4 +- examples/src/glupload.rs | 4 +- 22 files changed, 66 insertions(+), 74 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index db2580457..dd4200e4f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -419,8 +419,7 @@ outdated: - if: $CI_PIPELINE_SOURCE == "schedule" script: - cargo update --color=always - # Ignore derive_more until we can depend on Rust 1.75 or newer - - cargo outdated --color=always --root-deps-only --exit-code 1 -v --ignore derive_more + - cargo outdated --color=always --root-deps-only --exit-code 1 -v coverage: allow_failure: true diff --git a/Cargo.lock b/Cargo.lock index 1f0647679..ae1ef0ecd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -316,12 +316,6 @@ dependencies = [ "crossbeam-utils", ] -[[package]] -name = "convert_case" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" - [[package]] name = "core-foundation" version = "0.9.4" @@ -425,15 +419,23 @@ checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" [[package]] name = "derive_more" -version = "0.99.18" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" +checksum = "4a9b99b9cbbe49445b21764dc0625032a89b145a2642e67603e1c936f5458d05" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" dependencies = [ - "convert_case", "proc-macro2", "quote", - "rustc_version", "syn", + "unicode-xid", ] [[package]] @@ -2135,15 +2137,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "rustc_version" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" -dependencies = [ - "semver", -] - [[package]] name = "rustix" version = "0.38.37" @@ -2178,12 +2171,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" -[[package]] -name = "semver" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" - [[package]] name = "serde" version = "1.0.210" @@ -2467,6 +2454,12 @@ version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + [[package]] name = "version-compare" version = "0.2.0" diff --git a/examples/Cargo.toml b/examples/Cargo.toml index 4a866f5f8..7a96cb8fd 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -28,7 +28,7 @@ gio = { workspace = true, optional = true } anyhow = "1.0" byte-slice-cast = "1" cairo-rs = { workspace = true, features=["use_glib"], optional = true } -derive_more = "0.99.5" +derive_more = { version = "1", features = ["display", "error"] } futures = "0.3" # Since there's nothing Windows-specific to enable on gstreamer-rs, unconditionally enable glutin's WGL backend glutin = { version = "0.31", optional = true, default-features = false, features = ["wgl"] } diff --git a/examples/src/bin/appsink.rs b/examples/src/bin/appsink.rs index 601c5fc0d..593a2e3a2 100644 --- a/examples/src/bin/appsink.rs +++ b/examples/src/bin/appsink.rs @@ -12,14 +12,14 @@ use anyhow::Error; use byte_slice_cast::*; -use derive_more::{Display, Error}; +use derive_more::derive::{Display, Error}; use gst::{element_error, prelude::*}; #[path = "../examples-common.rs"] mod examples_common; #[derive(Debug, Display, Error)] -#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")] +#[display("Received error from {src}: {error} (debug: {debug:?})")] struct ErrorMessage { src: glib::GString, error: glib::Error, diff --git a/examples/src/bin/appsrc.rs b/examples/src/bin/appsrc.rs index 12daf5990..6a6fd897f 100644 --- a/examples/src/bin/appsrc.rs +++ b/examples/src/bin/appsrc.rs @@ -11,7 +11,7 @@ // Video / BGRx (4 bytes) / 2 fps use anyhow::Error; -use derive_more::{Display, Error}; +use derive_more::derive::{Display, Error}; use gst::prelude::*; use gst_video::prelude::*; @@ -19,7 +19,7 @@ use gst_video::prelude::*; mod examples_common; #[derive(Debug, Display, Error)] -#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")] +#[display("Received error from {src}: {error} (debug: {debug:?})")] struct ErrorMessage { src: glib::GString, error: glib::Error, diff --git a/examples/src/bin/decodebin.rs b/examples/src/bin/decodebin.rs index 787f39964..87a9a3fb7 100644 --- a/examples/src/bin/decodebin.rs +++ b/examples/src/bin/decodebin.rs @@ -35,14 +35,14 @@ use std::{ }; use anyhow::Error; -use derive_more::{Display, Error}; +use derive_more::derive::{Display, Error}; use gst::{element_error, element_warning, prelude::*}; #[path = "../examples-common.rs"] mod examples_common; #[derive(Debug, Display, Error)] -#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")] +#[display("Received error from {src}: {error} (debug: {debug:?})")] struct ErrorMessage { src: glib::GString, error: glib::Error, diff --git a/examples/src/bin/discoverer.rs b/examples/src/bin/discoverer.rs index deecdf91e..590af3725 100644 --- a/examples/src/bin/discoverer.rs +++ b/examples/src/bin/discoverer.rs @@ -11,14 +11,14 @@ use std::env; use anyhow::Error; -use derive_more::{Display, Error}; +use derive_more::derive::{Display, Error}; use gst_pbutils::{prelude::*, DiscovererInfo, DiscovererStreamInfo}; #[path = "../examples-common.rs"] mod examples_common; #[derive(Debug, Display, Error)] -#[display(fmt = "Discoverer error {_0}")] +#[display("Discoverer error {_0}")] struct DiscovererError(#[error(not(source))] &'static str); fn print_tags(info: &DiscovererInfo) { diff --git a/examples/src/bin/encodebin.rs b/examples/src/bin/encodebin.rs index 501273353..ba5266fc4 100644 --- a/examples/src/bin/encodebin.rs +++ b/examples/src/bin/encodebin.rs @@ -18,7 +18,7 @@ use std::{ }; use anyhow::Error; -use derive_more::{Display, Error}; +use derive_more::derive::{Display, Error}; use gst::{element_error, element_warning}; use gst_pbutils::prelude::*; @@ -26,7 +26,7 @@ use gst_pbutils::prelude::*; mod examples_common; #[derive(Debug, Display, Error)] -#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")] +#[display("Received error from {src}: {error} (debug: {debug:?})")] struct ErrorMessage { src: glib::GString, error: glib::Error, diff --git a/examples/src/bin/overlay-composition-d2d.rs b/examples/src/bin/overlay-composition-d2d.rs index 9ef15c900..b326a447f 100644 --- a/examples/src/bin/overlay-composition-d2d.rs +++ b/examples/src/bin/overlay-composition-d2d.rs @@ -10,7 +10,7 @@ use std::sync::{Arc, Mutex}; use byte_slice_cast::*; use anyhow::Error; -use derive_more::{Display, Error}; +use derive_more::derive::{Display, Error}; use gst::prelude::*; use windows::{ Foundation::Numerics::*, @@ -26,7 +26,7 @@ use windows::{ }; #[derive(Debug, Display, Error)] -#[display(fmt = "Received error from {}: {} (debug: {:?})", src, error, debug)] +#[display("Received error from {}: {} (debug: {:?})", src, error, debug)] struct ErrorMessage { src: glib::GString, error: glib::Error, diff --git a/examples/src/bin/overlay-composition.rs b/examples/src/bin/overlay-composition.rs index 9a6d72c44..fcf796dad 100644 --- a/examples/src/bin/overlay-composition.rs +++ b/examples/src/bin/overlay-composition.rs @@ -14,7 +14,7 @@ use std::{ }; use anyhow::Error; -use derive_more::{Display, Error}; +use derive_more::derive::{Display, Error}; use gst::prelude::*; use pango::prelude::*; @@ -22,7 +22,7 @@ use pango::prelude::*; mod examples_common; #[derive(Debug, Display, Error)] -#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")] +#[display("Received error from {src}: {error} (debug: {debug:?})")] struct ErrorMessage { src: glib::GString, error: glib::Error, diff --git a/examples/src/bin/pango-cairo.rs b/examples/src/bin/pango-cairo.rs index df8030c47..9d70399d7 100644 --- a/examples/src/bin/pango-cairo.rs +++ b/examples/src/bin/pango-cairo.rs @@ -17,7 +17,7 @@ use std::{ }; use anyhow::Error; -use derive_more::{Display, Error}; +use derive_more::derive::{Display, Error}; use gst::prelude::*; use pango::prelude::*; @@ -25,7 +25,7 @@ use pango::prelude::*; mod examples_common; #[derive(Debug, Display, Error)] -#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")] +#[display("Received error from {src}: {error} (debug: {debug:?})")] struct ErrorMessage { src: glib::GString, error: glib::Error, diff --git a/examples/src/bin/rtpfecclient.rs b/examples/src/bin/rtpfecclient.rs index a3b4c7a5a..3508381a0 100644 --- a/examples/src/bin/rtpfecclient.rs +++ b/examples/src/bin/rtpfecclient.rs @@ -6,22 +6,22 @@ use gst::{element_error, prelude::*}; mod examples_common; use anyhow::Error; -use derive_more::{Display, Error}; +use derive_more::derive::{Display, Error}; #[derive(Debug, Display, Error)] -#[display(fmt = "No such pad {_0} in {_1}")] +#[display("No such pad {_0} in {_1}")] struct NoSuchPad(#[error(not(source))] &'static str, String); #[derive(Debug, Display, Error)] -#[display(fmt = "Unknown payload type {_0}")] +#[display("Unknown payload type {_0}")] struct UnknownPT(#[error(not(source))] u32); #[derive(Debug, Display, Error)] -#[display(fmt = "Usage: {_0} (play | record) DROP_PROBABILITY")] +#[display("Usage: {_0} (play | record) DROP_PROBABILITY")] struct UsageError(#[error(not(source))] String); #[derive(Debug, Display, Error)] -#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")] +#[display("Received error from {src}: {error} (debug: {debug:?})")] struct ErrorMessage { src: glib::GString, error: glib::Error, diff --git a/examples/src/bin/rtpfecserver.rs b/examples/src/bin/rtpfecserver.rs index 32e610436..d852b34da 100644 --- a/examples/src/bin/rtpfecserver.rs +++ b/examples/src/bin/rtpfecserver.rs @@ -6,18 +6,18 @@ mod examples_common; use std::env; use anyhow::Error; -use derive_more::{Display, Error}; +use derive_more::derive::{Display, Error}; #[derive(Debug, Display, Error)] -#[display(fmt = "No such pad {_0} in {_1}")] +#[display("No such pad {_0} in {_1}")] struct NoSuchPad(&'static str, String); #[derive(Debug, Display, Error)] -#[display(fmt = "Usage: {_0} URI FEC_PERCENTAGE")] +#[display("Usage: {_0} URI FEC_PERCENTAGE")] struct UsageError(#[error(not(source))] String); #[derive(Debug, Display, Error)] -#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")] +#[display("Received error from {src}: {error} (debug: {debug:?})")] struct ErrorMessage { src: glib::GString, error: glib::Error, diff --git a/examples/src/bin/rtsp-server-custom-auth.rs b/examples/src/bin/rtsp-server-custom-auth.rs index 324641258..88da5b4a9 100644 --- a/examples/src/bin/rtsp-server-custom-auth.rs +++ b/examples/src/bin/rtsp-server-custom-auth.rs @@ -5,14 +5,14 @@ #![allow(clippy::non_send_fields_in_send_ty)] use anyhow::Error; -use derive_more::{Display, Error}; +use derive_more::derive::{Display, Error}; use gst_rtsp_server::prelude::*; #[path = "../examples-common.rs"] mod examples_common; #[derive(Debug, Display, Error)] -#[display(fmt = "Could not get mount points")] +#[display("Could not get mount points")] struct NoMountPoints; fn main_loop() -> Result<(), Error> { diff --git a/examples/src/bin/rtsp-server-record.rs b/examples/src/bin/rtsp-server-record.rs index 2d692ad5f..d0b070c24 100644 --- a/examples/src/bin/rtsp-server-record.rs +++ b/examples/src/bin/rtsp-server-record.rs @@ -7,18 +7,18 @@ use std::env; use anyhow::Error; -use derive_more::{Display, Error}; +use derive_more::derive::{Display, Error}; use gst_rtsp_server::prelude::*; #[path = "../examples-common.rs"] mod examples_common; #[derive(Debug, Display, Error)] -#[display(fmt = "Could not get mount points")] +#[display("Could not get mount points")] struct NoMountPoints; #[derive(Debug, Display, Error)] -#[display(fmt = "Usage: {_0} LAUNCH_LINE")] +#[display("Usage: {_0} LAUNCH_LINE")] struct UsageError(#[error(not(source))] String); fn main_loop() -> Result<(), Error> { diff --git a/examples/src/bin/rtsp-server-subclass.rs b/examples/src/bin/rtsp-server-subclass.rs index c9db8eb8b..aab9b89b8 100644 --- a/examples/src/bin/rtsp-server-subclass.rs +++ b/examples/src/bin/rtsp-server-subclass.rs @@ -9,14 +9,14 @@ #![allow(clippy::non_send_fields_in_send_ty)] use anyhow::Error; -use derive_more::{Display, Error}; +use derive_more::derive::{Display, Error}; use gst_rtsp_server::prelude::*; #[path = "../examples-common.rs"] mod examples_common; #[derive(Debug, Display, Error)] -#[display(fmt = "Could not get mount points")] +#[display("Could not get mount points")] struct NoMountPoints; fn main_loop() -> Result<(), Error> { diff --git a/examples/src/bin/rtsp-server.rs b/examples/src/bin/rtsp-server.rs index 404f66294..097c558f5 100644 --- a/examples/src/bin/rtsp-server.rs +++ b/examples/src/bin/rtsp-server.rs @@ -6,18 +6,18 @@ use std::env; use anyhow::Error; -use derive_more::{Display, Error}; +use derive_more::derive::{Display, Error}; use gst_rtsp_server::prelude::*; #[path = "../examples-common.rs"] mod examples_common; #[derive(Debug, Display, Error)] -#[display(fmt = "Could not get mount points")] +#[display("Could not get mount points")] struct NoMountPoints; #[derive(Debug, Display, Error)] -#[display(fmt = "Usage: {_0} LAUNCH_LINE")] +#[display("Usage: {_0} LAUNCH_LINE")] struct UsageError(#[error(not(source))] String); fn main_loop() -> Result<(), Error> { diff --git a/examples/src/bin/subclass.rs b/examples/src/bin/subclass.rs index a5cb0ab5d..3d4d36a90 100644 --- a/examples/src/bin/subclass.rs +++ b/examples/src/bin/subclass.rs @@ -8,7 +8,7 @@ #![allow(clippy::non_send_fields_in_send_ty)] use anyhow::Error; -use derive_more::{Display, Error}; +use derive_more::derive::{Display, Error}; use gst::prelude::*; #[path = "../examples-common.rs"] @@ -231,7 +231,7 @@ mod fir_filter { } #[derive(Debug, Display, Error)] -#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")] +#[display("Received error from {src}: {error} (debug: {debug:?})")] struct ErrorMessage { src: glib::GString, error: glib::Error, diff --git a/examples/src/bin/tagsetter.rs b/examples/src/bin/tagsetter.rs index 0f8c066b3..b1efb9c89 100644 --- a/examples/src/bin/tagsetter.rs +++ b/examples/src/bin/tagsetter.rs @@ -19,18 +19,18 @@ // This merge-mode can also be supplied to any method that adds new tags. use anyhow::{anyhow, Error}; -use derive_more::{Display, Error}; +use derive_more::derive::{Display, Error}; use gst::prelude::*; #[path = "../examples-common.rs"] mod examples_common; #[derive(Debug, Display, Error)] -#[display(fmt = "Missing element {_0}")] +#[display("Missing element {_0}")] struct MissingElement(#[error(not(source))] String); #[derive(Debug, Display, Error)] -#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")] +#[display("Received error from {src}: {error} (debug: {debug:?})")] struct ErrorMessage { src: glib::GString, error: glib::Error, diff --git a/examples/src/bin/thumbnail.rs b/examples/src/bin/thumbnail.rs index 9d860bb0f..df522fa33 100644 --- a/examples/src/bin/thumbnail.rs +++ b/examples/src/bin/thumbnail.rs @@ -8,7 +8,7 @@ // produce tightly packed pixels, and in case of RGBx never. use anyhow::Error; -use derive_more::{Display, Error}; +use derive_more::derive::{Display, Error}; use gst::{element_error, prelude::*}; use gst_video::prelude::*; @@ -16,7 +16,7 @@ use gst_video::prelude::*; mod examples_common; #[derive(Debug, Display, Error)] -#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")] +#[display("Received error from {src}: {error} (debug: {debug:?})")] struct ErrorMessage { src: glib::GString, error: glib::Error, diff --git a/examples/src/bin/transmux.rs b/examples/src/bin/transmux.rs index 878bef73d..2fe1e57ef 100644 --- a/examples/src/bin/transmux.rs +++ b/examples/src/bin/transmux.rs @@ -20,14 +20,14 @@ use std::env; use anyhow::Error; -use derive_more::{Display, Error}; +use derive_more::derive::{Display, Error}; use gst::{element_error, prelude::*}; #[path = "../examples-common.rs"] mod examples_common; #[derive(Debug, Display, Error)] -#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")] +#[display("Received error from {src}: {error} (debug: {debug:?})")] struct ErrorMessage { src: glib::GString, error: glib::Error, diff --git a/examples/src/glupload.rs b/examples/src/glupload.rs index d71dbeab1..2a6903fd3 100644 --- a/examples/src/glupload.rs +++ b/examples/src/glupload.rs @@ -15,7 +15,7 @@ use std::{ }; use anyhow::{Context, Result}; -use derive_more::{Display, Error}; +use derive_more::derive::{Display, Error}; use glutin::{ config::GetGlConfig as _, context::AsRawContext as _, @@ -28,7 +28,7 @@ use gst_gl::prelude::*; use raw_window_handle::HasRawWindowHandle as _; #[derive(Debug, Display, Error)] -#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")] +#[display("Received error from {src}: {error} (debug: {debug:?})")] struct ErrorMessage { src: glib::GString, error: glib::Error,