This commit is contained in:
Astro 2019-09-19 02:18:37 +02:00
parent e126bc0fe1
commit 87de8b7859
2 changed files with 10 additions and 13 deletions

View File

@ -154,8 +154,7 @@ fn report(input: &[u8]) -> IResult<&[u8], Command> {
preceded(
whitespace,
// `report mode <on | off>` - Switch repoting mode
map(off_on,
|reporting| Command::Reporting(reporting))
map(off_on, Command::Reporting)
),
// `report mode` - Show current reporting state
value(Command::Show(ShowCommand::Reporting), end)
@ -235,16 +234,14 @@ fn pid_parameter(input: &[u8]) -> IResult<&[u8], Result<Command, Error>> {
/// `pid` | pid_parameter
fn pid(input: &[u8]) -> IResult<&[u8], Result<Command, Error>> {
preceded(
tag("pid"),
alt((
preceded(
whitespace,
pid_parameter
),
value(Ok(Command::Show(ShowCommand::Pid)), end)
))
)(input)
let (input, _) = tag("pid")(input)?;
alt((
preceded(
whitespace,
pid_parameter
),
value(Ok(Command::Show(ShowCommand::Pid)), end)
))(input)
}
fn command(input: &[u8]) -> IResult<&[u8], Result<Command, Error>> {

View File

@ -138,7 +138,7 @@ fn main() -> ! {
writeln!(stdout, "ADC id: {:04X}", id).unwrap();
break;
}
Ok(id) => {
Ok(_id) => {
// This always happens on the first attempt. So retry silently
}
};