From fadb2fac44aaa81e023497e3cd54b97da0c194e1 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Wed, 24 Sep 2025 13:11:43 +0200 Subject: [PATCH] Fix some import conventions --- src/bin/fish.rs | 3 ++- src/builtins/fish_indent.rs | 4 ++-- src/builtins/fish_key_reader.rs | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/bin/fish.rs b/src/bin/fish.rs index 59bd6ce22..9fa69b356 100644 --- a/src/bin/fish.rs +++ b/src/bin/fish.rs @@ -64,6 +64,7 @@ wchar::prelude::*, wutil::waccess, }; +use libc::STDIN_FILENO; #[cfg(feature = "embed-data")] use rust_embed::RustEmbed; use std::ffi::{CString, OsStr, OsString}; @@ -371,7 +372,7 @@ fn fish_parse_opt(args: &mut [WString], opts: &mut FishCmdOpts) -> ControlFlow i32 { use crate::io::FdOutputStream; use crate::io::IoChain; use crate::io::OutputStream::Fd; - use libc::{STDERR_FILENO, STDOUT_FILENO}; + use libc::{STDERR_FILENO, STDIN_FILENO, STDOUT_FILENO}; topic_monitor_init(); threads::init(); @@ -895,7 +895,7 @@ fn throwing_main() -> i32 { let mut err = Fd(FdOutputStream::new(STDERR_FILENO)); let io_chain = IoChain::new(); let mut streams = IoStreams::new(&mut out, &mut err, &io_chain); - streams.stdin_fd = libc::STDIN_FILENO; + streams.stdin_fd = STDIN_FILENO; // Using the user's default locale could be a problem if it doesn't use UTF-8 encoding. That's // because the fish project assumes Unicode UTF-8 encoding in all of its scripts. // diff --git a/src/builtins/fish_key_reader.rs b/src/builtins/fish_key_reader.rs index 1c766f440..bedfeeb1d 100644 --- a/src/builtins/fish_key_reader.rs +++ b/src/builtins/fish_key_reader.rs @@ -298,7 +298,7 @@ fn throwing_main() -> i32 { return s.builtin_status_code(); } - if !isatty(libc::STDIN_FILENO) { + if !isatty(STDIN_FILENO) { streams .err .appendln(wgettext!("Stdin must be attached to a tty."));