clippy: fix unused_trait_names lint

https://rust-lang.github.io/rust-clippy/master/index.html#unused_trait_names

Closes #12450
This commit is contained in:
xtqqczze
2026-02-14 16:03:31 +00:00
committed by Johannes Altmanninger
parent e76370b3b7
commit 4eac5f4d9d
67 changed files with 107 additions and 103 deletions

View File

@@ -217,6 +217,7 @@ semicolon_if_nothing_returned = "warn"
stable_sort_primitive = "warn"
str_to_string = "warn"
unnecessary_semicolon = "warn"
unused_trait_names = "warn"
# We do not want to use the e?print(ln)?! macros.
# These lints flag their use.

View File

@@ -1,4 +1,4 @@
use std::{borrow::Cow, env, os::unix::ffi::OsStrExt, path::Path};
use std::{borrow::Cow, env, os::unix::ffi::OsStrExt as _, path::Path};
pub fn env_var(name: &str) -> Option<String> {
let err = match env::var(name) {

View File

@@ -5,7 +5,7 @@
use std::io::Read;
use std::ops::{Deref, DerefMut};
use std::os::fd::{AsRawFd, BorrowedFd, RawFd};
use std::os::unix::ffi::OsStrExt;
use std::os::unix::ffi::OsStrExt as _;
use std::sync::OnceLock;
use std::sync::atomic::{AtomicI32, AtomicU32, Ordering};
use std::{env, mem, time};

View File

@@ -1,7 +1,7 @@
extern crate proc_macro;
use fish_tempfile::random_filename;
use proc_macro::TokenStream;
use std::{ffi::OsString, io::Write, path::PathBuf};
use std::{ffi::OsString, io::Write as _, path::PathBuf};
fn unescape_multiline_rust_string(s: String) -> String {
if !s.contains('\n') {

View File

@@ -22,7 +22,7 @@ fn embed_localizations(cache_dir: &Path) {
use fish_gettext_mo_file_parser::parse_mo_file;
use std::{
fs::File,
io::{BufWriter, Write},
io::{BufWriter, Write as _},
};
let po_dir = fish_build_helper::workspace_root()

View File

@@ -51,7 +51,7 @@ macro_rules! sprintf {
{
// May be no args!
#[allow(unused_imports)]
use $crate::ToArg;
use $crate::ToArg as _;
$crate::printf_c_locale(
$target,
$fmt,

View File

@@ -6,8 +6,8 @@
use std::fmt::{self, Write};
use std::mem;
use std::result::Result;
use unicode_segmentation::UnicodeSegmentation;
use unicode_width::UnicodeWidthStr;
use unicode_segmentation::UnicodeSegmentation as _;
use unicode_width::UnicodeWidthStr as _;
#[cfg(feature = "widestring")]
use widestring::Utf32Str as wstr;

View File

@@ -1,6 +1,6 @@
use crate::arg::ToArg;
use crate::locale::{C_LOCALE, EN_US_LOCALE, Locale};
use crate::{Error, FormatString, sprintf_locale};
use crate::{Error, FormatString as _, sprintf_locale};
use std::f64::consts::{E, PI, TAU};
use std::ffi::CStr;
use std::fmt;
@@ -13,7 +13,7 @@ macro_rules! sprintf_check {
$(,)? // optional trailing comma
) => {
{
use unicode_width::UnicodeWidthStr;
use unicode_width::UnicodeWidthStr as _;
let mut target = String::new();
let mut args = [$($arg.to_arg()),*];
let len = $crate::printf_c_locale(

View File

@@ -5,7 +5,7 @@
path::PathBuf,
};
use rand::distr::{Alphanumeric, Distribution};
use rand::distr::{Alphanumeric, Distribution as _};
pub struct TempFile {
file: File,
@@ -114,7 +114,7 @@ pub fn new_dir() -> std::io::Result<TempDir> {
mod tests {
use std::{
fs::File,
io::{Read, Seek, Write},
io::{Read as _, Seek as _, Write as _},
};
#[test]

View File

@@ -1,7 +1,7 @@
//! Generic utilities library.
use fish_widestring::prelude::*;
use rand::{SeedableRng, rngs::SmallRng};
use rand::{SeedableRng as _, rngs::SmallRng};
use std::cmp::Ordering;
use std::time;

View File

@@ -1,7 +1,7 @@
use clap::{Parser, Subcommand};
use fish_build_helper::as_os_strs;
use std::{path::PathBuf, process::Command};
use xtask::{CommandExt, cargo};
use xtask::{CommandExt as _, cargo};
#[derive(Parser)]
#[command(

View File

@@ -7,7 +7,7 @@
use crate::io::IoChain;
use crate::parser::Parser;
use crate::wutil::{FileId, INVALID_FILE_ID, file_id_for_path};
use fish_widestring::{L, WExt, WString, wstr};
use fish_widestring::{L, WExt as _, WString, wstr};
use lru::LruCache;
use rust_embed::RustEmbed;
use std::collections::{HashMap, HashSet};
@@ -477,7 +477,7 @@ macro_rules! run {
fn touch_file(path: &wstr) {
use nix::sys::stat::Mode;
use std::io::Write;
use std::io::Write as _;
let mut file = wopen_cloexec(
path,

View File

@@ -33,7 +33,7 @@
env::{
EnvMode, Statuses,
config_paths::ConfigPaths,
environment::{EnvStack, Environment, env_init},
environment::{EnvStack, Environment as _, env_init},
},
eprintf,
event::{self, Event},

View File

@@ -2,7 +2,7 @@
use super::prelude::*;
use crate::{
env::{EnvMode, Environment},
env::{EnvMode, Environment as _},
fds::{BEST_O_SEARCH, wopen_dir},
parser::ParserEnvSetMode,
path::path_apply_cdpath,

View File

@@ -1,6 +1,6 @@
use super::prelude::*;
use super::read::TokenOutputMode;
use crate::ast::{self, Kind, Leaf};
use crate::ast::{self, Kind, Leaf as _};
use crate::common::{UnescapeFlags, UnescapeStringStyle, unescape_string};
use crate::complete::Completion;
use crate::expand::{ExpandFlags, ExpandResultCode, expand_string};

View File

@@ -2,21 +2,23 @@
use std::ffi::OsStr;
use std::fs;
use std::io::{Read, Write};
use std::os::unix::ffi::OsStrExt;
use std::io::{Read, Write as _};
use std::os::unix::ffi::OsStrExt as _;
use crate::locale::set_libc_locales;
use crate::panic::panic_handler;
use super::prelude::*;
use crate::ast::{self, AsNode, Ast, Kind, Leaf, Node, NodeVisitor, SourceRangeList, Traversal};
use crate::ast::{
self, AsNode as _, Ast, Kind, Leaf as _, Node, NodeVisitor, SourceRangeList, Traversal,
};
use crate::common::{
PROGRAM_NAME, ReadExt, UnescapeFlags, UnescapeStringStyle, bytes2wcstring, get_program_name,
osstr2wcstring, unescape_string, wcs2bytes,
PROGRAM_NAME, ReadExt as _, UnescapeFlags, UnescapeStringStyle, bytes2wcstring,
get_program_name, osstr2wcstring, unescape_string, wcs2bytes,
};
use crate::env::EnvStack;
use crate::env::env_init;
use crate::env::environment::Environment;
use crate::env::environment::Environment as _;
use crate::expand::INTERNAL_SEPARATOR;
use crate::future_feature_flags;
use crate::global_safety::RelaxedAtomicBool;

View File

@@ -14,11 +14,11 @@
use crate::{
builtins::shared::BUILTIN_ERR_UNKNOWN,
common::{PROGRAM_NAME, get_program_name, osstr2wcstring, shell_modes},
env::{EnvStack, Environment, env_init},
env::{EnvStack, Environment as _, env_init},
future_feature_flags,
input_common::{
CharEvent, ImplicitEvent, InputEventQueue, InputEventQueuer, KeyEvent, QueryResultEvent,
match_key_event_to_key,
CharEvent, ImplicitEvent, InputEventQueue, InputEventQueuer as _, KeyEvent,
QueryResultEvent, match_key_event_to_key,
},
key::{Key, char_to_symbol},
nix::isatty,

View File

@@ -2,7 +2,7 @@
use crate::ast::BlockStatement;
use crate::common::{valid_func_name, valid_var_name};
use crate::complete::complete_add_wrapper;
use crate::env::environment::Environment;
use crate::env::environment::Environment as _;
use crate::env::is_read_only;
use crate::event::{self, EventDescription, EventHandler};
use crate::function;

View File

@@ -9,7 +9,7 @@
use crate::proc::{HAVE_PROC_STAT, Job, clock_ticks_to_seconds, proc_get_jiffies};
use crate::wutil::fish_wcstoi;
use fish_wgetopt::{ArgType, WGetopter, WOption, wopt};
use fish_widestring::{L, WExt, WString, wstr};
use fish_widestring::{L, WExt as _, WString, wstr};
use std::num::NonZeroU32;
/// Print modes for the jobs builtin.

View File

@@ -1,6 +1,6 @@
use crate::env::environment::Environment;
use crate::env::environment::Environment as _;
use std::fs::Metadata;
use std::os::unix::prelude::{FileTypeExt, MetadataExt};
use std::os::unix::prelude::{FileTypeExt as _, MetadataExt as _};
use std::time::SystemTime;
use super::prelude::*;

View File

@@ -56,7 +56,7 @@
wcstoi::{Options as WcstoiOpts, wcstoi_partial},
wstr_offset_in,
};
use fish_printf::{ToArg, sprintf_locale};
use fish_printf::{ToArg as _, sprintf_locale};
use fish_widestring::{decode_byte_from_char, encode_byte_to_char};
/// Return true if `c` is an octal digit.

View File

@@ -2,7 +2,7 @@
use errno::errno;
use super::prelude::*;
use crate::{env::Environment, wutil::wrealpath};
use crate::{env::Environment as _, wutil::wrealpath};
// The pwd builtin. Respect -P to resolve symbolic links. Respect -L to not do that (the default).
const short_options: &wstr = L!("LPh");

View File

@@ -3,7 +3,7 @@
use crate::wutil;
use fish_util::get_seeded_rng;
use rand::rngs::SmallRng;
use rand::{Rng, RngCore};
use rand::{Rng as _, RngCore as _};
use std::sync::{LazyLock, Mutex};
static RNG: LazyLock<Mutex<SmallRng>> =

View File

@@ -8,7 +8,7 @@
use crate::common::unescape_string;
use crate::common::valid_var_name;
use crate::env::EnvMode;
use crate::env::Environment;
use crate::env::Environment as _;
use crate::env::READ_BYTE_LIMIT;
use crate::env::{EnvVar, EnvVarFlags};
use crate::input_common::DecodeState;

View File

@@ -3,7 +3,7 @@
use errno::errno;
use super::prelude::*;
use crate::env::Environment;
use crate::env::Environment as _;
use crate::{
path::path_apply_working_directory,
wutil::{normalize_path, wrealpath},

View File

@@ -10,7 +10,7 @@
use errno::errno;
use fish_common::assert_sorted_by_name;
use fish_widestring::L;
use std::io::{BufRead, BufReader, Read};
use std::io::{BufRead as _, BufReader, Read as _};
pub type BuiltinCmd = fn(&Parser, &mut IoStreams, &mut [&wstr]) -> BuiltinResult;

View File

@@ -1,4 +1,4 @@
use std::os::fd::AsRawFd;
use std::os::fd::AsRawFd as _;
use crate::{
common::{FilenameRef, escape},

View File

@@ -1,5 +1,5 @@
use super::string;
use crate::builtins::shared::BuiltinResultExt;
use crate::builtins::shared::BuiltinResultExt as _;
use crate::io::IoChain;
use crate::io::{IoStreams, OutputStream, StringOutputStream};
use crate::prelude::*;

View File

@@ -1394,7 +1394,7 @@ mod tests {
};
use fish_util::get_seeded_rng;
use fish_widestring::{ENCODE_DIRECT_BASE, L, WString, wstr};
use rand::{Rng, RngCore};
use rand::{Rng as _, RngCore as _};
use std::fmt::Write as _;
#[test]

View File

@@ -53,7 +53,7 @@
string_prefixes_string_case_insensitive, string_suffixes_string_case_insensitive,
strip_executable_suffix,
};
use fish_widestring::WExt;
use fish_widestring::WExt as _;
// Completion description strings, mostly for different types of files, such as sockets, block
// devices, etc.
@@ -2634,7 +2634,7 @@ mod tests {
};
use crate::abbrs::{self, Abbreviation, with_abbrs_mut};
use crate::common::str2wcstring;
use crate::env::{EnvMode, EnvSetMode, Environment};
use crate::env::{EnvMode, EnvSetMode, Environment as _};
use crate::io::IoChain;
use crate::operation_context::{
EXPANSION_LIMIT_BACKGROUND, EXPANSION_LIMIT_DEFAULT, OperationContext, no_cancel,

View File

@@ -2,7 +2,7 @@
use crate::{flog, flogf};
use fish_build_helper::workspace_root;
use std::ffi::OsStr;
use std::os::unix::ffi::OsStrExt;
use std::os::unix::ffi::OsStrExt as _;
use std::path::{Path, PathBuf};
use std::sync::OnceLock;

View File

@@ -30,7 +30,7 @@
use fish_wcstringutil::join_strings;
use libc::c_int;
use nix::{
NixPath,
NixPath as _,
unistd::{Uid, User, gethostname},
};
use std::collections::HashMap;
@@ -798,7 +798,7 @@ pub fn env_init(paths: Option<&ConfigPaths>, do_uvars: bool, default_paths: bool
#[cfg(test)]
mod tests {
use super::{EnvMode, EnvStack, Environment};
use super::{EnvMode, EnvStack, Environment as _};
use crate::env::EnvSetMode;
use crate::prelude::*;
use crate::tests::prelude::*;

2
src/env/var.rs vendored
View File

@@ -320,7 +320,7 @@ pub fn is_read_only(name: &wstr) -> bool {
mod tests {
use super::{EnvMode, EnvVar, EnvVarFlags};
use crate::env::EnvSetMode;
use crate::env::environment::{EnvStack, Environment};
use crate::env::environment::{EnvStack, Environment as _};
use crate::prelude::*;
use crate::tests::prelude::*;
use assert_matches::assert_matches;

View File

@@ -1,7 +1,7 @@
use crate::common::init_special_chars_once;
use crate::complete::complete_invalidate_path;
use crate::env::{DEFAULT_READ_BYTE_LIMIT, READ_BYTE_LIMIT};
use crate::env::{EnvMode, EnvStack, Environment, setenv_lock, unsetenv_lock};
use crate::env::{EnvMode, EnvStack, Environment as _, setenv_lock, unsetenv_lock};
use crate::flog::flog;
use crate::function;
use crate::input_common::{update_wait_on_escape_ms, update_wait_on_sequence_key_ms};

View File

@@ -13,7 +13,7 @@
use std::collections::hash_map::Entry;
use std::ffi::CString;
use std::fs::File;
use std::io::{Read, Write};
use std::io::{Read as _, Write as _};
use std::mem::MaybeUninit;
/// Callback data, reflecting a change in universal variables.

View File

@@ -11,7 +11,7 @@
ScopeGuard, bytes2wcstring, exit_without_destructors, truncate_at_nul, wcs2bytes, wcs2zstring,
write_loop,
};
use crate::env::{EnvMode, EnvSetMode, EnvStack, Environment, READ_BYTE_LIMIT, Statuses};
use crate::env::{EnvMode, EnvSetMode, EnvStack, Environment as _, READ_BYTE_LIMIT, Statuses};
#[cfg(have_posix_spawn)]
use crate::env_dispatch::use_posix_spawn;
use crate::fds::{
@@ -47,7 +47,7 @@
use crate::tty_handoff::TtyHandoff;
use crate::wutil::{fish_wcstol, perror};
use errno::{errno, set_errno};
use fish_widestring::ToWString;
use fish_widestring::ToWString as _;
use libc::{
EACCES, ENOENT, ENOEXEC, ENOTDIR, EPIPE, EXIT_FAILURE, EXIT_SUCCESS, STDERR_FILENO,
STDIN_FILENO, STDOUT_FILENO,
@@ -56,10 +56,10 @@
use nix::sys::stat;
use nix::unistd::getpgrp;
use std::ffi::CStr;
use std::io::{Read, Write};
use std::io::{Read as _, Write as _};
use std::mem::MaybeUninit;
use std::num::NonZeroU32;
use std::os::fd::{AsRawFd, FromRawFd, OwnedFd, RawFd};
use std::os::fd::{AsRawFd as _, FromRawFd as _, OwnedFd, RawFd};
use std::slice;
use std::sync::{
Arc, OnceLock,

View File

@@ -466,8 +466,8 @@ fn drop(&mut self) {
mod tests {
use crate::portable_atomic::AtomicU64;
use std::fs::File;
use std::io::Write;
use std::os::fd::{AsRawFd, OwnedFd};
use std::io::Write as _;
use std::os::fd::{AsRawFd as _, OwnedFd};
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::{Arc, Barrier, Mutex};
use std::thread;

View File

@@ -320,7 +320,7 @@ mod tests {
use super::{BorrowedFdFile, FIRST_HIGH_FD, make_autoclose_pipes};
use crate::tests::prelude::*;
use libc::{F_GETFD, FD_CLOEXEC};
use std::os::fd::{AsRawFd, FromRawFd};
use std::os::fd::{AsRawFd as _, FromRawFd as _};
#[test]
#[serial]

View File

@@ -222,7 +222,7 @@ macro_rules! flog {
($category:ident, $($elem:expr),+ $(,)*) => {
if $crate::flog::categories::$category.enabled.load(std::sync::atomic::Ordering::Relaxed) {
#[allow(unused_imports)]
use $crate::{flog::{FloggableDisplay, FloggableDebug}};
use $crate::{flog::{FloggableDisplay as _, FloggableDebug as _}};
let mut output: Vec<u8> = Vec::new();
output.extend($crate::flog::categories::$category.name.to_flog_str());
output.push(b':');

View File

@@ -10,7 +10,7 @@
use libc::{O_RDONLY, pid_t};
use std::ffi::CStr;
use std::num::NonZeroU32;
use std::os::unix::fs::MetadataExt;
use std::os::unix::fs::MetadataExt as _;
use std::time::Duration;
/// The number of times to try to call fork() before giving up.
@@ -533,7 +533,7 @@ fn get_interpreter<'a>(command: &CStr, buffer: &'a mut [u8]) -> Option<&'a CStr>
mod tests {
use super::get_interpreter;
use std::ffi::CString;
use std::os::unix::ffi::OsStrExt;
use std::os::unix::ffi::OsStrExt as _;
#[test]
fn test_get_interpreter_returns_none_on_embedded_nul() {

View File

@@ -15,8 +15,8 @@
ffi::OsString,
fs::{File, OpenOptions},
os::{
fd::AsRawFd,
unix::{ffi::OsStringExt, fs::MetadataExt},
fd::AsRawFd as _,
unix::{ffi::OsStringExt as _, fs::MetadataExt as _},
},
path::PathBuf,
};

View File

@@ -2,7 +2,7 @@
// autoloading functions in the $fish_function_path. Actual function evaluation is taken care of by
// the parser and to some degree the builtin handling library.
use crate::ast::{self, Node};
use crate::ast::{self, Node as _};
use crate::autoload::{Autoload, AutoloadResult};
use crate::common::{FilenameRef, assert_sync, escape, valid_func_name};
use crate::complete::complete_wrap_map;

View File

@@ -19,7 +19,7 @@
use fish_wcstringutil::{
string_prefixes_string, string_prefixes_string_case_insensitive, string_suffixes_string,
};
use fish_widestring::{L, WExt, WString, wstr};
use fish_widestring::{L, WExt as _, WString, wstr};
use libc::PATH_MAX;
use nix::unistd::AccessFlags;
use std::collections::{HashMap, HashSet};
@@ -435,7 +435,7 @@ mod tests {
use crate::redirection::RedirectionMode;
use std::fs::{self, File, Permissions, create_dir_all};
use std::os::unix::fs::PermissionsExt;
use std::os::unix::fs::PermissionsExt as _;
use std::path::PathBuf;
struct TempDirWithCtx {

View File

@@ -30,7 +30,7 @@
use fish_color::Color;
use fish_common::{ASCII_MAX, EXPAND_RESERVED_BASE, EXPAND_RESERVED_END};
use fish_wcstringutil::string_prefixes_string;
use fish_widestring::{L, WExt, WString, wstr};
use fish_widestring::{L, WExt as _, WString, wstr};
use std::collections::HashMap;
use std::collections::hash_map::Entry;
@@ -1308,7 +1308,7 @@ pub struct HighlightSpec {
mod tests {
use super::{HighlightColorResolver, HighlightRole, HighlightSpec, highlight_shell};
use crate::common::ScopeGuard;
use crate::env::{EnvMode, EnvSetMode, Environment};
use crate::env::{EnvMode, EnvSetMode, Environment as _};
use crate::future_feature_flags::{self, FeatureFlag};
use crate::highlight::parse_text_face_for_highlight;
use crate::operation_context::{EXPANSION_LIMIT_BACKGROUND, OperationContext};

View File

@@ -2,9 +2,9 @@
use std::{
fs::File,
io::Read,
io::Read as _,
ops::{Deref, DerefMut},
os::fd::AsRawFd,
os::fd::AsRawFd as _,
time::{SystemTime, UNIX_EPOCH},
};

View File

@@ -30,7 +30,7 @@
collections::{BTreeMap, HashMap, HashSet},
ffi::{CStr, CString},
fs::File,
io::{BufRead, BufWriter, Read, Write},
io::{BufRead, BufWriter, Read as _, Write as _},
mem::MaybeUninit,
num::NonZeroUsize,
ops::ControlFlow,
@@ -41,10 +41,10 @@
use bitflags::bitflags;
use lru::LruCache;
use nix::{fcntl::OFlag, sys::stat::Mode};
use rand::Rng;
use rand::Rng as _;
use crate::{
ast::{self, Kind, Node},
ast::{self, Kind, Node as _},
common::{CancelChecker, UnescapeStringStyle, bytes2wcstring, unescape_string, valid_var_name},
env::{EnvMode, EnvStack, Environment},
expand::{ExpandFlags, expand_one},
@@ -1812,7 +1812,7 @@ mod tests {
use crate::prelude::*;
use fish_build_helper::workspace_root;
use fish_wcstringutil::{string_prefixes_string, string_prefixes_string_case_insensitive};
use rand::Rng;
use rand::Rng as _;
use rand::rngs::ThreadRng;
use std::collections::VecDeque;
use std::ffi::OsString;

View File

@@ -2,7 +2,7 @@
WSL, bytes2wcstring, fish_reserved_codepoint, is_windows_subsystem_for_linux, read_blocked,
shell_modes,
};
use crate::env::{EnvStack, Environment};
use crate::env::{EnvStack, Environment as _};
use crate::fd_readable_set::{FdReadableSet, Timeout};
use crate::flog::{FloggableDebug, FloggableDisplay, flog};
use crate::future_feature_flags::{FeatureFlag, test as feature_test};
@@ -1777,7 +1777,7 @@ fn parse_hex_into(out: &mut [u8], hex: &[u8]) -> Option<()> {
#[cfg(test)]
mod tests {
use super::{
CharEvent, InputEventQueue, InputEventQueuer, KeyEvent, KeyMatchQuality, ReadlineCmd,
CharEvent, InputEventQueue, InputEventQueuer as _, KeyEvent, KeyMatchQuality, ReadlineCmd,
match_key_event_to_key, parse_hex,
};
use crate::key::{Key, Modifiers};

View File

@@ -19,7 +19,7 @@
use nix::sys::stat::Mode;
use std::fs::File;
use std::io;
use std::os::fd::{AsFd, AsRawFd, BorrowedFd, OwnedFd, RawFd};
use std::os::fd::{AsFd as _, AsRawFd as _, BorrowedFd, OwnedFd, RawFd};
use std::sync::{Arc, LazyLock, Mutex, MutexGuard};
/// separated_buffer_t represents a buffer of output from commands, prepared to be turned into a

View File

@@ -1,7 +1,7 @@
use super::{localizable_consts, localizable_string, wgettext, wgettext_fmt};
use crate::env::{EnvStack, Environment};
use crate::env::{EnvStack, Environment as _};
use fish_widestring::{L, WString, wstr};
use itertools::Itertools;
use itertools::Itertools as _;
use std::collections::{HashMap, HashSet};
use std::sync::{LazyLock, Mutex};

View File

@@ -15,7 +15,7 @@
use crate::screen::{CharOffset, Line, ScreenData, wcswidth_rendered, wcwidth_rendered};
use crate::termsize::Termsize;
use fish_wcstringutil::string_fuzzy_match_string;
use unicode_width::UnicodeWidthStr;
use unicode_width::UnicodeWidthStr as _;
/// Represents rendering from the pager.
#[derive(Default)]

View File

@@ -1,7 +1,8 @@
//! Provides the "linkage" between an ast and actual execution structures (job_t, etc.).
use crate::ast::{
self, BlockStatementHeader, Keyword, Leaf, Node, Statement, Token, unescape_keyword,
self, BlockStatementHeader, Keyword as _, Leaf as _, Node, Statement, Token as _,
unescape_keyword,
};
use crate::builtins;
use crate::builtins::shared::{
@@ -13,7 +14,7 @@
ScopeGuard, ScopeGuarding, ScopedRefCell, escape, truncate_at_nul, valid_var_name,
};
use crate::complete::CompletionList;
use crate::env::{EnvMode, EnvStackSetResult, EnvVar, EnvVarFlags, Environment, Statuses};
use crate::env::{EnvMode, EnvStackSetResult, EnvVar, EnvVarFlags, Environment as _, Statuses};
use crate::event::{self, Event};
use crate::exec::exec_job;
use crate::expand::{
@@ -52,7 +53,7 @@
use crate::trace::{trace_if_enabled, trace_if_enabled_with_args};
use crate::wildcard::wildcard_match;
use fish_common::help_section;
use fish_widestring::WExt;
use fish_widestring::WExt as _;
use libc::{ENOTDIR, EXIT_SUCCESS, STDERR_FILENO, STDOUT_FILENO, c_int};
use std::io::ErrorKind;
use std::rc::Rc;

View File

@@ -1,6 +1,7 @@
//! Various mostly unrelated utility functions related to parsing, loading and evaluating fish code.
use crate::ast::{
self, Ast, Keyword, Kind, Leaf, Node, NodeVisitor, Token, Traversal, is_same_node,
self, Ast, Keyword as _, Kind, Leaf as _, Node, NodeVisitor, Token as _, Traversal,
is_same_node,
};
use crate::builtins::shared::builtin_exists;
use crate::common::{

View File

@@ -36,12 +36,12 @@
use crate::{flog, flogf, function};
use assert_matches::assert_matches;
use fish_util::get_time;
use fish_widestring::WExt;
use fish_widestring::WExt as _;
use libc::c_int;
use std::cell::{Ref, RefCell, RefMut};
use std::ffi::OsStr;
use std::fs::File;
use std::io::Write;
use std::io::Write as _;
use std::num::NonZeroU32;
use std::os::fd::OwnedFd;
use std::rc::Rc;

View File

@@ -619,7 +619,7 @@ fn make_base_directory(xdg_var: &wstr, non_xdg_homepath: &wstr) -> BaseDirectory
// Like std::fs::create_dir_all, but new directories are created using the given mode (e.g. 0o700).
fn create_dir_all_with_mode<P: AsRef<std::path::Path>>(path: P, mode: u32) -> std::io::Result<()> {
use std::os::unix::fs::DirBuilderExt;
use std::os::unix::fs::DirBuilderExt as _;
std::fs::DirBuilder::new()
.recursive(true)
.mode(mode)

View File

@@ -36,7 +36,7 @@
};
use std::cell::{Cell, Ref, RefCell, RefMut};
use std::fs;
use std::io::{Read, Write};
use std::io::{Read as _, Write as _};
use std::num::NonZeroU32;
use std::os::fd::RawFd;
use std::rc::Rc;

View File

@@ -59,7 +59,7 @@
use crate::input_common::BackgroundColorQuery;
use crate::input_common::CursorPositionQueryReason;
use crate::input_common::InputEventQueue;
use crate::input_common::InputEventQueuer;
use crate::input_common::InputEventQueuer as _;
use crate::input_common::QueryResponse;
use crate::input_common::{
CharEvent, CharInputStyle, CursorPositionQuery, ImplicitEvent, InputData, LONG_READ_TIMEOUT,
@@ -146,7 +146,7 @@
io::BufReader,
num::NonZeroUsize,
ops::{ControlFlow, Range},
os::fd::{AsRawFd, BorrowedFd, FromRawFd, OwnedFd, RawFd},
os::fd::{AsRawFd as _, BorrowedFd, FromRawFd as _, OwnedFd, RawFd},
pin::Pin,
sync::{
Arc, LazyLock, Mutex, MutexGuard, OnceLock,

View File

@@ -12,7 +12,7 @@
use crate::pager::{PAGER_MIN_HEIGHT, PageRendering, Pager};
use std::cell::RefCell;
use std::collections::LinkedList;
use std::io::Write;
use std::io::Write as _;
use std::num::NonZeroU16;
use std::ops::Range;
use std::sync::Mutex;

View File

@@ -3,7 +3,7 @@
#[cfg(test)]
mod tests {
use std::fs::File;
use std::os::fd::AsRawFd;
use std::os::fd::AsRawFd as _;
#[test]
fn test_fd_cloexec() {

View File

@@ -10,7 +10,7 @@
use std::cell::{RefCell, RefMut};
use std::ops::{Deref, DerefMut};
use std::os::fd::RawFd;
use std::os::unix::ffi::OsStrExt;
use std::os::unix::ffi::OsStrExt as _;
use std::sync::OnceLock;
use std::sync::atomic::{AtomicU8, Ordering};

View File

@@ -262,7 +262,7 @@ pub fn safe_termsize_invalidate_tty() {
#[cfg(test)]
mod tests {
use crate::env::{EnvMode, EnvSetMode, Environment};
use crate::env::{EnvMode, EnvSetMode, Environment as _};
use crate::termsize::*;
use crate::tests::prelude::*;
use std::sync::Mutex;

View File

@@ -14,8 +14,8 @@
//! but it's still the best we can do because we don't know how long of a time might elapse between
//! `TimerSnapshot` instances and need to avoid rollover.
use std::fmt::Write as FmtWrite;
use std::io::Write;
use std::fmt::Write as _;
use std::io::Write as _;
use std::time::{Duration, Instant};
use crate::nix::{RUsage, getrusage};

View File

@@ -28,7 +28,7 @@
use nix::errno::Errno;
use nix::unistd;
use std::cell::Cell;
use std::os::fd::AsRawFd;
use std::os::fd::AsRawFd as _;
use std::sync::atomic::{AtomicU8, Ordering};
use std::sync::{Condvar, Mutex, MutexGuard};
#[cfg(target_os = "linux")]

View File

@@ -18,7 +18,6 @@
};
use crate::threads::assert_is_main_thread;
use crate::wutil::{perror, wcstoi};
use fish_widestring::ToWString;
use libc::{EINVAL, ENOTTY, EPERM, STDIN_FILENO, WNOHANG};
use nix::sys::termios::tcgetattr;
use nix::unistd::getpgrp;

View File

@@ -5,7 +5,7 @@
use crate::wutil::{wbasename, wdirname};
use nix::sys::inotify::{AddWatchFlags, InitFlags, Inotify};
use std::ffi::OsString;
use std::os::fd::{AsFd, AsRawFd, RawFd};
use std::os::fd::{AsFd as _, AsRawFd as _, RawFd};
/// A notifier based on inotify.
pub struct InotifyNotifier {

View File

@@ -19,7 +19,7 @@ pub fn test_notifiers(notifiers: &[&dyn UniversalNotifier], fish_variables_path:
let modify_path = |path: &wstr| -> Result<(), std::io::Error> {
use crate::common::wcs2osstring;
use std::fs;
use std::io::Write;
use std::io::Write as _;
let path = wcs2osstring(path);
let mut new_path = std::path::PathBuf::from(path.clone());
new_path.set_extension("new");

View File

@@ -6,7 +6,7 @@
use std::cell::LazyCell;
use std::cmp::Ordering;
use std::collections::HashSet;
use std::os::unix::fs::MetadataExt;
use std::os::unix::fs::MetadataExt as _;
use crate::common::{
UnescapeFlags, UnescapeStringStyle, WSL, is_windows_subsystem_for_linux, unescape_string,

View File

@@ -14,11 +14,11 @@
use crate::flog;
use errno::errno;
use fish_wcstringutil::{join_strings, str2bytes_callback};
use fish_widestring::{IntoCharIter, L, WExt, WString, wstr};
use fish_widestring::{IntoCharIter, L, WExt as _, WString, wstr};
use nix::unistd::AccessFlags;
use std::ffi::{CStr, OsStr};
use std::fs::{self, canonicalize};
use std::io::{self, Write};
use std::io::{self, Write as _};
use std::os::unix::prelude::*;
pub use crate::wutil::printf::{eprintf, fprintf, printf, sprintf};
@@ -463,11 +463,11 @@ mod tests {
use crate::common::bytes2wcstring;
use crate::prelude::*;
use crate::tests::prelude::*;
use rand::Rng;
use rand::Rng as _;
use std::{
fs::OpenOptions,
io::{Read, Seek},
os::{fd::AsRawFd, unix::fs::OpenOptionsExt},
io::{Read as _, Seek as _},
os::{fd::AsRawFd as _, unix::fs::OpenOptionsExt as _},
};
mod test_path_normalize_for_cd {