Skip to content

Commit e4295ae

Browse files
committed
Default of MatchOptions match new method
1 parent 335da33 commit e4295ae

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/lib.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,7 +1057,7 @@ fn chars_eq(a: char, b: char, case_sensitive: bool) -> bool {
10571057

10581058
/// Configuration options to modify the behaviour of `Pattern::matches_with(..)`.
10591059
#[allow(missing_copy_implementations)]
1060-
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
1060+
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
10611061
pub struct MatchOptions {
10621062
/// Whether or not patterns should be matched in a case-sensitive manner.
10631063
/// This currently only considers upper/lower case relationships between
@@ -1093,11 +1093,7 @@ impl MatchOptions {
10931093
/// }
10941094
/// ```
10951095
///
1096-
/// # Note
1097-
/// The behavior of this method doesn't match `default()`'s. This returns
1098-
/// `case_sensitive` as `true` while `default()` does it as `false`.
1099-
// FIXME: Consider unity the behavior with `default()` in a next major release.
1100-
pub fn new() -> Self {
1096+
pub const fn new() -> Self {
11011097
Self {
11021098
case_sensitive: true,
11031099
require_literal_separator: false,
@@ -1106,6 +1102,12 @@ impl MatchOptions {
11061102
}
11071103
}
11081104

1105+
impl Default for MatchOptions {
1106+
fn default() -> Self {
1107+
MatchOptions::new()
1108+
}
1109+
}
1110+
11091111
#[cfg(test)]
11101112
mod test {
11111113
use super::{glob, MatchOptions, Pattern};

0 commit comments

Comments
 (0)