diff --git a/src/commands/controlling_playback/pause.rs b/src/commands/controlling_playback/pause.rs index 8170117..3203afc 100644 --- a/src/commands/controlling_playback/pause.rs +++ b/src/commands/controlling_playback/pause.rs @@ -10,12 +10,16 @@ impl Command for Pause { const COMMAND: &'static str = "pause"; fn parse_request(mut parts: std::str::SplitWhitespace<'_>) -> RequestParserResult<'_> { - match parts.next() { + let result = match parts.next() { Some("0") => Ok((Request::Pause(Some(false)), "")), Some("1") => Ok((Request::Pause(Some(true)), "")), Some(s) => Err(RequestParserError::SyntaxError(0, s.to_string())), None => Ok((Request::Pause(None), "")), - } + }; + + debug_assert!(parts.next().is_none()); + + result } fn parse_response( diff --git a/src/commands/controlling_playback/seek.rs b/src/commands/controlling_playback/seek.rs index 742a396..e0a4bf1 100644 --- a/src/commands/controlling_playback/seek.rs +++ b/src/commands/controlling_playback/seek.rs @@ -27,6 +27,8 @@ impl Command for Seek { None => return Err(RequestParserError::UnexpectedEOF), }; + debug_assert!(parts.next().is_none()); + Ok((Request::Seek(songpos, time), "")) } diff --git a/src/commands/controlling_playback/seekcur.rs b/src/commands/controlling_playback/seekcur.rs index 99597e2..8116073 100644 --- a/src/commands/controlling_playback/seekcur.rs +++ b/src/commands/controlling_playback/seekcur.rs @@ -40,6 +40,8 @@ impl Command for SeekCur { ), }; + debug_assert!(parts.next().is_none()); + Ok((Request::SeekCur(mode, time), "")) } diff --git a/src/commands/controlling_playback/seekid.rs b/src/commands/controlling_playback/seekid.rs index ef45dbf..8cee87b 100644 --- a/src/commands/controlling_playback/seekid.rs +++ b/src/commands/controlling_playback/seekid.rs @@ -27,6 +27,8 @@ impl Command for SeekId { None => return Err(RequestParserError::UnexpectedEOF), }; + debug_assert!(parts.next().is_none()); + Ok((Request::SeekId(songid, time), "")) } diff --git a/src/commands/music_database/listall.rs b/src/commands/music_database/listall.rs index ad60971..ae02ef6 100644 --- a/src/commands/music_database/listall.rs +++ b/src/commands/music_database/listall.rs @@ -21,6 +21,8 @@ impl Command for ListAll { }) .transpose()?; + debug_assert!(parts.next().is_none()); + Ok((Request::ListAll(uri), "")) } diff --git a/src/commands/music_database/listallinfo.rs b/src/commands/music_database/listallinfo.rs index 6bac8ca..d4344d6 100644 --- a/src/commands/music_database/listallinfo.rs +++ b/src/commands/music_database/listallinfo.rs @@ -22,6 +22,8 @@ impl Command for ListAllInfo { }) .transpose()?; + debug_assert!(parts.next().is_none()); + Ok((Request::ListAllInfo(uri), "")) } diff --git a/src/commands/music_database/listfiles.rs b/src/commands/music_database/listfiles.rs index fdf8d9d..1e61486 100644 --- a/src/commands/music_database/listfiles.rs +++ b/src/commands/music_database/listfiles.rs @@ -21,6 +21,8 @@ impl Command for ListFiles { }) .transpose()?; + debug_assert!(parts.next().is_none()); + Ok((Request::ListFiles(uri), "")) } diff --git a/src/commands/music_database/lsinfo.rs b/src/commands/music_database/lsinfo.rs index 58c6658..dfa2945 100644 --- a/src/commands/music_database/lsinfo.rs +++ b/src/commands/music_database/lsinfo.rs @@ -21,6 +21,8 @@ impl Command for LsInfo { }) .transpose()?; + debug_assert!(parts.next().is_none()); + Ok((Request::LsInfo(uri), "")) } diff --git a/src/commands/querying_mpd_status/idle.rs b/src/commands/querying_mpd_status/idle.rs index ce8fef6..a939837 100644 --- a/src/commands/querying_mpd_status/idle.rs +++ b/src/commands/querying_mpd_status/idle.rs @@ -13,7 +13,7 @@ impl Command for Idle { const COMMAND: &'static str = "idle"; fn parse_request(mut parts: SplitWhitespace<'_>) -> RequestParserResult<'_> { - parts + let result = parts .next() .map_or(Ok((Request::Idle(None), "")), |subsystems| { let subsystems = subsystems @@ -21,7 +21,11 @@ impl Command for Idle { .map(|subsystem| SubSystem::from_str(subsystem).unwrap()) .collect(); Ok((Request::Idle(Some(subsystems)), "")) - }) + }); + + debug_assert!(parts.next().is_none()); + + result } fn parse_response( diff --git a/src/commands/querying_mpd_status/status.rs b/src/commands/querying_mpd_status/status.rs index ecfa342..768bf4a 100644 --- a/src/commands/querying_mpd_status/status.rs +++ b/src/commands/querying_mpd_status/status.rs @@ -162,7 +162,9 @@ impl Command for Status { type Response = StatusResponse; const COMMAND: &'static str = "status"; - fn parse_request(_parts: std::str::SplitWhitespace<'_>) -> RequestParserResult<'_> { + fn parse_request(mut parts: std::str::SplitWhitespace<'_>) -> RequestParserResult<'_> { + debug_assert!(parts.next().is_none()); + Ok((Request::Status, "")) }