mirror of
https://github.com/rutgersc/m3u8-rs.git
synced 2025-01-05 04:28:41 +00:00
Fix various minor clippy warnings
This commit is contained in:
parent
7e62854e20
commit
3edf5d1c0f
3 changed files with 7 additions and 5 deletions
|
@ -9,7 +9,7 @@ fn main() {
|
||||||
let parsed = m3u8_rs::parse_playlist(&bytes);
|
let parsed = m3u8_rs::parse_playlist(&bytes);
|
||||||
|
|
||||||
let playlist = match parsed {
|
let playlist = match parsed {
|
||||||
Result::Ok((i, playlist)) => playlist,
|
Result::Ok((_i, playlist)) => playlist,
|
||||||
Result::Err(e) => panic!("Parsing error: \n{}", e),
|
Result::Err(e) => panic!("Parsing error: \n{}", e),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ fn main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(unused)]
|
||||||
fn main_alt() {
|
fn main_alt() {
|
||||||
let mut file = std::fs::File::open("playlist.m3u8").unwrap();
|
let mut file = std::fs::File::open("playlist.m3u8").unwrap();
|
||||||
let mut bytes: Vec<u8> = Vec::new();
|
let mut bytes: Vec<u8> = Vec::new();
|
||||||
|
@ -27,8 +28,8 @@ fn main_alt() {
|
||||||
let parsed = m3u8_rs::parse_playlist(&bytes);
|
let parsed = m3u8_rs::parse_playlist(&bytes);
|
||||||
|
|
||||||
match parsed {
|
match parsed {
|
||||||
Result::Ok((i, Playlist::MasterPlaylist(pl))) => println!("Master playlist:\n{:?}", pl),
|
Result::Ok((_i, Playlist::MasterPlaylist(pl))) => println!("Master playlist:\n{:?}", pl),
|
||||||
Result::Ok((i, Playlist::MediaPlaylist(pl))) => println!("Media playlist:\n{:?}", pl),
|
Result::Ok((_i, Playlist::MediaPlaylist(pl))) => println!("Media playlist:\n{:?}", pl),
|
||||||
Result::Err(e) => panic!("Parsing error: \n{}", e),
|
Result::Err(e) => panic!("Parsing error: \n{}", e),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -271,6 +271,7 @@ fn parse_master_playlist_tags(i: &[u8]) -> IResult<&[u8], Vec<MasterPlaylistTag>
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Contains all the tags required to parse a master playlist.
|
/// Contains all the tags required to parse a master playlist.
|
||||||
|
#[allow(clippy::large_enum_variant)]
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
enum MasterPlaylistTag {
|
enum MasterPlaylistTag {
|
||||||
Version(usize),
|
Version(usize),
|
||||||
|
|
|
@ -21,7 +21,7 @@ fn all_sample_m3u_playlists() -> Vec<path::PathBuf> {
|
||||||
|
|
||||||
fn getm3u(path: &str) -> String {
|
fn getm3u(path: &str) -> String {
|
||||||
let mut buf = String::new();
|
let mut buf = String::new();
|
||||||
let mut file = fs::File::open(path).expect(&format!("Can't find m3u8: {}", path));
|
let mut file = fs::File::open(path).unwrap_or_else(|_| panic!("Can't find m3u8: {}", path));
|
||||||
let u = file.read_to_string(&mut buf).expect("Can't read file");
|
let u = file.read_to_string(&mut buf).expect("Can't read file");
|
||||||
buf
|
buf
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ fn playlist_not_ending_in_newline_media() {
|
||||||
fn playlist_type_is_master() {
|
fn playlist_type_is_master() {
|
||||||
let input = get_sample_playlist("master.m3u8");
|
let input = get_sample_playlist("master.m3u8");
|
||||||
let result = is_master_playlist(input.as_bytes());
|
let result = is_master_playlist(input.as_bytes());
|
||||||
assert_eq!(true, result);
|
assert!(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// #[test]
|
// #[test]
|
||||||
|
|
Loading…
Reference in a new issue