Skip to content

Commit

Permalink
style: Use FlagSet::default instead of FlagSet::empty
Browse files Browse the repository at this point in the history
  • Loading branch information
the-mikedavis committed Nov 1, 2024
1 parent 9fc1500 commit f9fe0b2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/aff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1286,7 +1286,7 @@ mod test {
}
macro_rules! flagset {
() => {{
FlagSet::empty()
FlagSet::default()
}};
( $( $x:expr ),* ) => {
{
Expand Down
10 changes: 5 additions & 5 deletions src/aff/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1273,7 +1273,7 @@ pub(crate) fn parse_dic_line(
else {
// A fast-lane for words without flagsets.
let word = ignore_chars(input, ignore);
return Ok((word, FlagSet::empty()));
return Ok((word, FlagSet::default()));
};

// Note: ignore '/' at the start of the line. Not sure why this is correct but it's in the
Expand All @@ -1294,7 +1294,7 @@ pub(crate) fn parse_dic_line(
// Fastlane to treat '\t' as the EOL.
if byte == b'\t' {
let word = ignore_chars(&input[..idx], ignore);
return Ok((word, FlagSet::empty()));
return Ok((word, FlagSet::default()));
}

// Worst-case scenario the word contains a space or uses backslash to escape the separator
Expand Down Expand Up @@ -1326,7 +1326,7 @@ pub(crate) fn parse_dic_line(
'\t' => {
// Treat tabs as the end-of-line.
let word = ignore_chars(&word, ignore);
return Ok((word, FlagSet::empty()));
return Ok((word, FlagSet::default()));
}
' ' => {
// Detect and ignore morphological fields. Scan ahead three characters into the
Expand All @@ -1349,7 +1349,7 @@ pub(crate) fn parse_dic_line(

if separates_morphological_field {
let word = ignore_chars(&word, ignore);
return Ok((word, FlagSet::empty()));
return Ok((word, FlagSet::default()));
} else {
word.push(ch);
}
Expand Down Expand Up @@ -1808,7 +1808,7 @@ mod test {
}
macro_rules! flagset {
() => {{
FlagSet::empty()
FlagSet::default()
}};
( $( $x:expr ),* ) => {
{
Expand Down
6 changes: 1 addition & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,6 @@ impl From<Vec<Flag>> for FlagSet {
}

impl FlagSet {
pub fn empty() -> Self {
Self::default()
}

#[inline]
pub fn as_slice(&self) -> &[Flag] {
&self.0
Expand Down Expand Up @@ -542,7 +538,7 @@ mod test {
}
macro_rules! flagset {
() => {{
FlagSet::empty()
FlagSet::default()
}};
( $( $x:expr ),* ) => {
{
Expand Down

0 comments on commit f9fe0b2

Please sign in to comment.