commands: add missing debug asserts
This commit is contained in:
parent
86183e56ad
commit
abacb54c8d
@ -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(
|
||||
|
@ -27,6 +27,8 @@ impl Command for Seek {
|
||||
None => return Err(RequestParserError::UnexpectedEOF),
|
||||
};
|
||||
|
||||
debug_assert!(parts.next().is_none());
|
||||
|
||||
Ok((Request::Seek(songpos, time), ""))
|
||||
}
|
||||
|
||||
|
@ -40,6 +40,8 @@ impl Command for SeekCur {
|
||||
),
|
||||
};
|
||||
|
||||
debug_assert!(parts.next().is_none());
|
||||
|
||||
Ok((Request::SeekCur(mode, time), ""))
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,8 @@ impl Command for SeekId {
|
||||
None => return Err(RequestParserError::UnexpectedEOF),
|
||||
};
|
||||
|
||||
debug_assert!(parts.next().is_none());
|
||||
|
||||
Ok((Request::SeekId(songid, time), ""))
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,8 @@ impl Command for ListAll {
|
||||
})
|
||||
.transpose()?;
|
||||
|
||||
debug_assert!(parts.next().is_none());
|
||||
|
||||
Ok((Request::ListAll(uri), ""))
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,8 @@ impl Command for ListAllInfo {
|
||||
})
|
||||
.transpose()?;
|
||||
|
||||
debug_assert!(parts.next().is_none());
|
||||
|
||||
Ok((Request::ListAllInfo(uri), ""))
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,8 @@ impl Command for ListFiles {
|
||||
})
|
||||
.transpose()?;
|
||||
|
||||
debug_assert!(parts.next().is_none());
|
||||
|
||||
Ok((Request::ListFiles(uri), ""))
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,8 @@ impl Command for LsInfo {
|
||||
})
|
||||
.transpose()?;
|
||||
|
||||
debug_assert!(parts.next().is_none());
|
||||
|
||||
Ok((Request::LsInfo(uri), ""))
|
||||
}
|
||||
|
||||
|
@ -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(
|
||||
|
@ -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, ""))
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user