From b954ae11340422da630fe65d1c5436733ec16041 Mon Sep 17 00:00:00 2001 From: Luro02 <24826124+Luro02@users.noreply.github.com> Date: Sat, 14 Sep 2019 21:42:06 +0200 Subject: [PATCH] remove all occurences of `ref` --- src/line.rs | 48 +++++++++---------- src/master_playlist.rs | 8 ++-- src/media_playlist.rs | 28 +++++------ src/media_segment.rs | 24 +++++----- .../master_playlist/i_frame_stream_inf.rs | 20 ++++---- src/tags/master_playlist/media.rs | 24 +++++----- src/tags/master_playlist/session_data.rs | 10 ++-- src/tags/master_playlist/stream_inf.rs | 36 +++++++------- src/tags/media_segment/date_range.rs | 20 ++++---- src/tags/media_segment/inf.rs | 4 +- src/tags/media_segment/key.rs | 4 +- src/tags/media_segment/map.rs | 4 +- src/types/closed_captions.rs | 4 +- src/types/decryption_key.rs | 12 ++--- src/types/encryption_method.rs | 2 +- src/types/hdcp_level.rs | 2 +- src/types/media_type.rs | 2 +- 17 files changed, 126 insertions(+), 126 deletions(-) diff --git a/src/line.rs b/src/line.rs index 70328dd..67a7193 100644 --- a/src/line.rs +++ b/src/line.rs @@ -124,30 +124,30 @@ pub enum Tag { impl fmt::Display for Tag { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match *self { - Tag::ExtM3u(ref t) => t.fmt(f), - Tag::ExtXVersion(ref t) => t.fmt(f), - Tag::ExtInf(ref t) => t.fmt(f), - Tag::ExtXByteRange(ref t) => t.fmt(f), - Tag::ExtXDiscontinuity(ref t) => t.fmt(f), - Tag::ExtXKey(ref t) => t.fmt(f), - Tag::ExtXMap(ref t) => t.fmt(f), - Tag::ExtXProgramDateTime(ref t) => t.fmt(f), - Tag::ExtXDateRange(ref t) => t.fmt(f), - Tag::ExtXTargetDuration(ref t) => t.fmt(f), - Tag::ExtXMediaSequence(ref t) => t.fmt(f), - Tag::ExtXDiscontinuitySequence(ref t) => t.fmt(f), - Tag::ExtXEndList(ref t) => t.fmt(f), - Tag::ExtXPlaylistType(ref t) => t.fmt(f), - Tag::ExtXIFramesOnly(ref t) => t.fmt(f), - Tag::ExtXMedia(ref t) => t.fmt(f), - Tag::ExtXStreamInf(ref t) => t.fmt(f), - Tag::ExtXIFrameStreamInf(ref t) => t.fmt(f), - Tag::ExtXSessionData(ref t) => t.fmt(f), - Tag::ExtXSessionKey(ref t) => t.fmt(f), - Tag::ExtXIndependentSegments(ref t) => t.fmt(f), - Tag::ExtXStart(ref t) => t.fmt(f), - Tag::Unknown(ref t) => t.fmt(f), + match &self { + Tag::ExtM3u(value) => value.fmt(f), + Tag::ExtXVersion(value) => value.fmt(f), + Tag::ExtInf(value) => value.fmt(f), + Tag::ExtXByteRange(value) => value.fmt(f), + Tag::ExtXDiscontinuity(value) => value.fmt(f), + Tag::ExtXKey(value) => value.fmt(f), + Tag::ExtXMap(value) => value.fmt(f), + Tag::ExtXProgramDateTime(value) => value.fmt(f), + Tag::ExtXDateRange(value) => value.fmt(f), + Tag::ExtXTargetDuration(value) => value.fmt(f), + Tag::ExtXMediaSequence(value) => value.fmt(f), + Tag::ExtXDiscontinuitySequence(value) => value.fmt(f), + Tag::ExtXEndList(value) => value.fmt(f), + Tag::ExtXPlaylistType(value) => value.fmt(f), + Tag::ExtXIFramesOnly(value) => value.fmt(f), + Tag::ExtXMedia(value) => value.fmt(f), + Tag::ExtXStreamInf(value) => value.fmt(f), + Tag::ExtXIFrameStreamInf(value) => value.fmt(f), + Tag::ExtXSessionData(value) => value.fmt(f), + Tag::ExtXSessionKey(value) => value.fmt(f), + Tag::ExtXIndependentSegments(value) => value.fmt(f), + Tag::ExtXStart(value) => value.fmt(f), + Tag::Unknown(value) => value.fmt(f), } } } diff --git a/src/master_playlist.rs b/src/master_playlist.rs index 0b6cd40..4d1d2a5 100644 --- a/src/master_playlist.rs +++ b/src/master_playlist.rs @@ -276,11 +276,11 @@ impl fmt::Display for MasterPlaylist { for t in &self.session_key_tags { writeln!(f, "{}", t)?; } - if let Some(ref t) = self.independent_segments_tag { - writeln!(f, "{}", t)?; + if let Some(value) = &self.independent_segments_tag { + writeln!(f, "{}", value)?; } - if let Some(ref t) = self.start_tag { - writeln!(f, "{}", t)?; + if let Some(value) = &self.start_tag { + writeln!(f, "{}", value)?; } Ok(()) } diff --git a/src/media_playlist.rs b/src/media_playlist.rs index 238aaf3..3ea878c 100644 --- a/src/media_playlist.rs +++ b/src/media_playlist.rs @@ -282,29 +282,29 @@ impl fmt::Display for MediaPlaylist { writeln!(f, "{}", self.version_tag)?; } writeln!(f, "{}", self.target_duration_tag)?; - if let Some(ref t) = self.media_sequence_tag { - writeln!(f, "{}", t)?; + if let Some(value) = &self.media_sequence_tag { + writeln!(f, "{}", value)?; } - if let Some(ref t) = self.discontinuity_sequence_tag { - writeln!(f, "{}", t)?; + if let Some(value) = &self.discontinuity_sequence_tag { + writeln!(f, "{}", value)?; } - if let Some(ref t) = self.playlist_type_tag { - writeln!(f, "{}", t)?; + if let Some(value) = &self.playlist_type_tag { + writeln!(f, "{}", value)?; } - if let Some(ref t) = self.i_frames_only_tag { - writeln!(f, "{}", t)?; + if let Some(value) = &self.i_frames_only_tag { + writeln!(f, "{}", value)?; } - if let Some(ref t) = self.independent_segments_tag { - writeln!(f, "{}", t)?; + if let Some(value) = &self.independent_segments_tag { + writeln!(f, "{}", value)?; } - if let Some(ref t) = self.start_tag { - writeln!(f, "{}", t)?; + if let Some(value) = &self.start_tag { + writeln!(f, "{}", value)?; } for segment in &self.segments { write!(f, "{}", segment)?; } - if let Some(ref t) = self.end_list_tag { - writeln!(f, "{}", t)?; + if let Some(value) = &self.end_list_tag { + writeln!(f, "{}", value)?; } Ok(()) } diff --git a/src/media_segment.rs b/src/media_segment.rs index 45520b5..f157ad2 100644 --- a/src/media_segment.rs +++ b/src/media_segment.rs @@ -50,23 +50,23 @@ impl MediaSegmentBuilder { impl fmt::Display for MediaSegment { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - for t in &self.key_tags { - writeln!(f, "{}", t)?; + for value in &self.key_tags { + writeln!(f, "{}", value)?; } - if let Some(ref t) = self.map_tag { - writeln!(f, "{}", t)?; + if let Some(value) = &self.map_tag { + writeln!(f, "{}", value)?; } - if let Some(ref t) = self.byte_range_tag { - writeln!(f, "{}", t)?; + if let Some(value) = &self.byte_range_tag { + writeln!(f, "{}", value)?; } - if let Some(ref t) = self.date_range_tag { - writeln!(f, "{}", t)?; + if let Some(value) = &self.date_range_tag { + writeln!(f, "{}", value)?; } - if let Some(ref t) = self.discontinuity_tag { - writeln!(f, "{}", t)?; + if let Some(value) = &self.discontinuity_tag { + writeln!(f, "{}", value)?; } - if let Some(ref t) = self.program_date_time_tag { - writeln!(f, "{}", t)?; + if let Some(value) = &self.program_date_time_tag { + writeln!(f, "{}", value)?; } writeln!(f, "{},", self.inf_tag)?; writeln!(f, "{}", self.uri)?; diff --git a/src/tags/master_playlist/i_frame_stream_inf.rs b/src/tags/master_playlist/i_frame_stream_inf.rs index 93e5425..50e75bd 100644 --- a/src/tags/master_playlist/i_frame_stream_inf.rs +++ b/src/tags/master_playlist/i_frame_stream_inf.rs @@ -61,20 +61,20 @@ impl fmt::Display for ExtXIFrameStreamInf { write!(f, "URI={}", quote(&self.uri))?; write!(f, ",BANDWIDTH={}", self.bandwidth)?; - if let Some(ref x) = self.average_bandwidth { - write!(f, ",AVERAGE-BANDWIDTH={}", x)?; + if let Some(value) = &self.average_bandwidth { + write!(f, ",AVERAGE-BANDWIDTH={}", value)?; } - if let Some(ref x) = self.codecs { - write!(f, ",CODECS={}", quote(x))?; + if let Some(value) = &self.codecs { + write!(f, ",CODECS={}", quote(value))?; } - if let Some(ref x) = self.resolution { - write!(f, ",RESOLUTION={}", x)?; + if let Some(value) = &self.resolution { + write!(f, ",RESOLUTION={}", value)?; } - if let Some(ref x) = self.hdcp_level { - write!(f, ",HDCP-LEVEL={}", x)?; + if let Some(value) = &self.hdcp_level { + write!(f, ",HDCP-LEVEL={}", value)?; } - if let Some(ref x) = self.video { - write!(f, ",VIDEO={}", quote(x))?; + if let Some(value) = &self.video { + write!(f, ",VIDEO={}", quote(value))?; } Ok(()) } diff --git a/src/tags/master_playlist/media.rs b/src/tags/master_playlist/media.rs index f63f1f3..819f62b 100644 --- a/src/tags/master_playlist/media.rs +++ b/src/tags/master_playlist/media.rs @@ -291,15 +291,15 @@ impl fmt::Display for ExtXMedia { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", Self::PREFIX)?; write!(f, "TYPE={}", self.media_type)?; - if let Some(ref x) = self.uri { - write!(f, ",URI={}", quote(x))?; + if let Some(value) = &self.uri { + write!(f, ",URI={}", quote(value))?; } write!(f, ",GROUP-ID={}", quote(&self.group_id))?; - if let Some(ref x) = self.language { - write!(f, ",LANGUAGE={}", quote(x))?; + if let Some(value) = &self.language { + write!(f, ",LANGUAGE={}", quote(value))?; } - if let Some(ref x) = self.assoc_language { - write!(f, ",ASSOC-LANGUAGE={}", quote(x))?; + if let Some(value) = &self.assoc_language { + write!(f, ",ASSOC-LANGUAGE={}", quote(value))?; } write!(f, ",NAME={}", quote(&self.name))?; if self.default { @@ -311,14 +311,14 @@ impl fmt::Display for ExtXMedia { if self.forced { write!(f, ",FORCED=YES")?; } - if let Some(ref x) = self.instream_id { - write!(f, ",INSTREAM-ID={}", quote(x))?; + if let Some(value) = &self.instream_id { + write!(f, ",INSTREAM-ID={}", quote(value))?; } - if let Some(ref x) = self.characteristics { - write!(f, ",CHARACTERISTICS={}", quote(x))?; + if let Some(value) = &self.characteristics { + write!(f, ",CHARACTERISTICS={}", quote(value))?; } - if let Some(ref x) = self.channels { - write!(f, ",CHANNELS={}", quote(x))?; + if let Some(value) = &self.channels { + write!(f, ",CHANNELS={}", quote(value))?; } Ok(()) } diff --git a/src/tags/master_playlist/session_data.rs b/src/tags/master_playlist/session_data.rs index 12d138d..183318a 100644 --- a/src/tags/master_playlist/session_data.rs +++ b/src/tags/master_playlist/session_data.rs @@ -55,12 +55,12 @@ impl fmt::Display for ExtXSessionData { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", Self::PREFIX)?; write!(f, "DATA-ID={}", quote(&self.data_id))?; - match self.data { - SessionData::Value(ref x) => write!(f, ",VALUE={}", quote(x))?, - SessionData::Uri(ref x) => write!(f, ",URI={}", quote(x))?, + match &self.data { + SessionData::Value(value) => write!(f, ",VALUE={}", quote(value))?, + SessionData::Uri(value) => write!(f, ",URI={}", quote(value))?, } - if let Some(ref x) = self.language { - write!(f, ",LANGUAGE={}", quote(x))?; + if let Some(value) = &self.language { + write!(f, ",LANGUAGE={}", quote(value))?; } Ok(()) } diff --git a/src/tags/master_playlist/stream_inf.rs b/src/tags/master_playlist/stream_inf.rs index 671179d..296fba0 100644 --- a/src/tags/master_playlist/stream_inf.rs +++ b/src/tags/master_playlist/stream_inf.rs @@ -112,32 +112,32 @@ impl fmt::Display for ExtXStreamInf { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", Self::PREFIX)?; write!(f, "BANDWIDTH={}", self.bandwidth)?; - if let Some(ref x) = self.average_bandwidth { - write!(f, ",AVERAGE-BANDWIDTH={}", x)?; + if let Some(value) = &self.average_bandwidth { + write!(f, ",AVERAGE-BANDWIDTH={}", value)?; } - if let Some(ref x) = self.resolution { - write!(f, ",RESOLUTION={}", x)?; + if let Some(value) = &self.resolution { + write!(f, ",RESOLUTION={}", value)?; } - if let Some(ref x) = self.codecs { - write!(f, ",CODECS={}", quote(x))?; + if let Some(value) = &self.codecs { + write!(f, ",CODECS={}", quote(value))?; } - if let Some(ref x) = self.frame_rate { - write!(f, ",FRAME-RATE={:.3}", x.as_f64())?; + if let Some(value) = &self.frame_rate { + write!(f, ",FRAME-RATE={:.3}", value.as_f64())?; } - if let Some(ref x) = self.hdcp_level { - write!(f, ",HDCP-LEVEL={}", x)?; + if let Some(value) = &self.hdcp_level { + write!(f, ",HDCP-LEVEL={}", value)?; } - if let Some(ref x) = self.audio { - write!(f, ",AUDIO={}", quote(x))?; + if let Some(value) = &self.audio { + write!(f, ",AUDIO={}", quote(value))?; } - if let Some(ref x) = self.video { - write!(f, ",VIDEO={}", quote(x))?; + if let Some(value) = &self.video { + write!(f, ",VIDEO={}", quote(value))?; } - if let Some(ref x) = self.subtitles { - write!(f, ",SUBTITLES={}", quote(x))?; + if let Some(value) = &self.subtitles { + write!(f, ",SUBTITLES={}", quote(value))?; } - if let Some(ref x) = self.closed_captions { - write!(f, ",CLOSED-CAPTIONS={}", x)?; + if let Some(value) = &self.closed_captions { + write!(f, ",CLOSED-CAPTIONS={}", value)?; } write!(f, "\n{}", self.uri)?; Ok(()) diff --git a/src/tags/media_segment/date_range.rs b/src/tags/media_segment/date_range.rs index 841b513..138002c 100644 --- a/src/tags/media_segment/date_range.rs +++ b/src/tags/media_segment/date_range.rs @@ -42,12 +42,12 @@ impl fmt::Display for ExtXDateRange { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", Self::PREFIX)?; write!(f, "ID={}", quote(&self.id))?; - if let Some(ref x) = self.class { - write!(f, ",CLASS={}", quote(x))?; + if let Some(value) = &self.class { + write!(f, ",CLASS={}", quote(value))?; } write!(f, ",START-DATE={}", quote(&self.start_date))?; - if let Some(ref x) = self.end_date { - write!(f, ",END-DATE={}", quote(x))?; + if let Some(value) = &self.end_date { + write!(f, ",END-DATE={}", quote(value))?; } if let Some(x) = self.duration { write!(f, ",DURATION={}", DecimalFloatingPoint::from_duration(x))?; @@ -59,14 +59,14 @@ impl fmt::Display for ExtXDateRange { DecimalFloatingPoint::from_duration(x) )?; } - if let Some(ref x) = self.scte35_cmd { - write!(f, ",SCTE35-CMD={}", quote(x))?; + if let Some(value) = &self.scte35_cmd { + write!(f, ",SCTE35-CMD={}", quote(value))?; } - if let Some(ref x) = self.scte35_out { - write!(f, ",SCTE35-OUT={}", quote(x))?; + if let Some(value) = &self.scte35_out { + write!(f, ",SCTE35-OUT={}", quote(value))?; } - if let Some(ref x) = self.scte35_in { - write!(f, ",SCTE35-IN={}", quote(x))?; + if let Some(value) = &self.scte35_in { + write!(f, ",SCTE35-IN={}", quote(value))?; } if self.end_on_next { write!(f, ",END-ON-NEXT=YES",)?; diff --git a/src/tags/media_segment/inf.rs b/src/tags/media_segment/inf.rs index ddf305c..f90a654 100644 --- a/src/tags/media_segment/inf.rs +++ b/src/tags/media_segment/inf.rs @@ -62,8 +62,8 @@ impl fmt::Display for ExtInf { + (f64::from(self.duration.subsec_nanos()) / 1_000_000_000.0); write!(f, "{}", duration)?; - if let Some(ref title) = self.title { - write!(f, ",{}", title)?; + if let Some(value) = &self.title { + write!(f, ",{}", value)?; } Ok(()) } diff --git a/src/tags/media_segment/key.rs b/src/tags/media_segment/key.rs index 8e59522..cb7844e 100644 --- a/src/tags/media_segment/key.rs +++ b/src/tags/media_segment/key.rs @@ -43,8 +43,8 @@ impl ExtXKey { impl fmt::Display for ExtXKey { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", Self::PREFIX)?; - if let Some(ref key) = self.0 { - write!(f, "{}", key)?; + if let Some(value) = &self.0 { + write!(f, "{}", value)?; } else { write!(f, "METHOD=NONE")?; } diff --git a/src/tags/media_segment/map.rs b/src/tags/media_segment/map.rs index 97ca7fc..df6659c 100644 --- a/src/tags/media_segment/map.rs +++ b/src/tags/media_segment/map.rs @@ -54,8 +54,8 @@ impl fmt::Display for ExtXMap { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", Self::PREFIX)?; write!(f, "URI={}", quote(&self.uri))?; - if let Some(ref x) = self.range { - write!(f, ",BYTERANGE={}", quote(x))?; + if let Some(value) = &self.range { + write!(f, ",BYTERANGE={}", quote(value))?; } Ok(()) } diff --git a/src/types/closed_captions.rs b/src/types/closed_captions.rs index 7f51d9f..a391703 100644 --- a/src/types/closed_captions.rs +++ b/src/types/closed_captions.rs @@ -17,8 +17,8 @@ pub enum ClosedCaptions { impl fmt::Display for ClosedCaptions { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match *self { - ClosedCaptions::GroupId(ref x) => write!(f, "{}", quote(x)), + match &self { + ClosedCaptions::GroupId(value) => write!(f, "{}", quote(value)), ClosedCaptions::None => "NONE".fmt(f), } } diff --git a/src/types/decryption_key.rs b/src/types/decryption_key.rs index 014a61f..571a588 100644 --- a/src/types/decryption_key.rs +++ b/src/types/decryption_key.rs @@ -37,14 +37,14 @@ impl fmt::Display for DecryptionKey { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "METHOD={}", self.method)?; write!(f, ",URI={}", quote(&self.uri))?; - if let Some(ref x) = self.iv { - write!(f, ",IV={}", x)?; + if let Some(value) = &self.iv { + write!(f, ",IV={}", value)?; } - if let Some(ref x) = self.key_format { - write!(f, ",KEYFORMAT={}", quote(x))?; + if let Some(value) = &self.key_format { + write!(f, ",KEYFORMAT={}", quote(value))?; } - if let Some(ref x) = self.key_format_versions { - write!(f, ",KEYFORMATVERSIONS={}", quote(x))?; + if let Some(value) = &self.key_format_versions { + write!(f, ",KEYFORMATVERSIONS={}", quote(value))?; } Ok(()) } diff --git a/src/types/encryption_method.rs b/src/types/encryption_method.rs index 379e251..8754ba1 100644 --- a/src/types/encryption_method.rs +++ b/src/types/encryption_method.rs @@ -17,7 +17,7 @@ pub enum EncryptionMethod { impl fmt::Display for EncryptionMethod { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match *self { + match &self { EncryptionMethod::Aes128 => "AES-128".fmt(f), EncryptionMethod::SampleAes => "SAMPLE-AES".fmt(f), } diff --git a/src/types/hdcp_level.rs b/src/types/hdcp_level.rs index fc67f9e..741959c 100644 --- a/src/types/hdcp_level.rs +++ b/src/types/hdcp_level.rs @@ -17,7 +17,7 @@ pub enum HdcpLevel { impl fmt::Display for HdcpLevel { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match *self { + match &self { HdcpLevel::Type0 => "TYPE-0".fmt(f), HdcpLevel::None => "NONE".fmt(f), } diff --git a/src/types/media_type.rs b/src/types/media_type.rs index f47b7d3..323dd43 100644 --- a/src/types/media_type.rs +++ b/src/types/media_type.rs @@ -19,7 +19,7 @@ pub enum MediaType { impl fmt::Display for MediaType { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match *self { + match &self { MediaType::Audio => "AUDIO".fmt(f), MediaType::Video => "VIDEO".fmt(f), MediaType::Subtitles => "SUBTITLES".fmt(f),