From a3de3b3b2e116d9641777ab1111cdb9bb865438a Mon Sep 17 00:00:00 2001 From: bytedream Date: Fri, 23 Feb 2024 21:05:42 +0100 Subject: [PATCH] Format code --- src/media/streaming.rs | 47 ++++++++++++++---------------------------- src/rating/comment.rs | 2 +- 2 files changed, 17 insertions(+), 32 deletions(-) diff --git a/src/media/streaming.rs b/src/media/streaming.rs index eb8175e..a1aa4f4 100644 --- a/src/media/streaming.rs +++ b/src/media/streaming.rs @@ -42,12 +42,9 @@ impl Stream { raw_streams .adaptive_hls .as_ref() - .map_or( - Err(Error::Input { - message: "no stream available".to_string(), - }), - Ok, - )? + .ok_or(Error::Input { + message: "no stream available".to_string(), + })? .url .clone(), ) @@ -63,12 +60,9 @@ impl Stream { raw_streams .adaptive_hls .as_ref() - .map_or( - Err(Error::Input { - message: "no stream available".to_string(), - }), - Ok, - )? + .ok_or(Error::Input { + message: "no stream available".to_string(), + })? .url .clone(), ) @@ -79,12 +73,9 @@ impl Stream { raw_streams .adaptive_hls .as_ref() - .map_or( - Err(Error::Input { - message: "no stream available".to_string(), - }), - Ok, - )? + .ok_or(Error::Input { + message: "no stream available".to_string(), + })? .url .clone(), ) @@ -124,12 +115,9 @@ impl Stream { raw_streams .adaptive_dash .as_ref() - .map_or( - Err(Error::Input { - message: "no stream available".to_string(), - }), - Ok, - )? + .ok_or(Error::Input { + message: "no stream available".to_string(), + })? .url .clone() } else { @@ -141,12 +129,9 @@ impl Stream { raw_streams .adaptive_dash .as_ref() - .map_or( - Err(Error::Input { - message: "no stream available".to_string(), - }), - Ok, - )? + .ok_or(Error::Input { + message: "no stream available".to_string(), + })? .url .clone() } else { @@ -388,7 +373,7 @@ impl VariantData { id: representation.id.expect("dash representation id"), base: representation .BaseURL - .get(0) + .first() .expect("dash base url") .base .clone(), diff --git a/src/rating/comment.rs b/src/rating/comment.rs index 1771d46..226027e 100644 --- a/src/rating/comment.rs +++ b/src/rating/comment.rs @@ -324,7 +324,7 @@ where match flags.len() { 0 => Ok(false), 1 => { - if flags.get(0).unwrap() == "spoiler" { + if flags[0] == "spoiler" { Ok(true) } else { Err(Error::custom(format!(