diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2021-10-31 13:54:12 +0300 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2021-10-31 18:40:05 +0300 |
commit | 0a7d1639e7b33d0bd941997bb88762c35473f0d4 (patch) | |
tree | 375d883100bc8e377c6551d1fb32625677923cc4 /net | |
parent | 5ae1f721620e38acb6cf2569e2129b39b2282a7e (diff) |
Update to Rust edition 2021 and minimum supported Rust version to 1.56
Diffstat (limited to 'net')
-rw-r--r-- | net/reqwest/Cargo.toml | 3 | ||||
-rw-r--r-- | net/reqwest/src/reqwesthttpsrc/imp.rs | 13 | ||||
-rw-r--r-- | net/rusoto/Cargo.toml | 3 | ||||
-rw-r--r-- | net/rusoto/src/s3sink/imp.rs | 5 | ||||
-rw-r--r-- | net/rusoto/src/s3url.rs | 5 |
5 files changed, 13 insertions, 16 deletions
diff --git a/net/reqwest/Cargo.toml b/net/reqwest/Cargo.toml index b57cffec..88bf38c4 100644 --- a/net/reqwest/Cargo.toml +++ b/net/reqwest/Cargo.toml @@ -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" diff --git a/net/reqwest/src/reqwesthttpsrc/imp.rs b/net/reqwest/src/reqwesthttpsrc/imp.rs index a65ae5a8..7025abbe 100644 --- a/net/reqwest/src/reqwesthttpsrc/imp.rs +++ b/net/reqwest/src/reqwesthttpsrc/imp.rs @@ -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 { diff --git a/net/rusoto/Cargo.toml b/net/rusoto/Cargo.toml index 67f9e736..d44f83b5 100644 --- a/net/rusoto/Cargo.toml +++ b/net/rusoto/Cargo.toml @@ -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" diff --git a/net/rusoto/src/s3sink/imp.rs b/net/rusoto/src/s3sink/imp.rs index 90b9f90f..63c42569 100644 --- a/net/rusoto/src/s3sink/imp.rs +++ b/net/rusoto/src/s3sink/imp.rs @@ -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(®ion) + settings.region = region + .parse::<Region>() .or_else(|_| { let (name, endpoint) = region.split_once('+').ok_or(())?; Ok(Region::Custom { diff --git a/net/rusoto/src/s3url.rs b/net/rusoto/src/s3url.rs index b5e59ef6..f9d728d5 100644 --- a/net/rusoto/src/s3url.rs +++ b/net/rusoto/src/s3url.rs @@ -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 = |