Skip to content

Commit

Permalink
Simplify Reader::read_v4_or_reg_name
Browse files Browse the repository at this point in the history
  • Loading branch information
yescallop committed Apr 17, 2024
1 parent 3af0b13 commit 25d38d9
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,12 +290,8 @@ impl<'a> Reader<'a> {
}

fn read_v4_or_reg_name(&mut self) -> Result<HostMeta> {
let v4 = self.read_v4();
let v4_end = self.pos;
self.read(REG_NAME)?;

Ok(match v4 {
Some(_addr) if self.pos == v4_end => HostMeta::Ipv4(
Ok(match (self.read_v4(), self.read(REG_NAME)?) {
(Some(_addr), false) => HostMeta::Ipv4(
#[cfg(feature = "net")]
_addr.into(),
),
Expand Down

0 comments on commit 25d38d9

Please sign in to comment.