about summary refs log tree commit diff stats
path: root/crates/yt_dlp/src/wrapper
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--crates/yt_dlp/src/wrapper/info_json.rs25
1 files changed, 16 insertions, 9 deletions
diff --git a/crates/yt_dlp/src/wrapper/info_json.rs b/crates/yt_dlp/src/wrapper/info_json.rs
index 50a026d..f113fe5 100644
--- a/crates/yt_dlp/src/wrapper/info_json.rs
+++ b/crates/yt_dlp/src/wrapper/info_json.rs
@@ -8,6 +8,9 @@
 // You should have received a copy of the License along with this program.
 // If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
 
+// `yt_dlp` named them like this.
+#![allow(clippy::pub_underscore_fields)]
+
 use std::{collections::HashMap, path::PathBuf};
 
 use pyo3::{types::PyDict, Bound, PyResult, Python};
@@ -146,6 +149,7 @@ pub struct InfoJson {
 
 #[derive(Debug, Deserialize, Serialize, PartialEq)]
 #[serde(deny_unknown_fields)]
+#[allow(missing_copy_implementations)]
 pub struct FilesToMove {}
 
 #[derive(Debug, Deserialize, Serialize, PartialEq)]
@@ -197,8 +201,7 @@ pub struct Subtitle {
     pub url: Url,
 }
 
-#[derive(Debug, Deserialize, Serialize, PartialEq, PartialOrd, Ord, Eq)]
-#[serde(deny_unknown_fields)]
+#[derive(Debug, Deserialize, Serialize, PartialEq, PartialOrd, Ord, Eq, Clone, Copy)]
 pub enum SubtitleExt {
     #[serde(alias = "vtt")]
     Vtt,
@@ -266,7 +269,7 @@ where
     Ok(None)
 }
 
-#[derive(Debug, Deserialize, Serialize, PartialEq, PartialOrd, Ord, Eq)]
+#[derive(Debug, Deserialize, Serialize, PartialEq, PartialOrd, Ord, Eq, Clone, Copy)]
 #[serde(deny_unknown_fields)]
 pub enum SponsorblockChapterType {
     #[serde(alias = "skip")]
@@ -278,7 +281,7 @@ pub enum SponsorblockChapterType {
     #[serde(alias = "poi")]
     Poi,
 }
-#[derive(Debug, Deserialize, Serialize, PartialEq, PartialOrd, Ord, Eq)]
+#[derive(Debug, Deserialize, Serialize, PartialEq, PartialOrd, Ord, Eq, Clone, Copy)]
 #[serde(deny_unknown_fields)]
 pub enum SponsorblockChapterCategory {
     #[serde(alias = "filler")]
@@ -314,13 +317,14 @@ pub enum SponsorblockChapterCategory {
 
 #[derive(Debug, Deserialize, Serialize, PartialEq, PartialOrd)]
 #[serde(deny_unknown_fields)]
+#[allow(missing_copy_implementations)]
 pub struct HeatMapEntry {
     pub start_time: f64,
     pub end_time: f64,
     pub value: f64,
 }
 
-#[derive(Debug, Deserialize, Serialize, PartialEq, PartialOrd, Ord, Eq)]
+#[derive(Debug, Deserialize, Serialize, PartialEq, PartialOrd, Ord, Eq, Clone, Copy)]
 #[serde(deny_unknown_fields)]
 pub enum Extractor {
     #[serde(alias = "generic")]
@@ -337,7 +341,7 @@ pub enum Extractor {
     YouTubeTab,
 }
 
-#[derive(Debug, Deserialize, Serialize, PartialEq, PartialOrd, Ord, Eq)]
+#[derive(Debug, Deserialize, Serialize, PartialEq, PartialOrd, Ord, Eq, Clone, Copy)]
 #[serde(deny_unknown_fields)]
 pub enum ExtractorKey {
     #[serde(alias = "Generic")]
@@ -354,7 +358,7 @@ pub enum ExtractorKey {
     YouTubeTab,
 }
 
-#[derive(Debug, Deserialize, Serialize, PartialEq, PartialOrd, Ord, Eq)]
+#[derive(Debug, Deserialize, Serialize, PartialEq, PartialOrd, Ord, Eq, Clone, Copy)]
 #[serde(deny_unknown_fields)]
 pub enum InfoType {
     #[serde(alias = "playlist")]
@@ -385,6 +389,7 @@ pub enum Parent {
 }
 
 impl Parent {
+    #[must_use]
     pub fn id(&self) -> Option<&str> {
         if let Self::Id(id) = self {
             Some(id)
@@ -421,6 +426,7 @@ impl From<String> for Id {
 
 #[derive(Debug, Deserialize, Serialize, Clone, Eq, PartialEq, PartialOrd, Ord)]
 #[serde(deny_unknown_fields)]
+#[allow(clippy::struct_excessive_bools)]
 pub struct Comment {
     pub id: Id,
     pub text: String,
@@ -522,6 +528,7 @@ pub struct Format {
 
 #[derive(Debug, Deserialize, Serialize, Eq, PartialEq, PartialOrd, Ord)]
 #[serde(deny_unknown_fields)]
+#[allow(missing_copy_implementations)]
 pub struct DownloaderOptions {
     http_chunk_size: u64,
 }
@@ -554,8 +561,8 @@ pub struct Fragment {
 }
 
 impl InfoJson {
-    pub fn to_py_dict(self, py: Python) -> PyResult<Bound<PyDict>> {
-        let output: Bound<PyDict> = json_loads_str(py, self)?;
+    pub fn to_py_dict(self, py: Python<'_>) -> PyResult<Bound<'_, PyDict>> {
+        let output: Bound<'_, PyDict> = json_loads_str(py, self)?;
         Ok(output)
     }
 }