There are a bunch more now that widestrs is gone
This commit is contained in:
Fabian Boehm 2024-01-12 20:31:07 +01:00
parent 09cd7c7ad9
commit fae780d666
7 changed files with 23 additions and 27 deletions

View File

@ -2803,10 +2803,10 @@ impl<'s> NodeVisitorMut for Populator<'s> {
return;
};
/// We believe the node is some sort of block statement. Attempt to find a source range
/// for the block's keyword (for, if, etc) and a user-presentable description. This
/// is used to provide better error messages. Note at this point the parse tree is
/// incomplete; in particular parent nodes are not set.
// We believe the node is some sort of block statement. Attempt to find a source range
// for the block's keyword (for, if, etc) and a user-presentable description. This
// is used to provide better error messages. Note at this point the parse tree is
// incomplete; in particular parent nodes are not set.
let mut cursor = node;
let header = loop {
match cursor.typ() {

View File

@ -150,11 +150,11 @@ pub fn wait(parser: &Parser, streams: &mut IoStreams, argv: &mut [&wstr]) -> Opt
print_help = true;
}
':' => {
builtin_missing_argument(parser, streams, cmd, &argv[w.woptind - 1], print_hints);
builtin_missing_argument(parser, streams, cmd, argv[w.woptind - 1], print_hints);
return STATUS_INVALID_ARGS;
}
'?' => {
builtin_unknown_option(parser, streams, cmd, &argv[w.woptind - 1], print_hints);
builtin_unknown_option(parser, streams, cmd, argv[w.woptind - 1], print_hints);
return STATUS_INVALID_ARGS;
}
_ => {
@ -176,15 +176,16 @@ pub fn wait(parser: &Parser, streams: &mut IoStreams, argv: &mut [&wstr]) -> Opt
// Get the list of wait handles for our waiting.
let mut wait_handles: Vec<WaitHandleRef> = Vec::new();
for i in w.woptind..argc {
if iswnumeric(argv[i]) {
let optind = w.woptind;
for item in &argv[optind..argc] {
if iswnumeric(item) {
// argument is pid
let mpid: Result<pid_t, wutil::Error> = fish_wcstoi(argv[i]);
let mpid: Result<pid_t, wutil::Error> = fish_wcstoi(item);
if mpid.is_err() || mpid.unwrap() <= 0 {
streams.err.append(wgettext_fmt!(
"%ls: '%ls' is not a valid process id\n",
cmd,
argv[i],
item,
));
continue;
}
@ -198,15 +199,11 @@ pub fn wait(parser: &Parser, streams: &mut IoStreams, argv: &mut [&wstr]) -> Opt
}
} else {
// argument is process name
if !find_wait_handles(
WaitHandleQuery::ProcName(argv[i]),
parser,
&mut wait_handles,
) {
if !find_wait_handles(WaitHandleQuery::ProcName(item), parser, &mut wait_handles) {
streams.err.append(wgettext_fmt!(
"%ls: Could not find child processes with the name '%ls'\n",
cmd,
argv[i],
item,
));
}
}

View File

@ -1569,7 +1569,7 @@ pub fn reformat_for_screen(msg: &wstr, termsize: &Termsize) -> WString {
} else {
// Print the token.
let token = &msg[start..pos];
let line_width_unit = (if line_width != 0 { 1 } else { 0 });
let line_width_unit = if line_width != 0 { 1 } else { 0 };
if (line_width + line_width_unit + tok_width) > screen_width {
buff.push('\n');
line_width = 0;

View File

@ -350,7 +350,7 @@ impl EnvScopedImpl {
} else if key == L!("history") {
// Big hack. We only allow getting the history on the main thread. Note that history_t
// may ask for an environment variable, so don't take the lock here (we don't need it).
if (!is_main_thread()) {
if !is_main_thread() {
return None;
}
let history = commandline_get_state().history.unwrap_or_else(|| {
@ -369,8 +369,7 @@ impl EnvScopedImpl {
))
} else if key == L!("pipestatus") {
let js = &self.perproc_data.statuses;
let mut result = Vec::new();
result.reserve(js.pipestatus.len());
let mut result = Vec::with_capacity(js.pipestatus.len());
for i in &js.pipestatus {
result.push(i.to_wstring());
}

View File

@ -154,7 +154,7 @@ impl Features {
self.values[flag as usize].store(value, Ordering::SeqCst)
}
fn set_from_string<'a>(&self, str: &wstr) {
fn set_from_string(&self, str: &wstr) {
let whitespace = L!("\t\n\0x0B\0x0C\r ").as_char_slice();
for entry in str.as_char_slice().split(|c| *c == ',') {
if entry.is_empty() {

View File

@ -76,7 +76,7 @@ pub fn path_emit_config_directory_messages(vars: &EnvStack) {
if !data.success() {
maybe_issue_path_warning(
L!("data"),
&wgettext!("can not save history"),
wgettext!("can not save history"),
data.used_xdg,
L!("XDG_DATA_HOME"),
&data.path,
@ -92,7 +92,7 @@ pub fn path_emit_config_directory_messages(vars: &EnvStack) {
if !config.success() {
maybe_issue_path_warning(
L!("config"),
&wgettext!("can not save universal variables or functions"),
wgettext!("can not save universal variables or functions"),
config.used_xdg,
L!("XDG_CONFIG_HOME"),
&config.path,
@ -705,13 +705,13 @@ fn path_remoteness(path: &wstr) -> DirRemoteness {
fn get_data_directory() -> &'static BaseDirectory {
static DIR: Lazy<BaseDirectory> =
Lazy::new(|| make_base_directory(L!("XDG_DATA_HOME"), L!("/.local/share/fish")));
&*DIR
&DIR
}
fn get_config_directory() -> &'static BaseDirectory {
static DIR: Lazy<BaseDirectory> =
Lazy::new(|| make_base_directory(L!("XDG_CONFIG_HOME"), L!("/.config/fish")));
&*DIR
&DIR
}
/// Appends a path component, with a / if necessary.

View File

@ -1605,10 +1605,10 @@ fn summary_command(j: &Job, p: Option<&Process>) -> WString {
// Arguments are the signal name and description.
let sig = Signal::new(p.status.signal_code());
buffer.push(' ');
buffer += &escape(&sig.name())[..];
buffer += &escape(sig.name())[..];
buffer.push(' ');
buffer += &escape(&sig.desc())[..];
buffer += &escape(sig.desc())[..];
// If we have multiple processes, we also append the pid and argv.
if j.processes().len() > 1 {