Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1057,7 +1057,7 @@ fn chars_eq(a: char, b: char, case_sensitive: bool) -> bool {

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

impl Default for MatchOptions {
fn default() -> Self {
MatchOptions::new()
}
}

#[cfg(test)]
mod test {
use super::{glob, MatchOptions, Pattern};
Expand Down