Skip to content

Commit

Permalink
chore: clippy suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
zonyitoo committed Dec 20, 2024
1 parent 6385520 commit f94dc08
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1501,18 +1501,15 @@ impl<'a> Parser<'a> {
// Skip [
self.bump();

let mut s = match self.parse_str_until(&[Some('\r'), Some('\n')], cfg!(feature = "inline-comment")) {
Ok(r) => r,
Err(err) => return Err(err)
};
let mut s = self.parse_str_until(&[Some('\r'), Some('\n')], cfg!(feature = "inline-comment"))?;

// Deal with inline comment
#[cfg(feature = "inline-comment")]
if matches!(self.ch, Some('#') | Some(';')) {
self.parse_comment();
}

let tr = s.trim_end_matches(|c| c == ' ' || c == '\t');
let tr = s.trim_end_matches([' ', '\t']);
if !tr.ends_with(']') {
return self.error("section must be ended with ']'");
}
Expand Down Expand Up @@ -1658,9 +1655,7 @@ impl<'a> Parser<'a> {

#[inline]
fn parse_str_until_eol(&mut self, check_inline_comment: bool) -> Result<String, ParseError> {
let r = self.parse_str_until(&[Some('\n'), Some('\r'), None], check_inline_comment)?;

Ok(r)
self.parse_str_until(&[Some('\n'), Some('\r'), None], check_inline_comment)
}
}

Expand Down

0 comments on commit f94dc08

Please sign in to comment.