mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-15 01:17:45 +00:00
Run cargo fmt
with Rustfmt 1.6.0
- "1.6.0" now supports formatting let-else statements which we use liberally, and appears to have some fixes in regards to long-indented-lines with macros like `wgettext_ft!` - This commit updates the formatting so that devs with the latest stable don't see random format-fixes upon running `cargo fmt`
This commit is contained in:
parent
0aa21440d1
commit
05c44df1a4
8 changed files with 36 additions and 13 deletions
|
@ -21,7 +21,9 @@ pub fn emit(
|
|||
}
|
||||
|
||||
let Some(event_name) = argv.get(opts.optind) else {
|
||||
streams.err.append(&sprintf!("%ls: expected event name\n"L, cmd));
|
||||
streams
|
||||
.err
|
||||
.append(&sprintf!("%ls: expected event name\n"L, cmd));
|
||||
return STATUS_INVALID_ARGS;
|
||||
};
|
||||
|
||||
|
|
|
@ -107,7 +107,11 @@ fn parse_cmd_opts(
|
|||
}
|
||||
's' => {
|
||||
let Some(signal) = Signal::parse(w.woptarg.unwrap()) else {
|
||||
streams.err.append(wgettext_fmt!("%ls: Unknown signal '%ls'", cmd, w.woptarg.unwrap()));
|
||||
streams.err.append(wgettext_fmt!(
|
||||
"%ls: Unknown signal '%ls'",
|
||||
cmd,
|
||||
w.woptarg.unwrap()
|
||||
));
|
||||
return STATUS_INVALID_ARGS;
|
||||
};
|
||||
opts.events.push(EventDescription::Signal { signal });
|
||||
|
|
|
@ -257,7 +257,11 @@ fn parse_cmd_opts(
|
|||
return STATUS_CMD_ERROR;
|
||||
}
|
||||
let Ok(job_mode) = w.woptarg.unwrap().try_into() else {
|
||||
streams.err.append(wgettext_fmt!("%ls: Invalid job control mode '%ls'\n", cmd, w.woptarg.unwrap()));
|
||||
streams.err.append(wgettext_fmt!(
|
||||
"%ls: Invalid job control mode '%ls'\n",
|
||||
cmd,
|
||||
w.woptarg.unwrap()
|
||||
));
|
||||
return STATUS_CMD_ERROR;
|
||||
};
|
||||
opts.new_job_control_mode = Some(job_mode);
|
||||
|
@ -398,7 +402,11 @@ pub fn status(
|
|||
return STATUS_INVALID_ARGS;
|
||||
}
|
||||
let Ok(new_mode) = args[0].try_into() else {
|
||||
streams.err.append(wgettext_fmt!("%ls: Invalid job control mode '%ls'\n", cmd, args[0]));
|
||||
streams.err.append(wgettext_fmt!(
|
||||
"%ls: Invalid job control mode '%ls'\n",
|
||||
cmd,
|
||||
args[0]
|
||||
));
|
||||
return STATUS_CMD_ERROR;
|
||||
};
|
||||
new_mode
|
||||
|
|
|
@ -224,7 +224,9 @@ fn path_is_executable(path: &wstr) -> bool {
|
|||
return false;
|
||||
}
|
||||
let narrow: Vec<u8> = narrow.into();
|
||||
let Ok(md) = std::fs::metadata(OsStr::from_bytes(&narrow)) else { return false; };
|
||||
let Ok(md) = std::fs::metadata(OsStr::from_bytes(&narrow)) else {
|
||||
return false;
|
||||
};
|
||||
md.is_file()
|
||||
}
|
||||
|
||||
|
@ -240,7 +242,9 @@ pub fn path_get_paths(cmd: &wstr, vars: &dyn Environment) -> Vec<WString> {
|
|||
return paths;
|
||||
}
|
||||
|
||||
let Some(path_var) = vars.get(L!("PATH")) else { return paths; };
|
||||
let Some(path_var) = vars.get(L!("PATH")) else {
|
||||
return paths;
|
||||
};
|
||||
for path in path_var.as_list() {
|
||||
if path.is_empty() {
|
||||
continue;
|
||||
|
|
|
@ -151,7 +151,8 @@ fn test_escape_no_printables() {
|
|||
&random_string,
|
||||
EscapeStringStyle::Script(EscapeFlags::NO_PRINTABLES | EscapeFlags::NO_QUOTED),
|
||||
);
|
||||
let Some(unescaped_string) = unescape_string(&escaped_string, UnescapeStringStyle::default()) else {
|
||||
let Some(unescaped_string) = unescape_string(&escaped_string, UnescapeStringStyle::default())
|
||||
else {
|
||||
panic!("Failed to unescape string <{escaped_string}>");
|
||||
};
|
||||
|
||||
|
|
|
@ -74,7 +74,9 @@ fn test_to_wstring() {
|
|||
let mut val: i64 = 1;
|
||||
loop {
|
||||
assert_eq!(val.to_wstring(), val.to_string());
|
||||
let Some(next) = val.checked_mul(-3) else { break; };
|
||||
let Some(next) = val.checked_mul(-3) else {
|
||||
break;
|
||||
};
|
||||
val = next;
|
||||
}
|
||||
assert_eq!(u64::MAX.to_wstring(), "18446744073709551615");
|
||||
|
|
|
@ -169,7 +169,9 @@ pub fn wrealpath(pathname: &wstr) -> Option<WString> {
|
|||
canonicalize(".")
|
||||
};
|
||||
|
||||
let Ok(narrow_result) = narrow_res else { return None; };
|
||||
let Ok(narrow_result) = narrow_res else {
|
||||
return None;
|
||||
};
|
||||
|
||||
let pathsep_idx = pathsep_idx.map_or(0, |idx| idx + 1);
|
||||
|
||||
|
|
Loading…
Reference in a new issue