Skip to content

Commit

Permalink
Rename bencode::Error::ExtraData -> TrailingData
Browse files Browse the repository at this point in the history
type: reform
  • Loading branch information
casey committed Apr 8, 2020
1 parent 7de1c04 commit 7420c91
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/bencode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ impl<'buffer> Display for Value<'buffer> {

#[derive(Debug, PartialEq)]
pub(crate) enum Error {
ExtraData { start: usize },
TrailingData { start: usize },
UnexpectedEndOfBuffer,
UnexpectedByte { found: u8 },
UnsortedKey,
Expand All @@ -127,7 +127,7 @@ impl<'buffer> Parser<'buffer> {
let root = self.value()?;

if self.index != self.buffer.len() {
return Err(ExtraData { start: self.index });
return Err(TrailingData { start: self.index });
}

Ok(root)
Expand Down Expand Up @@ -334,10 +334,10 @@ mod tests {
#[test]
fn misc() {
err("", UnexpectedEndOfBuffer);
err("i20efoo", ExtraData { start: 4 });
err("defoo", ExtraData { start: 2 });
err("lefoo", ExtraData { start: 2 });
err("1:afoo", ExtraData { start: 3 });
err("i20efoo", TrailingData { start: 4 });
err("defoo", TrailingData { start: 2 });
err("lefoo", TrailingData { start: 2 });
err("1:afoo", TrailingData { start: 3 });
}

#[test]
Expand Down

0 comments on commit 7420c91

Please sign in to comment.