Fix .cpp to .rs and redundant closure

This commit is contained in:
kerty 2025-01-06 21:34:49 +03:00 committed by Johannes Altmanninger
parent 7c539b9539
commit d06ee1ee9c
6 changed files with 8 additions and 12 deletions

View file

@ -215,7 +215,7 @@ fn builtin_complete_print(cmd: &wstr, streams: &mut IoStreams, parser: &Parser)
const OPT_ESCAPE: char = '\x01'; const OPT_ESCAPE: char = '\x01';
/// The complete builtin. Used for specifying programmable tab-completions. Calls the functions in /// The complete builtin. Used for specifying programmable tab-completions. Calls the functions in
/// complete.cpp for any heavy lifting. /// complete.rs for any heavy lifting.
pub fn complete(parser: &Parser, streams: &mut IoStreams, argv: &mut [&wstr]) -> Option<c_int> { pub fn complete(parser: &Parser, streams: &mut IoStreams, argv: &mut [&wstr]) -> Option<c_int> {
let cmd = argv[0]; let cmd = argv[0];
let argc = argv.len(); let argc = argv.len();

View file

@ -1552,7 +1552,7 @@ pub fn is_windows_subsystem_for_linux(v: WSL) -> bool {
// any allocations or mutexes. We can't rely on all the std functions to be alloc-free in both // any allocations or mutexes. We can't rely on all the std functions to be alloc-free in both
// Debug and Release modes, so we just mandate that the result already be available. // Debug and Release modes, so we just mandate that the result already be available.
// //
// is_wsl() is called by has_working_timestamps() which is called by `screen.cpp` in the main // is_wsl() is called by has_working_tty_timestamps() which is called by `screen.rs` in the main
// process. If that's not good enough, we can call is_wsl() manually at shell startup. // process. If that's not good enough, we can call is_wsl() manually at shell startup.
if crate::threads::is_forked_child() { if crate::threads::is_forked_child() {
debug_assert!( debug_assert!(

View file

@ -634,7 +634,7 @@ fn expand_variables(
} }
// Do a dirty hack to make sliced history fast (#4650). We expand from either a variable, or a // Do a dirty hack to make sliced history fast (#4650). We expand from either a variable, or a
// history_t. Note that "history" is read only in env.cpp so it's safe to special-case it in // history_t. Note that "history" is read only in env.rs so it's safe to special-case it in
// this way (it cannot be shadowed, etc). // this way (it cannot be shadowed, etc).
let mut history = None; let mut history = None;
let mut var = None; let mut var = None;

View file

@ -387,11 +387,8 @@ impl BackgroundFdMonitor {
// //
// Note that WSLv1 doesn't throw EBADF if the fd is closed is mid-select. // Note that WSLv1 doesn't throw EBADF if the fd is closed is mid-select.
drop(data); drop(data);
let ret = fds.check_readable( let ret =
timeout fds.check_readable(timeout.map(Timeout::Duration).unwrap_or(Timeout::Forever));
.map(|d| Timeout::Duration(d))
.unwrap_or(Timeout::Forever),
);
if ret < 0 && !matches!(errno().0, libc::EINTR | libc::EBADF) { if ret < 0 && !matches!(errno().0, libc::EINTR | libc::EBADF) {
// Surprising error // Surprising error
perror("select"); perror("select");

View file

@ -1617,7 +1617,7 @@ pub enum HighlightRole {
selection, selection,
// Pager support. // Pager support.
// NOTE: pager.cpp relies on these being in this order. // NOTE: pager.rs relies on these being in this order.
pager_progress, pager_progress,
pager_background, pager_background,
pager_prefix, pager_prefix,

View file

@ -35,8 +35,7 @@ use crate::flog::FLOGF;
#[allow(unused_imports)] #[allow(unused_imports)]
use crate::future::IsSomeAnd; use crate::future::IsSomeAnd;
use crate::global_safety::RelaxedAtomicBool; use crate::global_safety::RelaxedAtomicBool;
use crate::highlight::HighlightColorResolver; use crate::highlight::{HighlightColorResolver, HighlightSpec};
use crate::highlight::HighlightSpec;
use crate::output::Outputter; use crate::output::Outputter;
use crate::termsize::{termsize_last, Termsize}; use crate::termsize::{termsize_last, Termsize};
use crate::wchar::prelude::*; use crate::wchar::prelude::*;
@ -602,7 +601,7 @@ impl Screen {
let mut abandon_line_string = WString::with_capacity(screen_width + 32); let mut abandon_line_string = WString::with_capacity(screen_width + 32);
// Don't need to check for fish_wcwidth errors; this is done when setting up // Don't need to check for fish_wcwidth errors; this is done when setting up
// omitted_newline_char in common.cpp. // omitted_newline_char in common.rs.
let non_space_width = get_omitted_newline_width(); let non_space_width = get_omitted_newline_width();
let term = term(); let term = term();
let term = term.as_ref(); let term = term.as_ref();