From e4295aeeeffdd728dd8552cdfab99dea483152b9 Mon Sep 17 00:00:00 2001 From: Dym03 Date: Sat, 25 Oct 2025 16:56:54 +0200 Subject: [PATCH] Default of MatchOptions match new method --- src/lib.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index fcfdf8c..696be9c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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 @@ -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, @@ -1106,6 +1102,12 @@ impl MatchOptions { } } +impl Default for MatchOptions { + fn default() -> Self { + MatchOptions::new() + } +} + #[cfg(test)] mod test { use super::{glob, MatchOptions, Pattern};