diff --git a/fish-rust/src/builtins/emit.rs b/fish-rust/src/builtins/emit.rs index 83bf55d8c..49869848d 100644 --- a/fish-rust/src/builtins/emit.rs +++ b/fish-rust/src/builtins/emit.rs @@ -5,7 +5,8 @@ use super::shared::{ builtin_print_help, io_streams_t, HelpOnlyCmdOpts, STATUS_CMD_OK, STATUS_INVALID_ARGS, }; use crate::ffi::{self, parser_t, Repin}; -use crate::wchar_ffi::{wstr, W0String, WCharToFFI}; +use crate::wchar::wstr; +use crate::wchar_ffi::{W0String, WCharToFFI}; use crate::wutil::format::printf::sprintf; #[widestrs] diff --git a/fish-rust/src/common.rs b/fish-rust/src/common.rs index e7e9bdae8..e51990cdf 100644 --- a/fish-rust/src/common.rs +++ b/fish-rust/src/common.rs @@ -1,7 +1,8 @@ use crate::ffi; +use crate::wchar::{wstr, WString}; use crate::wchar_ext::WExt; use crate::wchar_ffi::c_str; -use crate::wchar_ffi::{wstr, WCharFromFFI, WString}; +use crate::wchar_ffi::WCharFromFFI; use std::os::fd::AsRawFd; use std::{ffi::c_uint, mem}; diff --git a/fish-rust/src/redirection.rs b/fish-rust/src/redirection.rs index 06644868b..973775eef 100644 --- a/fish-rust/src/redirection.rs +++ b/fish-rust/src/redirection.rs @@ -1,7 +1,8 @@ //! This file supports specifying and applying redirections. -use crate::wchar::L; -use crate::wchar_ffi::{wcharz_t, WCharToFFI, WString}; +use crate::ffi::wcharz_t; +use crate::wchar::{WString, L}; +use crate::wchar_ffi::WCharToFFI; use crate::wutil::fish_wcstoi; use cxx::{CxxVector, CxxWString, SharedPtr, UniquePtr}; use libc::{c_int, O_APPEND, O_CREAT, O_EXCL, O_RDONLY, O_TRUNC, O_WRONLY}; diff --git a/fish-rust/src/signal.rs b/fish-rust/src/signal.rs index 51811fc53..e4ce7440e 100644 --- a/fish-rust/src/signal.rs +++ b/fish-rust/src/signal.rs @@ -1,6 +1,7 @@ use crate::ffi; use crate::topic_monitor::{generation_t, invalid_generations, topic_monitor_principal, topic_t}; -use crate::wchar_ffi::{c_str, wstr}; +use crate::wchar::wstr; +use crate::wchar_ffi::c_str; use widestring::U32CStr; /// A sigint_detector_t can be used to check if a SIGINT (or SIGHUP) has been delivered. diff --git a/fish-rust/src/tokenizer.rs b/fish-rust/src/tokenizer.rs index 72bdaf700..56f5ac72d 100644 --- a/fish-rust/src/tokenizer.rs +++ b/fish-rust/src/tokenizer.rs @@ -5,8 +5,8 @@ use crate::ffi::{valid_var_name_char, wcharz_t}; use crate::future_feature_flags::{feature_test, FeatureFlag}; use crate::parse_constants::SOURCE_OFFSET_INVALID; use crate::redirection::RedirectionMode; -use crate::wchar::{WExt, L}; -use crate::wchar_ffi::{wchar_t, wstr, WCharFromFFI, WCharToFFI, WString}; +use crate::wchar::{wstr, WExt, WString, L}; +use crate::wchar_ffi::{wchar_t, WCharFromFFI, WCharToFFI}; use crate::wutil::wgettext; use cxx::{CxxWString, SharedPtr, UniquePtr}; use libc::{c_int, STDIN_FILENO, STDOUT_FILENO}; diff --git a/fish-rust/src/wchar.rs b/fish-rust/src/wchar.rs index 932890f34..f32a05c94 100644 --- a/fish-rust/src/wchar.rs +++ b/fish-rust/src/wchar.rs @@ -4,10 +4,6 @@ //! - wstr: a string slice without a nul terminator. Like `&str` but wide chars. //! - WString: an owning string without a nul terminator. Like `String` but wide chars. -use crate::ffi; -pub use cxx::CxxWString; -pub use ffi::{wchar_t, wcharz_t}; -pub use widestring::utf32str; pub use widestring::{Utf32Str as wstr, Utf32String as WString}; /// Creates a wstr string slice, like the "L" prefix of C++. diff --git a/fish-rust/src/wchar_ffi.rs b/fish-rust/src/wchar_ffi.rs index a0eb61821..dab6c31f3 100644 --- a/fish-rust/src/wchar_ffi.rs +++ b/fish-rust/src/wchar_ffi.rs @@ -6,13 +6,11 @@ //! - wcharz_t: a "newtyped" pointer to a nul-terminated string, implemented in C++. //! This is useful for FFI boundaries, to work around autocxx limitations on pointers. -use crate::ffi; -pub use cxx::CxxWString; -pub use ffi::{wchar_t, wcharz_t}; +pub use crate::ffi::{wchar_t, wcharz_t}; +use crate::wchar::{wstr, WString}; use once_cell::sync::Lazy; +pub use widestring::u32cstr; pub use widestring::U32CString as W0String; -pub use widestring::{u32cstr, utf32str}; -pub use widestring::{Utf32Str as wstr, Utf32String as WString}; /// \return the length of a nul-terminated raw string. pub fn wcslen(str: *const wchar_t) -> usize { @@ -64,7 +62,7 @@ macro_rules! c_str { /// Convert a wstr to a wcharz_t. macro_rules! wcharz { ($string:expr) => { - crate::wchar::wcharz_t { + crate::wchar_ffi::wcharz_t { str_: crate::wchar_ffi::c_str!($string), } }; diff --git a/fish-rust/src/wgetopt.rs b/fish-rust/src/wgetopt.rs index f2e98405d..8fb88cfce 100644 --- a/fish-rust/src/wgetopt.rs +++ b/fish-rust/src/wgetopt.rs @@ -23,7 +23,7 @@ License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -use crate::wchar::{utf32str, wstr, WExt}; +use crate::wchar::{wstr, WExt, L}; /// Describe how to deal with options that follow non-option ARGV-elements. /// @@ -344,7 +344,7 @@ impl<'opts, 'args, 'argarray> wgetopter_t<'opts, 'args, 'argarray> { let temp = match self.shortopts.chars().position(|sc| sc == c) { Some(pos) => &self.shortopts[pos..], - None => utf32str!(""), + None => L!(""), }; // Increment `woptind' when we start to process its last character. diff --git a/fish-rust/src/wutil/gettext.rs b/fish-rust/src/wutil/gettext.rs index a2929213e..be282224f 100644 --- a/fish-rust/src/wutil/gettext.rs +++ b/fish-rust/src/wutil/gettext.rs @@ -1,6 +1,6 @@ use crate::ffi; -use crate::wchar::{wchar_t, wstr}; -use crate::wchar_ffi::wcslen; +use crate::wchar::wstr; +use crate::wchar_ffi::{wchar_t, wcslen}; /// Support for wgettext.