diff --git a/src/abbrs.rs b/src/abbrs.rs index 08477c0ab..beae2de24 100644 --- a/src/abbrs.rs +++ b/src/abbrs.rs @@ -48,7 +48,7 @@ pub struct Abbreviation { /// If unset, the key is to be interpreted literally. /// Note that the fish interface enforces that regexes match the entire token; /// we accomplish this by surrounding the regex in ^ and $. - pub regex: Option, + pub regex: Option>, /// Replacement string. pub replacement: WString, diff --git a/src/builtins/abbr.rs b/src/builtins/abbr.rs index 2fdf86c1d..0915c7125 100644 --- a/src/builtins/abbr.rs +++ b/src/builtins/abbr.rs @@ -302,7 +302,7 @@ fn abbr_add(opts: &Options, streams: &mut IoStreams) -> Option { } let key: &wstr; - let regex: Option; + let regex: Option>; if let Some(regex_pattern) = &opts.regex_pattern { // Compile the regex as given; if that succeeds then wrap it in our ^$ so it matches the // entire token. @@ -329,9 +329,11 @@ fn abbr_add(opts: &Options, streams: &mut IoStreams) -> Option { return STATUS_INVALID_ARGS; } let anchored = regex_make_anchored(regex_pattern); - let re = builder - .build(to_boxed_chars(&anchored)) - .expect("Anchored compilation should have succeeded"); + let re = Box::new( + builder + .build(to_boxed_chars(&anchored)) + .expect("Anchored compilation should have succeeded"), + ); key = regex_pattern; regex = Some(re);