diff --git a/fish-rust/src/common.rs b/fish-rust/src/common.rs index a2f7d0ad0..6c03f45dc 100644 --- a/fish-rust/src/common.rs +++ b/fish-rust/src/common.rs @@ -1,7 +1,7 @@ use crate::ffi; +use crate::wchar_ffi::c_str; use crate::wchar_ffi::{wstr, WCharFromFFI, WString}; -use std::ffi::c_uint; -use std::mem; +use std::{ffi::c_uint, mem}; /// A scoped manager to save the current value of some variable, and optionally set it to a new /// value. When dropped, it restores the variable to its old value. @@ -35,6 +35,7 @@ fn drop(&mut self) { } } +#[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum EscapeStringStyle { Script(EscapeFlags), Url, @@ -89,5 +90,5 @@ pub fn escape_string(s: &wstr, style: EscapeStringStyle) -> WString { EscapeStringStyle::Regex => ffi::escape_string_style_t::STRING_STYLE_REGEX, }; - ffi::escape_string(s.as_ptr(), flags_int.into(), style).from_ffi() + ffi::escape_string(c_str!(s), flags_int.into(), style).from_ffi() }