mirror of
https://github.com/sile/hls_m3u8.git
synced 2024-11-21 23:01:00 +00:00
Apply clippy-v0.0.186
This commit is contained in:
parent
0210fce925
commit
7b90d6d16e
6 changed files with 11 additions and 9 deletions
|
@ -21,6 +21,7 @@
|
|||
//! assert!(m3u8.parse::<MediaPlaylist>().is_ok());
|
||||
//! ```
|
||||
#![warn(missing_docs)]
|
||||
#![cfg_attr(feature = "cargo-clippy", allow(const_static_lifetime))]
|
||||
extern crate chrono;
|
||||
#[macro_use]
|
||||
extern crate trackable;
|
||||
|
|
|
@ -47,7 +47,7 @@ impl<'a> Lines<'a> {
|
|||
Line::Blank
|
||||
} else if raw_line.starts_with("#EXT") {
|
||||
Line::Tag(track!(raw_line.parse())?)
|
||||
} else if raw_line.starts_with("#") {
|
||||
} else if raw_line.starts_with('#') {
|
||||
Line::Comment(raw_line)
|
||||
} else {
|
||||
let uri = track!(SingleLineString::new(raw_line))?;
|
||||
|
@ -70,6 +70,7 @@ impl<'a> Iterator for Lines<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(large_enum_variant))]
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub enum Line<'a> {
|
||||
Blank,
|
||||
|
@ -78,6 +79,7 @@ pub enum Line<'a> {
|
|||
Uri(SingleLineString),
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(large_enum_variant))]
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum Tag {
|
||||
ExtM3u(tags::ExtM3u),
|
||||
|
|
|
@ -211,8 +211,7 @@ impl MasterPlaylistBuilder {
|
|||
fn check_media_group(&self, media_type: MediaType, group_id: &QuotedString) -> bool {
|
||||
self.media_tags
|
||||
.iter()
|
||||
.find(|t| t.media_type() == media_type && t.group_id() == group_id)
|
||||
.is_some()
|
||||
.any(|t| t.media_type() == media_type && t.group_id() == group_id)
|
||||
}
|
||||
}
|
||||
impl Default for MasterPlaylistBuilder {
|
||||
|
|
|
@ -61,7 +61,7 @@ impl fmt::Display for ExtInf {
|
|||
write!(f, "{}", Self::PREFIX)?;
|
||||
|
||||
let duration = (self.duration.as_secs() as f64)
|
||||
+ (self.duration.subsec_nanos() as f64 / 1_000_000_000.0);
|
||||
+ (f64::from(self.duration.subsec_nanos()) / 1_000_000_000.0);
|
||||
write!(f, "{}", duration)?;
|
||||
|
||||
if let Some(ref title) = self.title {
|
||||
|
@ -205,10 +205,7 @@ impl FromStr for ExtXKey {
|
|||
track_assert!(s.starts_with(Self::PREFIX), ErrorKind::InvalidInput);
|
||||
let suffix = s.split_at(Self::PREFIX.len()).1;
|
||||
|
||||
if AttributePairs::parse(suffix)
|
||||
.find(|a| a.as_ref().ok() == Some(&("METHOD", "NONE")))
|
||||
.is_some()
|
||||
{
|
||||
if AttributePairs::parse(suffix).any(|a| a.as_ref().ok() == Some(&("METHOD", "NONE"))) {
|
||||
for attr in AttributePairs::parse(suffix) {
|
||||
let (key, _) = track!(attr)?;
|
||||
track_assert_ne!(key, "URI", ErrorKind::InvalidInput);
|
||||
|
|
|
@ -43,6 +43,7 @@ mod media_segment;
|
|||
/// [4.3.4. Master Playlist Tags]: https://tools.ietf.org/html/rfc8216#section-4.3.4
|
||||
/// [4.3.5. Media or Master Playlist Tags]: https://tools.ietf.org/html/rfc8216#section-4.3.5
|
||||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(large_enum_variant))]
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum MasterPlaylistTag {
|
||||
ExtXMedia(ExtXMedia),
|
||||
|
@ -92,6 +93,7 @@ impl_from!(MediaPlaylistTag, ExtXStart);
|
|||
///
|
||||
/// [4.3.2. Media Segment Tags]: https://tools.ietf.org/html/rfc8216#section-4.3.2
|
||||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(large_enum_variant))]
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum MediaSegmentTag {
|
||||
ExtInf(ExtInf),
|
||||
|
|
|
@ -161,7 +161,8 @@ impl DecimalFloatingPoint {
|
|||
}
|
||||
|
||||
pub(crate) fn from_duration(duration: Duration) -> Self {
|
||||
let n = (duration.as_secs() as f64) + (duration.subsec_nanos() as f64 / 1_000_000_000.0);
|
||||
let n =
|
||||
(duration.as_secs() as f64) + (f64::from(duration.subsec_nanos()) / 1_000_000_000.0);
|
||||
DecimalFloatingPoint(n)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue