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!(