Update to Rust edition 2021 and minimum supported Rust version to 1.56

This commit is contained in:
Sebastian Dröge 2021-10-31 12:54:12 +02:00
parent 5ae1f72162
commit 0a7d1639e7
48 changed files with 69 additions and 72 deletions

View file

@ -43,19 +43,19 @@ stages:
.debian:11-stable:
extends: .debian:11
variables:
FDO_DISTRIBUTION_TAG: '$GST_RS_STABLE-${GST_RS_IMG_TAG}_2021-10-23.0'
FDO_DISTRIBUTION_TAG: '$GST_RS_STABLE-${GST_RS_IMG_TAG}_2021-10-31.0'
FDO_BASE_IMAGE: "registry.freedesktop.org/gstreamer/gstreamer-rs/debian/bullseye-slim:$GST_RS_STABLE-$GST_RS_IMG_TAG"
.debian:11-msrv:
extends: .debian:11
variables:
FDO_DISTRIBUTION_TAG: '$GST_RS_MSRV-${GST_RS_IMG_TAG}_2021-10-23.0'
FDO_DISTRIBUTION_TAG: '$GST_RS_MSRV-${GST_RS_IMG_TAG}_2021-10-31.0'
FDO_BASE_IMAGE: "registry.freedesktop.org/gstreamer/gstreamer-rs/debian/bullseye-slim:$GST_RS_MSRV-$GST_RS_IMG_TAG"
.debian:11-nightly:
extends: .debian:11
variables:
FDO_DISTRIBUTION_TAG: 'nightly-${GST_RS_IMG_TAG}_2021-10-23.0'
FDO_DISTRIBUTION_TAG: 'nightly-${GST_RS_IMG_TAG}_2021-10-31.0'
FDO_BASE_IMAGE: "registry.freedesktop.org/gstreamer/gstreamer-rs/debian/bullseye-slim:nightly-$GST_RS_IMG_TAG"
.build-debian-container:

View file

@ -5,7 +5,8 @@ authors = ["Sebastian Dröge <sebastian@centricular.com>"]
repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs"
license = "LGPL-2.1-or-later"
description = "Rust AudioFx Plugin"
edition = "2018"
edition = "2021"
rust-version = "1.56"
[dependencies]
gst = { package = "gstreamer", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_16"] }

View file

@ -5,7 +5,8 @@ authors = ["Ruben Gonzalez <rgonzalez@fluendo.com>"]
repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs"
license = "MIT/Apache-2.0"
description = "Claxon FLAC Decoder Plugin"
edition = "2018"
edition = "2021"
rust-version = "1.56"
[dependencies]
gst = { package = "gstreamer", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }

View file

@ -4,7 +4,8 @@ version = "0.8.0"
authors = ["Natanael Mojica <neithanmo@gmail.com>"]
repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs"
license = "LGPL-2.1-or-later"
edition = "2018"
edition = "2021"
rust-version = "1.56"
description = "An Audio filter plugin based on Csound"
[dependencies]

View file

@ -5,7 +5,8 @@ authors = ["Sebastian Dröge <sebastian@centricular.com>"]
repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs"
license = "MIT/Apache-2.0"
description = "lewton Vorbis Decoder Plugin"
edition = "2018"
edition = "2021"
rust-version = "1.56"
[dependencies]
gst = { package = "gstreamer", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }

View file

@ -3,5 +3,4 @@ source ./ci/env.sh
set -e
export CARGO_HOME='/usr/local/cargo'
# Install 0.9.4 until Rust 1.56 is the minimum supported version here
cargo install cargo-c --version 0.9.4+cargo-0.56
cargo install cargo-c --version 0.9.5+cargo-0.57

View file

@ -5,7 +5,8 @@ authors = ["Sebastian Dröge <sebastian@centricular.com>"]
repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs"
license = "MIT/Apache-2.0"
description = "Rust File Plugin"
edition = "2018"
edition = "2021"
rust-version = "1.56"
[dependencies]
url = "2"

View file

@ -1,7 +1,6 @@
use gst::glib;
use url::Url;
use std::convert::AsRef;
use std::fmt;
use std::ops::Deref;
use std::path::{Path, PathBuf};

View file

@ -5,7 +5,8 @@ authors = ["Jordan Petridis <jordan@centricular.com>"]
repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs"
description = "libsodium-based file encryption and decryption"
license = "MIT"
edition = "2018"
edition = "2021"
rust-version = "1.56"
[dependencies]
gst = { package="gstreamer", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }

View file

@ -306,8 +306,6 @@ impl Decrypter {
true
}
QueryView::Duration(ref mut q) => {
use std::convert::TryInto;
if q.format() != gst::Format::Bytes {
return pad.query_default(Some(element), query);
}

View file

@ -284,8 +284,6 @@ impl Encrypter {
true
}
QueryView::Duration(ref mut q) => {
use std::convert::TryInto;
if q.format() != gst::Format::Bytes {
return pad.query_default(Some(element), query);
}

View file

@ -5,7 +5,8 @@ authors = ["Sebastian Dröge <sebastian@centricular.com>"]
license = "LGPL-2.1-or-later"
description = "Threadshare Plugin"
repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs"
edition = "2018"
edition = "2021"
rust-version = "1.56"
[dependencies]
libc = "0.2"

View file

@ -28,7 +28,6 @@ use gst::{gst_debug, gst_error, gst_log, gst_trace};
use once_cell::sync::Lazy;
use std::convert::TryInto;
use std::sync::Arc;
use std::sync::Mutex as StdMutex;
use std::time::Duration;

View file

@ -34,10 +34,8 @@ use crate::runtime::prelude::*;
use crate::runtime::{self, Context, PadSink, PadSinkRef, Task};
use crate::socket::{wrap_socket, GioSocketWrapper};
use std::convert::TryInto;
use std::mem;
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
use std::string::ToString;
use std::sync::Mutex as StdMutex;
use std::sync::{Arc, RwLock};
use std::time::Duration;

View file

@ -5,7 +5,8 @@ authors = ["Sebastian Dröge <sebastian@centricular.com>"]
repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs"
license = "MIT/Apache-2.0"
description = "Rust HTTP Plugin"
edition = "2018"
edition = "2021"
rust-version = "1.56"
[dependencies]
url = "2.1"

View file

@ -341,7 +341,6 @@ impl ReqwestHttpSrc {
) -> Result<State, Option<gst::ErrorMessage>> {
use headers::{Connection, ContentLength, ContentRange, HeaderMapExt, Range, UserAgent};
use reqwest::header::{self, HeaderMap, HeaderName, HeaderValue};
use std::str::FromStr;
gst_debug!(CAT, obj: src, "Creating new request for {}", uri);
@ -371,19 +370,17 @@ impl ReqwestHttpSrc {
}
}
headers.typed_insert(UserAgent::from_str(&settings.user_agent).unwrap());
headers.typed_insert(settings.user_agent.parse::<UserAgent>().unwrap());
if !settings.compress {
// Compression is the default
headers.insert(
header::ACCEPT_ENCODING,
HeaderValue::from_str("identity").unwrap(),
"identity".parse::<HeaderValue>().unwrap(),
);
};
if let Some(ref extra_headers) = settings.extra_headers {
use std::convert::TryFrom;
for (field, value) in extra_headers.iter() {
let field = match HeaderName::try_from(field) {
Ok(field) => field,
@ -416,7 +413,7 @@ impl ReqwestHttpSrc {
let value = value.get::<Option<&str>>().unwrap().unwrap_or("");
let value = match HeaderValue::from_str(value) {
let value = match value.parse::<HeaderValue>() {
Ok(value) => value,
Err(_) => {
gst_warning!(
@ -449,7 +446,7 @@ impl ReqwestHttpSrc {
if !settings.cookies.is_empty() {
headers.insert(
header::COOKIE,
HeaderValue::from_str(&settings.cookies.join("; ")).unwrap(),
settings.cookies.join("; ").parse::<HeaderValue>().unwrap(),
);
}
@ -562,7 +559,7 @@ impl ReqwestHttpSrc {
if let Some(content_type) = headers
.get(header::CONTENT_TYPE)
.and_then(|content_type| content_type.to_str().ok())
.and_then(|content_type| mime::Mime::from_str(content_type).ok())
.and_then(|content_type| content_type.parse::<mime::Mime>().ok())
{
gst_debug!(CAT, obj: src, "Got content type {}", content_type);
if let Some(ref mut caps) = caps {

View file

@ -7,7 +7,8 @@ authors = ["Arun Raghavan <arun@arunraghavan.net>",
repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs"
license = "MIT/Apache-2.0"
description = "Amazon Web Services plugin"
edition = "2018"
edition = "2021"
rust-version = "1.56"
[dependencies]
bytes = "1.0"

View file

@ -23,8 +23,6 @@ use rusoto_s3::{
use once_cell::sync::Lazy;
use std::convert::From;
use std::str::FromStr;
use std::sync::Mutex;
use crate::s3url::*;
@ -521,7 +519,8 @@ impl ObjectImpl for S3Sink {
}
"region" => {
let region = value.get::<String>().expect("type checked upstream");
settings.region = Region::from_str(&region)
settings.region = region
.parse::<Region>()
.or_else(|_| {
let (name, endpoint) = region.split_once('+').ok_or(())?;
Ok(Region::Custom {

View file

@ -6,8 +6,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::str::FromStr;
use percent_encoding::{percent_decode, percent_encode, AsciiSet, CONTROLS};
use rusoto_core::Region;
use url::Url;
@ -75,7 +73,8 @@ pub fn parse_s3_url(url_str: &str) -> Result<GstS3Url, String> {
}
let host = url.host_str().unwrap();
let region = Region::from_str(host)
let region = host
.parse::<Region>()
.or_else(|_| {
let (name, endpoint) = host.split_once('+').ok_or(())?;
let name =

View file

@ -3,7 +3,8 @@ name = "gst-plugin-json"
version = "0.8.0"
authors = ["Mathieu Duponchelle <mathieu@centricular.com>"]
license = "LGPL-2.1-or-later"
edition = "2018"
edition = "2021"
rust-version = "1.56"
description = "Rust JSON Plugin"
repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs"

View file

@ -23,7 +23,6 @@ use gst::{gst_debug, gst_error, gst_info, gst_log, gst_trace, gst_warning};
use once_cell::sync::Lazy;
use std::cmp;
use std::convert::TryInto;
use std::sync::{Mutex, MutexGuard};
use serde::Deserialize;

View file

@ -3,7 +3,8 @@ name = "gst-plugin-regex"
version = "0.8.0"
authors = ["Mathieu Duponchelle <mathieu@centricular.com>"]
license = "LGPL-2.1-or-later"
edition = "2018"
edition = "2021"
rust-version = "1.56"
description = "Rust Regular Expression Plugin"
repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs"

View file

@ -3,7 +3,8 @@ name = "gst-plugin-textwrap"
version = "0.8.0"
authors = ["Mathieu Duponchelle <mathieu@centricular.com>"]
license = "LGPL-2.1-or-later"
edition = "2018"
edition = "2021"
rust-version = "1.56"
description = "Rust Text Wrap Plugin"
repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs"

View file

@ -4,7 +4,8 @@ version = "0.8.0"
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs"
license = "MIT/Apache-2.0"
edition = "2018"
edition = "2021"
rust-version = "1.56"
description = "Rust Tutorial Plugin"
[dependencies]

View file

@ -4,7 +4,8 @@ version = "0.8.0"
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs"
license = "LGPL-2.1-or-later"
edition = "2018"
edition = "2021"
rust-version = "1.56"
description = "Fallback Switcher Plugin"
[dependencies]

View file

@ -20,7 +20,6 @@ use gst::prelude::*;
use gst::subclass::prelude::*;
use gst::{gst_debug, gst_error, gst_info, gst_warning};
use std::convert::TryFrom;
use std::mem;
use std::sync::Mutex;
use std::time::Instant;

View file

@ -5,7 +5,8 @@ authors = ["Sebastian Dröge <sebastian@centricular.com>"]
license = "LGPL-2.1-or-later"
description = "Toggle Record Plugin"
repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs"
edition = "2018"
edition = "2021"
rust-version = "1.56"
[dependencies]
gst = { package = "gstreamer", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }

View file

@ -9,7 +9,8 @@ repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs"
license = "MIT"
homepage = "https://gstreamer.freedesktop.org"
keywords = ["gstreamer", "multimedia", "cargo"]
edition = "2018"
edition = "2021"
rust-version = "1.56"
[dependencies]
chrono = "0.4.6"

View file

@ -33,7 +33,6 @@
mod git;
use chrono::TimeZone;
use std::convert::TryInto;
use std::time::SystemTime;
use std::{env, fs, path};

View file

@ -5,7 +5,8 @@ authors = ["Guillaume Desmottes <guillaume.desmottes@collabora.com>"]
repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs"
license = "MIT/Apache-2.0"
description = "CDG Plugin"
edition = "2018"
edition = "2021"
rust-version = "1.56"
[dependencies]
gst = { package = "gstreamer", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_12"] }

View file

@ -13,7 +13,6 @@ use gst::subclass::prelude::*;
use gst_base::prelude::*;
use gst_base::subclass::prelude::*;
use once_cell::sync::Lazy;
use std::convert::TryInto;
use crate::constants::{
CDG_COMMAND, CDG_HEIGHT, CDG_MASK, CDG_PACKET_PERIOD, CDG_PACKET_SIZE, CDG_WIDTH,

View file

@ -3,7 +3,8 @@ name = "gst-plugin-closedcaption"
version = "0.8.0"
authors = ["Sebastian Dröge <sebastian@centricular.com>", "Jordan Petridis <jordan@centricular.com>", "Matthew Waters <matthew@centricular.com>"]
license = "LGPL-2.1-or-later"
edition = "2018"
edition = "2021"
rust-version = "1.56"
description = "Rust Closed Caption Plugin"
repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs"

View file

@ -25,7 +25,6 @@ use gst::{
use gst_video::ValidVideoTimeCode;
use std::cmp;
use std::convert::TryInto;
use std::sync::{Mutex, MutexGuard};
use once_cell::sync::Lazy;

View file

@ -25,7 +25,6 @@ use gst::{
};
use std::cmp;
use std::convert::TryInto;
use std::sync::{Mutex, MutexGuard};
use once_cell::sync::Lazy;
@ -106,8 +105,6 @@ fn parse_timecode(
framerate: gst::Fraction,
tc: &TimeCode,
) -> Result<gst_video::ValidVideoTimeCode, gst::FlowError> {
use std::convert::TryFrom;
let mut tc = tc.clone();
// Workaround for various SCC files having invalid drop frame timecodes:
// Every full minute the first two timecodes are skipped, except for every tenth minute.

View file

@ -113,9 +113,6 @@ fn test_parse() {
/// Test that ensures timecode parsing is the expected one
#[test]
fn test_timecodes() {
use std::convert::TryInto;
use std::str::FromStr;
init();
let data = include_bytes!("timecodes-cut-down-sample.scc").as_ref();
@ -147,7 +144,7 @@ fn test_timecodes() {
let mut valid_timecodes: VecDeque<ValidVideoTimeCode> = timecodes
.iter()
.map(|s| {
let mut t = VideoTimeCode::from_str(s).unwrap();
let mut t = s.parse::<VideoTimeCode>().unwrap();
t.set_fps(gst::Fraction::new(30000, 1001));
t.set_flags(gst_video::VideoTimeCodeFlags::DROP_FRAME);
t

View file

@ -2,7 +2,8 @@
name = "gst-plugin-dav1d"
version = "0.8.0"
authors = ["Philippe Normand <philn@igalia.com>"]
edition = "2018"
edition = "2021"
rust-version = "1.56"
repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs"
license = "MIT/Apache-2.0"
description = "Dav1d Plugin"

View file

@ -15,9 +15,7 @@ use gst_video::subclass::prelude::*;
use once_cell::sync::Lazy;
use std::convert::TryInto;
use std::i32;
use std::str::FromStr;
use std::sync::Mutex;
#[derive(Default)]
@ -80,7 +78,7 @@ impl Dav1dDec {
None => format_desc.into(),
}
};
gst_video::VideoFormat::from_str(&f).unwrap_or_else(|_| {
f.parse::<gst_video::VideoFormat>().unwrap_or_else(|_| {
gst_warning!(CAT, "Unsupported dav1d format: {}", f);
gst_video::VideoFormat::Unknown
})

View file

@ -5,7 +5,8 @@ authors = ["Arun Raghavan <arun@asymptotic.io>"]
repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs"
license = "MIT/Apache-2.0"
description = "FFV1 Decoder Plugin"
edition = "2018"
edition = "2021"
rust-version = "1.56"
[dependencies]
byte-slice-cast = "1"

View file

@ -4,7 +4,8 @@ version = "0.8.0"
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs"
license = "MIT/Apache-2.0"
edition = "2018"
edition = "2021"
rust-version = "1.56"
description = "Rust FLV Plugin"
[dependencies]

View file

@ -4,7 +4,8 @@ version = "0.8.0"
authors = ["Markus Ebner <info@ebner-markus.de>"]
repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs"
license = "MIT/Apache-2.0"
edition = "2018"
edition = "2021"
rust-version = "1.56"
description = "GStreamer GIF plugin"
[dependencies]

View file

@ -4,7 +4,8 @@ version = "0.1.0"
authors = ["Bilal Elmoussaoui <bil.elmoussaoui@gmail.com>", "Jordan Petridis <jordan@centricular.com>", "Sebastian Dröge <sebastian@centricular.com>"]
repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs"
license = "MPL-2.0"
edition = "2018"
edition = "2021"
rust-version = "1.56"
description = "GTK 4 Sink element and Paintable widget"
[dependencies]

View file

@ -12,7 +12,6 @@
use gtk::prelude::*;
use gtk::{gdk, glib};
use std::collections::{HashMap, HashSet};
use std::convert::AsRef;
#[derive(Debug)]
pub struct Frame {

View file

@ -4,7 +4,8 @@ version = "0.8.0"
authors = ["Julien Bardagi <julien.bardagi@gmail.com>"]
repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs"
license = "MIT/Apache-2.0"
edition = "2018"
edition = "2021"
rust-version = "1.56"
description = "HSV manipulation elements, written in Rust"
[dependencies]

View file

@ -18,7 +18,6 @@ use std::i32;
use std::sync::Mutex;
use once_cell::sync::Lazy;
use std::convert::TryInto;
use super::super::hsvutils;

View file

@ -17,7 +17,6 @@ use std::i32;
use std::sync::Mutex;
use once_cell::sync::Lazy;
use std::convert::TryInto;
use super::super::hsvutils;

View file

@ -5,7 +5,8 @@ authors = ["Sebastian Dröge <sebastian@centricular.com>"]
repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs"
license = "MIT/Apache-2.0"
description = "rav1e AV1 Encoder Plugin"
edition = "2018"
edition = "2021"
rust-version = "1.56"
[dependencies]
gst = { package = "gstreamer", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }

View file

@ -4,7 +4,8 @@ version = "0.8.0"
authors = ["Natanael Mojica <neithanmo@gmail.com>"]
repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs"
license = "MIT/Apache-2.0"
edition = "2018"
edition = "2021"
rust-version = "1.56"
description = "An PNG encoder/decoder written in pure Rust"
[dependencies]

View file

@ -3,7 +3,8 @@ name = "gst-plugin-webp"
version = "0.8.0"
authors = ["Mathieu Duponchelle <mathieu@centricular.com>"]
license = "LGPL-2.1-or-later"
edition = "2018"
edition = "2021"
rust-version = "1.56"
description = "WebP Plugin"
repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs"