From d06ee1ee9c9457348a865ef7289ca1d6ff5a1381 Mon Sep 17 00:00:00 2001 From: kerty Date: Mon, 6 Jan 2025 21:34:49 +0300 Subject: [PATCH] Fix .cpp to .rs and redundant closure --- src/builtins/complete.rs | 2 +- src/common.rs | 2 +- src/expand.rs | 2 +- src/fd_monitor.rs | 7 ++----- src/highlight.rs | 2 +- src/screen.rs | 5 ++--- 6 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/builtins/complete.rs b/src/builtins/complete.rs index 4014ec208..12854518d 100644 --- a/src/builtins/complete.rs +++ b/src/builtins/complete.rs @@ -215,7 +215,7 @@ fn builtin_complete_print(cmd: &wstr, streams: &mut IoStreams, parser: &Parser) const OPT_ESCAPE: char = '\x01'; /// 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 { let cmd = argv[0]; let argc = argv.len(); diff --git a/src/common.rs b/src/common.rs index db5691c46..c7769b458 100644 --- a/src/common.rs +++ b/src/common.rs @@ -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 // 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. if crate::threads::is_forked_child() { debug_assert!( diff --git a/src/expand.rs b/src/expand.rs index 99b418b97..03e4f6942 100644 --- a/src/expand.rs +++ b/src/expand.rs @@ -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 - // 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). let mut history = None; let mut var = None; diff --git a/src/fd_monitor.rs b/src/fd_monitor.rs index 85c82f9b1..26151efba 100644 --- a/src/fd_monitor.rs +++ b/src/fd_monitor.rs @@ -387,11 +387,8 @@ impl BackgroundFdMonitor { // // Note that WSLv1 doesn't throw EBADF if the fd is closed is mid-select. drop(data); - let ret = fds.check_readable( - timeout - .map(|d| Timeout::Duration(d)) - .unwrap_or(Timeout::Forever), - ); + let ret = + fds.check_readable(timeout.map(Timeout::Duration).unwrap_or(Timeout::Forever)); if ret < 0 && !matches!(errno().0, libc::EINTR | libc::EBADF) { // Surprising error perror("select"); diff --git a/src/highlight.rs b/src/highlight.rs index 7a439081c..29b466580 100644 --- a/src/highlight.rs +++ b/src/highlight.rs @@ -1617,7 +1617,7 @@ pub enum HighlightRole { selection, // 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_background, pager_prefix, diff --git a/src/screen.rs b/src/screen.rs index f4ff60050..c096f6e71 100644 --- a/src/screen.rs +++ b/src/screen.rs @@ -35,8 +35,7 @@ use crate::flog::FLOGF; #[allow(unused_imports)] use crate::future::IsSomeAnd; use crate::global_safety::RelaxedAtomicBool; -use crate::highlight::HighlightColorResolver; -use crate::highlight::HighlightSpec; +use crate::highlight::{HighlightColorResolver, HighlightSpec}; use crate::output::Outputter; use crate::termsize::{termsize_last, Termsize}; use crate::wchar::prelude::*; @@ -602,7 +601,7 @@ impl Screen { 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 - // omitted_newline_char in common.cpp. + // omitted_newline_char in common.rs. let non_space_width = get_omitted_newline_width(); let term = term(); let term = term.as_ref();