From f9b5420c0a3e8709e9b370bb492f571468808179 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 28 Oct 2022 11:04:01 +0300 Subject: [PATCH 1/2] Fix clippy warning warning: useless conversion to the same type: `std::string::String` --> src/playlist.rs:415:77 | 415 | QuotedOrUnquoted::Unquoted(s) => Ok(ClosedCaptionGroupId::Other(String::from(s))), | ^^^^^^^^^^^^^^^ help: consider removing `String::from()`: `s` | = note: `#[warn(clippy::useless_conversion)]` on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion --- src/playlist.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/playlist.rs b/src/playlist.rs index 14d033f..8beaec0 100644 --- a/src/playlist.rs +++ b/src/playlist.rs @@ -412,7 +412,7 @@ impl TryFrom for ClosedCaptionGroupId { fn try_from(s: QuotedOrUnquoted) -> Result { match s { QuotedOrUnquoted::Unquoted(s) if s == "NONE" => Ok(ClosedCaptionGroupId::None), - QuotedOrUnquoted::Unquoted(s) => Ok(ClosedCaptionGroupId::Other(String::from(s))), + QuotedOrUnquoted::Unquoted(s) => Ok(ClosedCaptionGroupId::Other(s)), QuotedOrUnquoted::Quoted(s) => Ok(ClosedCaptionGroupId::GroupId(s)), } } From f66356ba7b03806a8f8eb4d7d6fdad0b385d7c97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 28 Oct 2022 11:18:36 +0300 Subject: [PATCH 2/2] Write out unknown tags for `MediaPlaylist` too Fixes https://github.com/rutgersc/m3u8-rs/issues/55 --- src/playlist.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/playlist.rs b/src/playlist.rs index 8beaec0..0eed8fe 100644 --- a/src/playlist.rs +++ b/src/playlist.rs @@ -764,6 +764,10 @@ impl MediaPlaylist { if let Some(ref start) = self.start { start.write_to(w)?; } + for unknown_tag in &self.unknown_tags { + writeln!(w, "{}", unknown_tag)?; + } + for segment in &self.segments { segment.write_to(w)?; }