diff --git a/build.rs b/build.rs index 3c4da1edbba..c47dcf53a06 100644 --- a/build.rs +++ b/build.rs @@ -7,7 +7,7 @@ use std::env; use std::fs::File; -use std::io::Write; +use std::io::Write as _; use std::path::Path; pub fn main() { diff --git a/fuzz/fuzz_targets/fuzz_cksum.rs b/fuzz/fuzz_targets/fuzz_cksum.rs index be93a96050e..8232fd5147f 100644 --- a/fuzz/fuzz_targets/fuzz_cksum.rs +++ b/fuzz/fuzz_targets/fuzz_cksum.rs @@ -6,11 +6,11 @@ #![no_main] use libfuzzer_sys::fuzz_target; -use rand::Rng; +use rand::Rng as _; use std::env::temp_dir; use std::ffi::OsString; use std::fs::{self, File}; -use std::io::Write; +use std::io::Write as _; use std::process::Command; use uu_cksum::uumain; use uufuzz::{ diff --git a/fuzz/fuzz_targets/fuzz_cut.rs b/fuzz/fuzz_targets/fuzz_cut.rs index 4a5215f8aec..a3bb775bea2 100644 --- a/fuzz/fuzz_targets/fuzz_cut.rs +++ b/fuzz/fuzz_targets/fuzz_cut.rs @@ -8,7 +8,7 @@ use libfuzzer_sys::fuzz_target; use uu_cut::uumain; -use rand::Rng; +use rand::Rng as _; use std::ffi::OsString; use uufuzz::{ diff --git a/fuzz/fuzz_targets/fuzz_dirname.rs b/fuzz/fuzz_targets/fuzz_dirname.rs index bfb127a5a5a..6a02a95183d 100644 --- a/fuzz/fuzz_targets/fuzz_dirname.rs +++ b/fuzz/fuzz_targets/fuzz_dirname.rs @@ -7,8 +7,8 @@ use libfuzzer_sys::fuzz_target; use uu_dirname::uumain; -use rand::Rng; -use rand::prelude::IndexedRandom; +use rand::Rng as _; +use rand::prelude::IndexedRandom as _; use std::ffi::OsString; use uufuzz::CommandResult; diff --git a/fuzz/fuzz_targets/fuzz_echo.rs b/fuzz/fuzz_targets/fuzz_echo.rs index e6b0ba9a6aa..18c3d683255 100644 --- a/fuzz/fuzz_targets/fuzz_echo.rs +++ b/fuzz/fuzz_targets/fuzz_echo.rs @@ -3,7 +3,7 @@ use libfuzzer_sys::fuzz_target; use uu_echo::uumain; use rand::Rng; -use rand::prelude::IndexedRandom; +use rand::prelude::IndexedRandom as _; use std::ffi::OsString; use uufuzz::CommandResult; diff --git a/fuzz/fuzz_targets/fuzz_env.rs b/fuzz/fuzz_targets/fuzz_env.rs index 284089f8378..9f07ea60b39 100644 --- a/fuzz/fuzz_targets/fuzz_env.rs +++ b/fuzz/fuzz_targets/fuzz_env.rs @@ -10,7 +10,7 @@ use uu_env::uumain; use std::ffi::OsString; -use rand::Rng; +use rand::Rng as _; use uufuzz::{ CommandResult, compare_result, generate_and_run_uumain, generate_random_string, run_gnu_cmd, }; diff --git a/fuzz/fuzz_targets/fuzz_expr.rs b/fuzz/fuzz_targets/fuzz_expr.rs index 77ecffabc1b..99527e1d9cf 100644 --- a/fuzz/fuzz_targets/fuzz_expr.rs +++ b/fuzz/fuzz_targets/fuzz_expr.rs @@ -8,8 +8,8 @@ use libfuzzer_sys::fuzz_target; use uu_expr::uumain; -use rand::Rng; -use rand::prelude::IndexedRandom; +use rand::Rng as _; +use rand::prelude::IndexedRandom as _; use std::{env, ffi::OsString}; use uufuzz::CommandResult; diff --git a/fuzz/fuzz_targets/fuzz_non_utf8_paths.rs b/fuzz/fuzz_targets/fuzz_non_utf8_paths.rs index 56451502ba9..f9b4d3e7f4b 100644 --- a/fuzz/fuzz_targets/fuzz_non_utf8_paths.rs +++ b/fuzz/fuzz_targets/fuzz_non_utf8_paths.rs @@ -7,13 +7,13 @@ #![no_main] use libfuzzer_sys::fuzz_target; -use rand::Rng; -use rand::prelude::IndexedRandom; +use rand::Rng as _; +use rand::prelude::IndexedRandom as _; use std::collections::HashSet; use std::env::temp_dir; use std::ffi::{OsStr, OsString}; use std::fs; -use std::os::unix::ffi::{OsStrExt, OsStringExt}; +use std::os::unix::ffi::{OsStrExt as _, OsStringExt as _}; use std::path::{Path, PathBuf}; use uufuzz::{CommandResult, run_gnu_cmd}; @@ -146,7 +146,7 @@ fn setup_test_files() -> Result<(PathBuf, Vec), std::io::Error> { // Try to create the file - this may fail on some filesystems if let Ok(mut file) = fs::File::create(&file_path) { - use std::io::Write; + use std::io::Write as _; let _ = writeln!(file, "test content for file {}", i); test_files.push(file_path); } diff --git a/fuzz/fuzz_targets/fuzz_printf.rs b/fuzz/fuzz_targets/fuzz_printf.rs index 885ebb815bf..46f9405a596 100644 --- a/fuzz/fuzz_targets/fuzz_printf.rs +++ b/fuzz/fuzz_targets/fuzz_printf.rs @@ -9,7 +9,7 @@ use libfuzzer_sys::fuzz_target; use uu_printf::uumain; use rand::Rng; -use rand::seq::IndexedRandom; +use rand::seq::IndexedRandom as _; use std::env; use std::ffi::OsString; diff --git a/fuzz/fuzz_targets/fuzz_seq.rs b/fuzz/fuzz_targets/fuzz_seq.rs index 35721865e8c..51f8130e4cb 100644 --- a/fuzz/fuzz_targets/fuzz_seq.rs +++ b/fuzz/fuzz_targets/fuzz_seq.rs @@ -8,7 +8,7 @@ use libfuzzer_sys::fuzz_target; use uu_seq::uumain; -use rand::Rng; +use rand::Rng as _; use std::ffi::OsString; use uufuzz::CommandResult; diff --git a/fuzz/fuzz_targets/fuzz_seq_parse_number.rs b/fuzz/fuzz_targets/fuzz_seq_parse_number.rs index 04da6d47f99..4fc6ce3de63 100644 --- a/fuzz/fuzz_targets/fuzz_seq_parse_number.rs +++ b/fuzz/fuzz_targets/fuzz_seq_parse_number.rs @@ -5,7 +5,7 @@ #![no_main] use libfuzzer_sys::fuzz_target; -use std::str::FromStr; +use std::str::FromStr as _; use uu_seq::number::PreciseNumber; fuzz_target!(|data: &[u8]| { diff --git a/fuzz/fuzz_targets/fuzz_sort.rs b/fuzz/fuzz_targets/fuzz_sort.rs index 8b38f39ec1b..5e0b34d8278 100644 --- a/fuzz/fuzz_targets/fuzz_sort.rs +++ b/fuzz/fuzz_targets/fuzz_sort.rs @@ -8,7 +8,7 @@ use libfuzzer_sys::fuzz_target; use uu_sort::uumain; -use rand::Rng; +use rand::Rng as _; use std::env; use std::ffi::OsString; diff --git a/fuzz/fuzz_targets/fuzz_split.rs b/fuzz/fuzz_targets/fuzz_split.rs index 473d86f575f..082f3b1c9ad 100644 --- a/fuzz/fuzz_targets/fuzz_split.rs +++ b/fuzz/fuzz_targets/fuzz_split.rs @@ -8,7 +8,7 @@ use libfuzzer_sys::fuzz_target; use uu_split::uumain; -use rand::Rng; +use rand::Rng as _; use std::ffi::OsString; use uufuzz::{ diff --git a/fuzz/fuzz_targets/fuzz_test.rs b/fuzz/fuzz_targets/fuzz_test.rs index 176ab9aba8f..c65672b5ac8 100644 --- a/fuzz/fuzz_targets/fuzz_test.rs +++ b/fuzz/fuzz_targets/fuzz_test.rs @@ -8,8 +8,8 @@ use libfuzzer_sys::fuzz_target; use uu_test::uumain; -use rand::Rng; -use rand::prelude::IndexedRandom; +use rand::Rng as _; +use rand::prelude::IndexedRandom as _; use std::ffi::OsString; use uufuzz::CommandResult; diff --git a/fuzz/fuzz_targets/fuzz_tr.rs b/fuzz/fuzz_targets/fuzz_tr.rs index 5055ec0d748..1dacea4b89e 100644 --- a/fuzz/fuzz_targets/fuzz_tr.rs +++ b/fuzz/fuzz_targets/fuzz_tr.rs @@ -8,7 +8,7 @@ use libfuzzer_sys::fuzz_target; use std::ffi::OsString; use uu_tr::uumain; -use rand::Rng; +use rand::Rng as _; use uufuzz::{ CommandResult, compare_result, generate_and_run_uumain, generate_random_string, run_gnu_cmd, diff --git a/fuzz/fuzz_targets/fuzz_wc.rs b/fuzz/fuzz_targets/fuzz_wc.rs index 148ecdda1fc..51ce4070956 100644 --- a/fuzz/fuzz_targets/fuzz_wc.rs +++ b/fuzz/fuzz_targets/fuzz_wc.rs @@ -8,7 +8,7 @@ use libfuzzer_sys::fuzz_target; use uu_wc::uumain; -use rand::Rng; +use rand::Rng as _; use std::ffi::OsString; use uufuzz::{ diff --git a/fuzz/uufuzz/examples/fuzzing_simulation.rs b/fuzz/uufuzz/examples/fuzzing_simulation.rs index ad7e8316114..788c2265edb 100644 --- a/fuzz/uufuzz/examples/fuzzing_simulation.rs +++ b/fuzz/uufuzz/examples/fuzzing_simulation.rs @@ -3,7 +3,7 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. -use rand::Rng; +use rand::Rng as _; use std::ffi::OsString; use uufuzz::{generate_and_run_uumain, generate_random_string, run_gnu_cmd}; diff --git a/fuzz/uufuzz/examples/integration_testing.rs b/fuzz/uufuzz/examples/integration_testing.rs index d34b47a600f..d7ab32b3776 100644 --- a/fuzz/uufuzz/examples/integration_testing.rs +++ b/fuzz/uufuzz/examples/integration_testing.rs @@ -8,7 +8,7 @@ use uufuzz::{generate_and_run_uumain, run_gnu_cmd}; // Mock sort implementation for demonstration fn mock_sort_main(args: std::vec::IntoIter) -> i32 { - use std::io::{self, Read}; + use std::io::{self, Read as _}; let args: Vec = args.collect(); let mut numeric_sort = false; diff --git a/fuzz/uufuzz/examples/pipe_input.rs b/fuzz/uufuzz/examples/pipe_input.rs index 2d8a51fba3d..9acfefd874d 100644 --- a/fuzz/uufuzz/examples/pipe_input.rs +++ b/fuzz/uufuzz/examples/pipe_input.rs @@ -4,7 +4,7 @@ // file that was distributed with this source code. use std::ffi::OsString; -use std::io::{self, Read}; +use std::io::{self, Read as _}; use uufuzz::{compare_result, generate_and_run_uumain, run_gnu_cmd}; // Mock cat implementation for demonstration diff --git a/fuzz/uufuzz/src/lib.rs b/fuzz/uufuzz/src/lib.rs index e94ffd8b189..7279f4bc8ef 100644 --- a/fuzz/uufuzz/src/lib.rs +++ b/fuzz/uufuzz/src/lib.rs @@ -9,13 +9,13 @@ use libc::{STDERR_FILENO, STDOUT_FILENO, close, dup, dup2, pipe}; use pretty_print::{ print_diff, print_end_with_status, print_or_empty, print_section, print_with_style, }; -use rand::Rng; -use rand::prelude::IndexedRandom; +use rand::Rng as _; +use rand::prelude::IndexedRandom as _; use std::env::temp_dir; use std::ffi::OsString; use std::fs::File; -use std::io::{Seek, SeekFrom, Write}; -use std::os::fd::{AsRawFd, RawFd}; +use std::io::{Seek as _, SeekFrom, Write as _}; +use std::os::fd::{AsRawFd as _, RawFd}; use std::process::{Command, Stdio}; use std::sync::atomic::Ordering; use std::sync::{Once, atomic::AtomicBool}; diff --git a/src/uu/arch/src/arch.rs b/src/uu/arch/src/arch.rs index 1b3e1f4693f..b1c6629a7f8 100644 --- a/src/uu/arch/src/arch.rs +++ b/src/uu/arch/src/arch.rs @@ -4,8 +4,8 @@ // file that was distributed with this source code. use clap::Command; -use platform_info::{PlatformInfo, PlatformInfoAPI, UNameAPI}; -use std::io::{Write, stdout}; +use platform_info::{PlatformInfo, PlatformInfoAPI as _, UNameAPI as _}; +use std::io::{Write as _, stdout}; use uucore::error::{UResult, USimpleError}; use uucore::translate; diff --git a/src/uu/base32/src/base_common.rs b/src/uu/base32/src/base_common.rs index 7bd67276bf3..9904ab28b4d 100644 --- a/src/uu/base32/src/base_common.rs +++ b/src/uu/base32/src/base_common.rs @@ -8,15 +8,15 @@ use clap::{Arg, ArgAction, Command}; use std::ffi::OsString; use std::fs::File; -use std::io::{self, BufRead, BufReader, Write}; +use std::io::{self, BufRead, BufReader, Write as _}; use std::path::{Path, PathBuf}; -use uucore::display::Quotable; +use uucore::display::Quotable as _; use uucore::encoding::{ BASE2LSBF, BASE2MSBF, Base32Wrapper, Base58Wrapper, Base64SimdWrapper, EncodingWrapper, Format, SupportsFastDecodeAndEncode, Z85Wrapper, for_base_common::{BASE32, BASE32HEX, BASE64URL, HEXUPPER_PERMISSIVE}, }; -use uucore::error::{FromIo, UResult, USimpleError, UUsageError, strip_errno}; +use uucore::error::{FromIo as _, UResult, USimpleError, UUsageError, strip_errno}; use uucore::format_usage; use uucore::translate; diff --git a/src/uu/basename/src/basename.rs b/src/uu/basename/src/basename.rs index cf89346a212..c57adf76aeb 100644 --- a/src/uu/basename/src/basename.rs +++ b/src/uu/basename/src/basename.rs @@ -8,9 +8,9 @@ use clap::builder::ValueParser; use clap::{Arg, ArgAction, Command}; use std::ffi::OsString; -use std::io::{Write, stdout}; +use std::io::{Write as _, stdout}; use std::path::PathBuf; -use uucore::display::Quotable; +use uucore::display::Quotable as _; use uucore::error::{UResult, UUsageError}; use uucore::format_usage; use uucore::line_ending::LineEnding; diff --git a/src/uu/cat/src/cat.rs b/src/uu/cat/src/cat.rs index babb0ce925e..110c5d669d4 100644 --- a/src/uu/cat/src/cat.rs +++ b/src/uu/cat/src/cat.rs @@ -12,13 +12,13 @@ use clap::{Arg, ArgAction, Command}; use memchr::memchr2; use std::ffi::OsString; use std::fs::{File, metadata}; -use std::io::{self, BufWriter, ErrorKind, IsTerminal, Read, Write}; +use std::io::{self, BufWriter, ErrorKind, IsTerminal as _, Read, Write}; #[cfg(unix)] use std::os::fd::AsFd; #[cfg(unix)] -use std::os::unix::fs::FileTypeExt; +use std::os::unix::fs::FileTypeExt as _; use thiserror::Error; -use uucore::display::Quotable; +use uucore::display::Quotable as _; use uucore::error::UResult; use uucore::translate; use uucore::{fast_inc::fast_inc_one, format_usage}; diff --git a/src/uu/cat/src/platform/unix.rs b/src/uu/cat/src/platform/unix.rs index b2cdda2aa67..bdd972aaf93 100644 --- a/src/uu/cat/src/platform/unix.rs +++ b/src/uu/cat/src/platform/unix.rs @@ -63,7 +63,7 @@ fn is_appending(file: &F) -> bool { mod tests { use crate::platform::unix::{is_appending, is_unsafe_overwrite}; use std::fs::OpenOptions; - use std::io::{Seek, SeekFrom, Write}; + use std::io::{Seek as _, SeekFrom, Write as _}; use tempfile::NamedTempFile; #[test] diff --git a/src/uu/chgrp/src/chgrp.rs b/src/uu/chgrp/src/chgrp.rs index f681da37eed..32501834fdd 100644 --- a/src/uu/chgrp/src/chgrp.rs +++ b/src/uu/chgrp/src/chgrp.rs @@ -5,9 +5,9 @@ // spell-checker:ignore (ToDO) COMFOLLOW Chowner RFILE RFILE's derefer dgid nonblank nonprint nonprinting -use uucore::display::Quotable; +use uucore::display::Quotable as _; use uucore::entries; -use uucore::error::{FromIo, UResult, USimpleError}; +use uucore::error::{FromIo as _, UResult, USimpleError}; use uucore::format_usage; use uucore::perms::{GidUidOwnerFilter, IfFrom, chown_base, options}; use uucore::translate; @@ -15,7 +15,7 @@ use uucore::translate; use clap::{Arg, ArgAction, ArgMatches, Command}; use std::fs; -use std::os::unix::fs::MetadataExt; +use std::os::unix::fs::MetadataExt as _; fn parse_gid_from_str(group: &str) -> Result { if let Some(gid_str) = group.strip_prefix(':') { diff --git a/src/uu/chmod/src/chmod.rs b/src/uu/chmod/src/chmod.rs index 78dccffdc25..ecdab62e7b1 100644 --- a/src/uu/chmod/src/chmod.rs +++ b/src/uu/chmod/src/chmod.rs @@ -8,10 +8,10 @@ use clap::{Arg, ArgAction, Command}; use std::ffi::OsString; use std::fs; -use std::os::unix::fs::{MetadataExt, PermissionsExt}; +use std::os::unix::fs::{MetadataExt as _, PermissionsExt as _}; use std::path::{Path, PathBuf}; use thiserror::Error; -use uucore::display::Quotable; +use uucore::display::Quotable as _; use uucore::error::{ExitCode, UError, UResult, USimpleError, UUsageError, set_exit_code}; use uucore::fs::display_permissions_unix; use uucore::libc::mode_t; diff --git a/src/uu/chown/src/chown.rs b/src/uu/chown/src/chown.rs index 2928171b4c5..0d0829ac3c7 100644 --- a/src/uu/chown/src/chown.rs +++ b/src/uu/chown/src/chown.rs @@ -5,18 +5,18 @@ // spell-checker:ignore (ToDO) COMFOLLOW Passwd RFILE RFILE's derefer dgid duid groupname -use uucore::display::Quotable; +use uucore::display::Quotable as _; pub use uucore::entries::{self, Group, Locate, Passwd}; use uucore::format_usage; use uucore::perms::{GidUidOwnerFilter, IfFrom, chown_base, options}; use uucore::translate; -use uucore::error::{FromIo, UResult, USimpleError}; +use uucore::error::{FromIo as _, UResult, USimpleError}; use clap::{Arg, ArgAction, ArgMatches, Command}; use std::fs; -use std::os::unix::fs::MetadataExt; +use std::os::unix::fs::MetadataExt as _; fn parse_gid_uid_and_filter(matches: &ArgMatches) -> UResult { let filter = if let Some(spec) = matches.get_one::(options::FROM) { diff --git a/src/uu/chroot/src/chroot.rs b/src/uu/chroot/src/chroot.rs index 04cb8c0c965..d52ea4cb382 100644 --- a/src/uu/chroot/src/chroot.rs +++ b/src/uu/chroot/src/chroot.rs @@ -10,11 +10,11 @@ use crate::error::ChrootError; use clap::{Arg, ArgAction, Command}; use std::ffi::CString; use std::io::{Error, ErrorKind}; -use std::os::unix::prelude::OsStrExt; -use std::os::unix::process::CommandExt; +use std::os::unix::prelude::OsStrExt as _; +use std::os::unix::process::CommandExt as _; use std::path::{Path, PathBuf}; use std::process; -use uucore::entries::{Locate, Passwd, grp2gid, usr2uid}; +use uucore::entries::{Locate as _, Passwd, grp2gid, usr2uid}; use uucore::error::{UResult, UUsageError}; use uucore::fs::{MissingHandling, ResolveMode, canonicalize}; use uucore::libc::{self, chroot, setgid, setgroups, setuid}; diff --git a/src/uu/chroot/src/error.rs b/src/uu/chroot/src/error.rs index 15922ad835e..5196b66dbc2 100644 --- a/src/uu/chroot/src/error.rs +++ b/src/uu/chroot/src/error.rs @@ -7,7 +7,7 @@ use std::io::Error; use std::path::PathBuf; use thiserror::Error; -use uucore::display::Quotable; +use uucore::display::Quotable as _; use uucore::error::UError; use uucore::libc; use uucore::translate; diff --git a/src/uu/cksum/src/cksum.rs b/src/uu/cksum/src/cksum.rs index 5c78af2c6de..b478666bf42 100644 --- a/src/uu/cksum/src/cksum.rs +++ b/src/uu/cksum/src/cksum.rs @@ -6,10 +6,10 @@ // spell-checker:ignore (ToDO) fname, algo, bitlen use std::ffi::OsStr; -use std::io::{Write, stderr}; +use std::io::{Write as _, stderr}; use clap::Command; -use uu_checksum_common::{ChecksumCommand, checksum_main, default_checksum_app, options}; +use uu_checksum_common::{ChecksumCommand as _, checksum_main, default_checksum_app, options}; use uucore::checksum::compute::OutputFormat; use uucore::checksum::{ diff --git a/src/uu/comm/src/comm.rs b/src/uu/comm/src/comm.rs index c72bbcc8a2e..49baf5ff3bd 100644 --- a/src/uu/comm/src/comm.rs +++ b/src/uu/comm/src/comm.rs @@ -8,10 +8,10 @@ use std::cmp::Ordering; use std::ffi::OsString; use std::fs::{File, metadata}; -use std::io::{self, BufRead, BufReader, BufWriter, Read, StdinLock, Write, stdin}; +use std::io::{self, BufRead as _, BufReader, BufWriter, Read as _, StdinLock, Write, stdin}; use std::path::Path; -use uucore::display::Quotable; -use uucore::error::{FromIo, UResult, USimpleError}; +use uucore::display::Quotable as _; +use uucore::error::{FromIo as _, UResult, USimpleError}; use uucore::format_usage; use uucore::fs::paths_refer_to_same_file; use uucore::line_ending::LineEnding; diff --git a/src/uu/cp/src/copydir.rs b/src/uu/cp/src/copydir.rs index 42e30b452d4..b2e1d87a9c2 100644 --- a/src/uu/cp/src/copydir.rs +++ b/src/uu/cp/src/copydir.rs @@ -16,7 +16,7 @@ use std::io; use std::path::{Path, PathBuf, StripPrefixError}; use indicatif::ProgressBar; -use uucore::display::Quotable; +use uucore::display::Quotable as _; use uucore::error::UIoError; use uucore::fs::{ FileInformation, MissingHandling, ResolveMode, canonicalize, path_ends_with_terminator, @@ -597,7 +597,7 @@ fn build_dir( #[cfg(unix)] { use crate::Preserve; - use std::os::unix::fs::PermissionsExt; + use std::os::unix::fs::PermissionsExt as _; // we need to allow trivial casts here because some systems like linux have u32 constants in // in libc while others don't. diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 04a3c1c0110..8a9b11d68fc 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -10,7 +10,7 @@ use std::ffi::OsString; use std::fmt::Display; use std::fs::{self, Metadata, OpenOptions, Permissions}; #[cfg(unix)] -use std::os::unix::fs::{FileTypeExt, PermissionsExt}; +use std::os::unix::fs::{FileTypeExt as _, PermissionsExt as _}; #[cfg(unix)] use std::os::unix::net::UnixListener; use std::path::{Path, PathBuf, StripPrefixError}; @@ -25,7 +25,7 @@ use indicatif::{ProgressBar, ProgressStyle}; use thiserror::Error; use platform::copy_on_write; -use uucore::display::Quotable; +use uucore::display::Quotable as _; use uucore::error::{UError, UResult, UUsageError, set_exit_code}; #[cfg(unix)] use uucore::fs::make_fifo; @@ -1579,7 +1579,7 @@ fn file_mode_for_interactive_overwrite( #[cfg(unix)] { use libc::{S_IWUSR, mode_t}; - use std::os::unix::prelude::MetadataExt; + use std::os::unix::prelude::MetadataExt as _; match path.metadata() { Ok(me) => { @@ -1725,7 +1725,7 @@ pub(crate) fn copy_attributes( // Ownership must be changed first to avoid interfering with mode change. #[cfg(unix)] handle_preserve(attributes.ownership, || -> CopyResult<()> { - use std::os::unix::prelude::MetadataExt; + use std::os::unix::prelude::MetadataExt as _; use uucore::perms::Verbosity; use uucore::perms::VerbosityLevel; use uucore::perms::wrap_chown; diff --git a/src/uu/cp/src/platform/macos.rs b/src/uu/cp/src/platform/macos.rs index a545c552ba4..e3dc51f4feb 100644 --- a/src/uu/cp/src/platform/macos.rs +++ b/src/uu/cp/src/platform/macos.rs @@ -5,12 +5,12 @@ // spell-checker:ignore reflink use std::ffi::CString; use std::fs::{self, File, OpenOptions}; -use std::os::unix::ffi::OsStrExt; -use std::os::unix::fs::OpenOptionsExt; +use std::os::unix::ffi::OsStrExt as _; +use std::os::unix::fs::OpenOptionsExt as _; use std::path::Path; use uucore::buf_copy; -use uucore::display::Quotable; +use uucore::display::Quotable as _; use uucore::translate; use uucore::mode::get_umask; diff --git a/src/uu/csplit/src/csplit.rs b/src/uu/csplit/src/csplit.rs index c52a95c3a10..37600173a10 100644 --- a/src/uu/csplit/src/csplit.rs +++ b/src/uu/csplit/src/csplit.rs @@ -10,13 +10,13 @@ use std::ffi::OsString; use std::io::{self, BufReader, ErrorKind}; use std::{ fs::{File, remove_file}, - io::{BufRead, BufWriter, Write}, + io::{BufRead, BufWriter, Write as _}, }; use clap::{Arg, ArgAction, ArgMatches, Command}; use regex::Regex; -use uucore::display::Quotable; -use uucore::error::{FromIo, UResult}; +use uucore::display::Quotable as _; +use uucore::error::{FromIo as _, UResult}; use uucore::format_usage; mod csplit_error; diff --git a/src/uu/csplit/src/csplit_error.rs b/src/uu/csplit/src/csplit_error.rs index d73400bd7d1..5b8c3e38e32 100644 --- a/src/uu/csplit/src/csplit_error.rs +++ b/src/uu/csplit/src/csplit_error.rs @@ -5,7 +5,7 @@ use std::io; use thiserror::Error; -use uucore::display::Quotable; +use uucore::display::Quotable as _; use uucore::error::UError; use uucore::translate; diff --git a/src/uu/cut/src/cut.rs b/src/uu/cut/src/cut.rs index dd0ea9d8ad9..40f1728aba9 100644 --- a/src/uu/cut/src/cut.rs +++ b/src/uu/cut/src/cut.rs @@ -5,14 +5,14 @@ // spell-checker:ignore (ToDO) delim sourcefiles -use bstr::io::BufReadExt; +use bstr::io::BufReadExt as _; use clap::{Arg, ArgAction, ArgMatches, Command, builder::ValueParser}; use std::ffi::OsString; use std::fs::File; -use std::io::{BufRead, BufReader, BufWriter, IsTerminal, Read, Write, stdin, stdout}; +use std::io::{BufRead as _, BufReader, BufWriter, IsTerminal as _, Read, Write, stdin, stdout}; use std::path::Path; -use uucore::display::Quotable; -use uucore::error::{FromIo, UResult, USimpleError, set_exit_code}; +use uucore::display::Quotable as _; +use uucore::error::{FromIo as _, UResult, USimpleError, set_exit_code}; use uucore::line_ending::LineEnding; use uucore::os_str_as_bytes; diff --git a/src/uu/date/benches/date_bench.rs b/src/uu/date/benches/date_bench.rs index 1c1d05aaea2..c1b0974f0d1 100644 --- a/src/uu/date/benches/date_bench.rs +++ b/src/uu/date/benches/date_bench.rs @@ -4,7 +4,7 @@ // file that was distributed with this source code. use divan::{Bencher, black_box}; -use std::io::Write; +use std::io::Write as _; use tempfile::NamedTempFile; use uu_date::uumain; use uucore::benchmark::run_util_function; diff --git a/src/uu/date/src/date.rs b/src/uu/date/src/date.rs index 5e84e5d6ce5..de0c6ed0623 100644 --- a/src/uu/date/src/date.rs +++ b/src/uu/date/src/date.rs @@ -14,11 +14,11 @@ use jiff::{Timestamp, Zoned}; use std::borrow::Cow; use std::collections::HashMap; use std::fs::File; -use std::io::{BufRead, BufReader, BufWriter, Write}; +use std::io::{BufRead as _, BufReader, BufWriter, Write as _}; use std::path::PathBuf; use std::sync::OnceLock; -use uucore::display::Quotable; -use uucore::error::FromIo; +use uucore::display::Quotable as _; +use uucore::error::FromIo as _; use uucore::error::{UResult, USimpleError}; #[cfg(feature = "i18n-datetime")] use uucore::i18n::datetime::{localize_format_string, should_use_icu_locale}; diff --git a/src/uu/dd/src/dd.rs b/src/uu/dd/src/dd.rs index 48f7ef1b98e..9c3f7693253 100644 --- a/src/uu/dd/src/dd.rs +++ b/src/uu/dd/src/dd.rs @@ -32,15 +32,15 @@ use std::ffi::OsString; #[cfg(unix)] use std::fs::Metadata; use std::fs::{File, OpenOptions}; -use std::io::{self, Read, Seek, SeekFrom, Write}; +use std::io::{self, Read, Seek as _, SeekFrom, Write}; #[cfg(any(target_os = "linux", target_os = "android"))] use std::os::fd::AsFd; #[cfg(any(target_os = "linux", target_os = "android"))] use std::os::unix::fs::OpenOptionsExt; #[cfg(unix)] use std::os::unix::{ - fs::FileTypeExt, - io::{AsRawFd, FromRawFd}, + fs::FileTypeExt as _, + io::{AsRawFd as _, FromRawFd as _}, }; #[cfg(windows)] use std::os::windows::{fs::MetadataExt, io::AsHandle}; @@ -57,8 +57,8 @@ use nix::{ errno::Errno, fcntl::{PosixFadviseAdvice, posix_fadvise}, }; -use uucore::display::Quotable; -use uucore::error::{FromIo, UResult}; +use uucore::display::Quotable as _; +use uucore::error::{FromIo as _, UResult}; #[cfg(unix)] use uucore::error::{USimpleError, set_exit_code}; #[cfg(target_os = "linux")] diff --git a/src/uu/dd/src/parseargs.rs b/src/uu/dd/src/parseargs.rs index 3a37d97ffb9..88b55705eb4 100644 --- a/src/uu/dd/src/parseargs.rs +++ b/src/uu/dd/src/parseargs.rs @@ -10,7 +10,7 @@ mod unit_tests; use super::{ConversionMode, IConvFlags, IFlags, Num, OConvFlags, OFlags, Settings, StatusLevel}; use crate::conversion_tables::ConversionTable; use thiserror::Error; -use uucore::display::Quotable; +use uucore::display::Quotable as _; use uucore::error::UError; use uucore::parser::parse_size::{ParseSizeError, Parser as SizeParser}; use uucore::show_warning; diff --git a/src/uu/dd/src/progress.rs b/src/uu/dd/src/progress.rs index c7aef33875b..534e46144a2 100644 --- a/src/uu/dd/src/progress.rs +++ b/src/uu/dd/src/progress.rs @@ -19,7 +19,7 @@ use std::time::Duration; use signal_hook::iterator::Handle; use uucore::{ error::{UResult, set_exit_code}, - format::num_format::{FloatVariant, Formatter}, + format::num_format::{FloatVariant, Formatter as _}, locale::setup_localization, translate, }; diff --git a/src/uu/df/src/blocks.rs b/src/uu/df/src/blocks.rs index 328090ffded..f291d37f69a 100644 --- a/src/uu/df/src/blocks.rs +++ b/src/uu/df/src/blocks.rs @@ -8,7 +8,7 @@ use clap::ArgMatches; use std::{env, fmt}; use uucore::{ - display::Quotable, + display::Quotable as _, parser::parse_size::{ParseSizeError, parse_size_non_zero_u64, parse_size_u64}, }; diff --git a/src/uu/df/src/columns.rs b/src/uu/df/src/columns.rs index 0fcd20865d5..bed88ff7c0b 100644 --- a/src/uu/df/src/columns.rs +++ b/src/uu/df/src/columns.rs @@ -6,7 +6,7 @@ use crate::{OPT_INODES, OPT_OUTPUT, OPT_PRINT_TYPE}; use clap::{ArgMatches, parser::ValueSource}; use thiserror::Error; -use uucore::display::Quotable; +use uucore::display::Quotable as _; /// The columns in the output table produced by `df`. /// diff --git a/src/uu/df/src/df.rs b/src/uu/df/src/df.rs index e0133805f97..add678aceb6 100644 --- a/src/uu/df/src/df.rs +++ b/src/uu/df/src/df.rs @@ -11,7 +11,7 @@ mod table; use blocks::HumanReadable; use clap::builder::ValueParser; use table::HeaderMode; -use uucore::display::Quotable; +use uucore::display::Quotable as _; use uucore::error::{UError, UResult, USimpleError, get_exit_code}; use uucore::fsext::{MountInfo, read_fs_list}; use uucore::parser::parse_size::ParseSizeError; diff --git a/src/uu/df/src/filesystem.rs b/src/uu/df/src/filesystem.rs index 858e86917dc..296f6d60cd1 100644 --- a/src/uu/df/src/filesystem.rs +++ b/src/uu/df/src/filesystem.rs @@ -15,10 +15,10 @@ use std::path::PathBuf; use std::{ffi::OsString, path::Path}; #[cfg(unix)] -use std::os::unix::fs::MetadataExt; +use std::os::unix::fs::MetadataExt as _; #[cfg(unix)] -use uucore::fsext::{FsMeta, pretty_fstype, statfs}; +use uucore::fsext::{FsMeta as _, pretty_fstype, statfs}; use uucore::fsext::{FsUsage, MountInfo}; /// Summary representation of a filesystem. diff --git a/src/uu/dircolors/src/dircolors.rs b/src/uu/dircolors/src/dircolors.rs index 72e18d55d4f..f1d067f2c99 100644 --- a/src/uu/dircolors/src/dircolors.rs +++ b/src/uu/dircolors/src/dircolors.rs @@ -10,12 +10,12 @@ use std::env; use std::ffi::OsString; use std::fmt::Write as _; use std::fs::File; -use std::io::{BufRead, BufReader}; +use std::io::{BufRead as _, BufReader}; use std::path::Path; use clap::{Arg, ArgAction, Command}; use uucore::colors::{FILE_ATTRIBUTE_CODES, FILE_COLORS, FILE_TYPES, TERMS}; -use uucore::display::Quotable; +use uucore::display::Quotable as _; use uucore::error::{UResult, USimpleError, UUsageError}; use uucore::translate; diff --git a/src/uu/dirname/src/dirname.rs b/src/uu/dirname/src/dirname.rs index 6bd91d91054..3d14711cd56 100644 --- a/src/uu/dirname/src/dirname.rs +++ b/src/uu/dirname/src/dirname.rs @@ -121,7 +121,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { #[cfg(unix)] { - use std::os::unix::ffi::OsStrExt; + use std::os::unix::ffi::OsStrExt as _; let result_os = std::ffi::OsStr::from_bytes(&result); print_verbatim(result_os).unwrap(); } diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index a1b3596cc4c..81abc09dc19 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -13,7 +13,7 @@ use std::ffi::{OsStr, OsString}; use std::fs::{self, DirEntry, File, Metadata}; use std::io::{BufRead, BufReader, stdout}; #[cfg(not(windows))] -use std::os::unix::fs::MetadataExt; +use std::os::unix::fs::MetadataExt as _; #[cfg(windows)] use std::os::windows::io::AsRawHandle; use std::path::{Path, PathBuf}; @@ -21,8 +21,8 @@ use std::str::FromStr; use std::sync::mpsc; use std::thread; use thiserror::Error; -use uucore::display::{Quotable, print_verbatim}; -use uucore::error::{FromIo, UError, UResult, USimpleError, set_exit_code}; +use uucore::display::{Quotable as _, print_verbatim}; +use uucore::error::{FromIo as _, UError, UResult, USimpleError, set_exit_code}; use uucore::fsext::{MetadataTimeField, metadata_get_time}; use uucore::line_ending::LineEnding; #[cfg(all(unix, not(target_os = "redox")))] diff --git a/src/uu/echo/src/echo.rs b/src/uu/echo/src/echo.rs index beb9c7dfd03..36db78377cf 100644 --- a/src/uu/echo/src/echo.rs +++ b/src/uu/echo/src/echo.rs @@ -7,9 +7,9 @@ use clap::builder::ValueParser; use clap::{Arg, ArgAction, Command}; use std::env; use std::ffi::{OsStr, OsString}; -use std::io::{self, StdoutLock, Write}; +use std::io::{self, StdoutLock, Write as _}; use uucore::error::UResult; -use uucore::format::{FormatChar, OctalParsing, parse_escape_only}; +use uucore::format::{FormatChar as _, OctalParsing, parse_escape_only}; use uucore::{format_usage, os_str_as_bytes}; use uucore::translate; diff --git a/src/uu/env/src/env.rs b/src/uu/env/src/env.rs index 5e56fbd0413..7c4bbe9001e 100644 --- a/src/uu/env/src/env.rs +++ b/src/uu/env/src/env.rs @@ -15,7 +15,8 @@ use clap::builder::ValueParser; use clap::{Arg, ArgAction, Command, crate_name}; use ini::Ini; use native_int_str::{ - Convert, NCvt, NativeIntStr, NativeIntString, NativeStr, from_native_int_representation_owned, + Convert as _, NCvt, NativeIntStr, NativeIntString, NativeStr, + from_native_int_representation_owned, }; #[cfg(unix)] use nix::libc; @@ -33,11 +34,11 @@ use std::io; use std::io::Write as _; use std::io::stderr; #[cfg(unix)] -use std::os::unix::ffi::OsStrExt; +use std::os::unix::ffi::OsStrExt as _; #[cfg(unix)] -use std::os::unix::process::CommandExt; +use std::os::unix::process::CommandExt as _; -use uucore::display::{Quotable, print_all_env_vars}; +use uucore::display::{Quotable as _, print_all_env_vars}; use uucore::error::{ExitCode, UError, UResult, USimpleError, UUsageError}; use uucore::line_ending::LineEnding; #[cfg(unix)] diff --git a/src/uu/env/src/native_int_str.rs b/src/uu/env/src/native_int_str.rs index 3e26dad0740..d5eac9bf743 100644 --- a/src/uu/env/src/native_int_str.rs +++ b/src/uu/env/src/native_int_str.rs @@ -14,7 +14,7 @@ use std::ffi::OsString; #[cfg(not(target_os = "windows"))] -use std::os::unix::ffi::{OsStrExt, OsStringExt}; +use std::os::unix::ffi::{OsStrExt as _, OsStringExt as _}; #[cfg(target_os = "windows")] use std::os::windows::prelude::*; use std::{borrow::Cow, ffi::OsStr}; diff --git a/src/uu/expand/benches/expand_bench.rs b/src/uu/expand/benches/expand_bench.rs index ff9c24ef15a..d61e32a01a9 100644 --- a/src/uu/expand/benches/expand_bench.rs +++ b/src/uu/expand/benches/expand_bench.rs @@ -4,7 +4,7 @@ // file that was distributed with this source code. use divan::{Bencher, black_box}; -use std::fmt::Write; +use std::fmt::Write as _; use uu_expand::uumain; use uucore::benchmark::{create_test_file, run_util_function}; diff --git a/src/uu/expand/src/expand.rs b/src/uu/expand/src/expand.rs index 685cb44ac98..3d1b7be224c 100644 --- a/src/uu/expand/src/expand.rs +++ b/src/uu/expand/src/expand.rs @@ -8,14 +8,14 @@ use clap::{Arg, ArgAction, ArgMatches, Command}; use std::ffi::OsString; use std::fs::File; -use std::io::{BufReader, BufWriter, Read, Write, stdin, stdout}; +use std::io::{BufReader, BufWriter, Read, Write as _, stdin, stdout}; use std::num::IntErrorKind; use std::path::Path; use std::str::from_utf8; use thiserror::Error; use unicode_width::UnicodeWidthChar; -use uucore::display::Quotable; -use uucore::error::{FromIo, UError, UResult, USimpleError, set_exit_code}; +use uucore::display::Quotable as _; +use uucore::error::{FromIo as _, UError, UResult, USimpleError, set_exit_code}; use uucore::translate; use uucore::{format_usage, show}; diff --git a/src/uu/expr/src/expr.rs b/src/uu/expr/src/expr.rs index 75ce8620d6f..3e8c59d8dc2 100644 --- a/src/uu/expr/src/expr.rs +++ b/src/uu/expr/src/expr.rs @@ -4,13 +4,13 @@ // file that was distributed with this source code. use clap::{Arg, ArgAction, Command}; -use std::io::Write; +use std::io::Write as _; use syntax_tree::{AstNode, is_truthy}; use thiserror::Error; use uucore::os_string_to_vec; use uucore::translate; use uucore::{ - display::Quotable, + display::Quotable as _, error::{UError, UResult}, format_usage, }; diff --git a/src/uu/expr/src/locale_aware.rs b/src/uu/expr/src/locale_aware.rs index c8a4e73e33e..4e9e17f6c20 100644 --- a/src/uu/expr/src/locale_aware.rs +++ b/src/uu/expr/src/locale_aware.rs @@ -6,7 +6,7 @@ use std::cmp::Ordering; use uucore::{ - CharByte, IntoCharByteIterator, + CharByte, IntoCharByteIterator as _, i18n::{ UEncoding, collator::{AlternateHandling, CollatorOptions, locale_cmp, try_init_collator}, diff --git a/src/uu/expr/src/syntax_tree.rs b/src/uu/expr/src/syntax_tree.rs index a5c453c1745..013643e8f1a 100644 --- a/src/uu/expr/src/syntax_tree.rs +++ b/src/uu/expr/src/syntax_tree.rs @@ -8,7 +8,7 @@ use std::{cell::Cell, collections::BTreeMap}; use num_bigint::BigInt; -use num_traits::ToPrimitive; +use num_traits::ToPrimitive as _; use onig::{Regex, RegexOptions, Syntax}; use crate::{ diff --git a/src/uu/factor/src/factor.rs b/src/uu/factor/src/factor.rs index 898679893c9..eca24773761 100644 --- a/src/uu/factor/src/factor.rs +++ b/src/uu/factor/src/factor.rs @@ -6,14 +6,14 @@ // spell-checker:ignore funcs use std::collections::BTreeMap; -use std::io::BufRead; +use std::io::BufRead as _; use std::io::{self, Write, stdin, stdout}; use clap::{Arg, ArgAction, Command}; use num_bigint::BigUint; -use num_traits::FromPrimitive; -use uucore::display::Quotable; -use uucore::error::{FromIo, UResult, USimpleError, set_exit_code}; +use num_traits::FromPrimitive as _; +use uucore::display::Quotable as _; +use uucore::error::{FromIo as _, UResult, USimpleError, set_exit_code}; use uucore::translate; use uucore::{format_usage, show_error, show_warning}; diff --git a/src/uu/false/src/false.rs b/src/uu/false/src/false.rs index d4e6b673898..9f4c4297946 100644 --- a/src/uu/false/src/false.rs +++ b/src/uu/false/src/false.rs @@ -3,7 +3,7 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. use clap::{Arg, ArgAction, Command}; -use std::{ffi::OsString, io::Write}; +use std::{ffi::OsString, io::Write as _}; use uucore::error::{UResult, set_exit_code}; use uucore::translate; diff --git a/src/uu/fmt/src/fmt.rs b/src/uu/fmt/src/fmt.rs index c06c5702b41..c1fb2b4d546 100644 --- a/src/uu/fmt/src/fmt.rs +++ b/src/uu/fmt/src/fmt.rs @@ -8,10 +8,10 @@ use clap::{Arg, ArgAction, ArgMatches, Command}; use std::ffi::OsString; use std::fs::File; -use std::io::{BufReader, BufWriter, Read, Stdout, Write, stdin, stdout}; +use std::io::{BufReader, BufWriter, Read, Stdout, Write as _, stdin, stdout}; use std::path::Path; -use uucore::display::Quotable; -use uucore::error::{FromIo, UResult, USimpleError}; +use uucore::display::Quotable as _; +use uucore::error::{FromIo as _, UResult, USimpleError}; use uucore::translate; use uucore::format_usage; diff --git a/src/uu/fmt/src/linebreak.rs b/src/uu/fmt/src/linebreak.rs index a64728aeb00..a9560fe38a2 100644 --- a/src/uu/fmt/src/linebreak.rs +++ b/src/uu/fmt/src/linebreak.rs @@ -5,7 +5,7 @@ // spell-checker:ignore (ToDO) INFTY MULT accum breakwords linebreak linebreaking linebreaks linelen maxlength minlength nchars ostream overlen parasplit plass posn powf punct signum slen sstart tabwidth tlen underlen winfo wlen wordlen -use std::io::{BufWriter, Stdout, Write}; +use std::io::{BufWriter, Stdout, Write as _}; use std::{cmp, mem}; use crate::FmtOptions; diff --git a/src/uu/fmt/src/parasplit.rs b/src/uu/fmt/src/parasplit.rs index 4fff132eb31..7033a308d71 100644 --- a/src/uu/fmt/src/parasplit.rs +++ b/src/uu/fmt/src/parasplit.rs @@ -5,7 +5,7 @@ // spell-checker:ignore (ToDO) INFTY MULT PSKIP accum aftertab beforetab breakwords fmt's formatline linebreak linebreaking linebreaks linelen maxlength minlength nchars noformat noformatline ostream overlen parasplit plass pmatch poffset posn powf prefixindent punct signum slen sstart tabwidth tlen underlen winfo wlen wordlen wordsplits xanti xprefix -use std::io::BufRead; +use std::io::BufRead as _; use std::iter::Peekable; use std::slice::Iter; use unicode_width::UnicodeWidthChar; diff --git a/src/uu/fold/src/fold.rs b/src/uu/fold/src/fold.rs index 17b58e18b42..a4e562610b0 100644 --- a/src/uu/fold/src/fold.rs +++ b/src/uu/fold/src/fold.rs @@ -7,11 +7,11 @@ use clap::{Arg, ArgAction, Command}; use std::fs::File; -use std::io::{BufRead, BufReader, BufWriter, Read, Write, stdin, stdout}; +use std::io::{BufRead as _, BufReader, BufWriter, Read, Write, stdin, stdout}; use std::path::Path; use unicode_width::UnicodeWidthChar; -use uucore::display::Quotable; -use uucore::error::{FromIo, UResult, USimpleError}; +use uucore::display::Quotable as _; +use uucore::error::{FromIo as _, UResult, USimpleError}; use uucore::format_usage; use uucore::translate; diff --git a/src/uu/groups/src/groups.rs b/src/uu/groups/src/groups.rs index aff29ca1e12..5fddec4e7e1 100644 --- a/src/uu/groups/src/groups.rs +++ b/src/uu/groups/src/groups.rs @@ -5,11 +5,11 @@ // spell-checker:ignore (ToDO) passwd -use std::io::{Write, stdout}; +use std::io::{Write as _, stdout}; use thiserror::Error; use uucore::{ - display::Quotable, - entries::{Locate, Passwd, get_groups_gnu, gid2grp}, + display::Quotable as _, + entries::{Locate as _, Passwd, get_groups_gnu, gid2grp}, error::{UError, UResult}, format_usage, show, }; diff --git a/src/uu/head/src/head.rs b/src/uu/head/src/head.rs index 428d62443a1..9768908486b 100644 --- a/src/uu/head/src/head.rs +++ b/src/uu/head/src/head.rs @@ -9,14 +9,14 @@ use clap::{Arg, ArgAction, ArgMatches, Command}; use memchr::memrchr_iter; use std::ffi::OsString; use std::fs::File; -use std::io::{self, BufWriter, Read, Seek, SeekFrom, Write}; +use std::io::{self, BufWriter, Read, Seek, SeekFrom, Write as _}; use std::num::TryFromIntError; #[cfg(unix)] -use std::os::fd::AsFd; +use std::os::fd::AsFd as _; use std::path::PathBuf; use thiserror::Error; -use uucore::display::{Quotable, print_verbatim}; -use uucore::error::{FromIo, UError, UResult}; +use uucore::display::{Quotable as _, print_verbatim}; +use uucore::error::{FromIo as _, UError, UResult}; use uucore::line_ending::LineEnding; use uucore::translate; use uucore::{format_usage, show}; diff --git a/src/uu/head/src/take.rs b/src/uu/head/src/take.rs index 6f05b77e595..a2fcb5de11b 100644 --- a/src/uu/head/src/take.rs +++ b/src/uu/head/src/take.rs @@ -359,7 +359,7 @@ pub fn take_lines(reader: R, limit: u64, separator: u8) -> TakeLines { #[cfg(test)] mod tests { - use std::io::{BufRead, BufReader}; + use std::io::{BufRead as _, BufReader}; use crate::take::{ TakeAllBuffer, TakeAllLinesBuffer, copy_all_but_n_bytes, copy_all_but_n_lines, take_lines, diff --git a/src/uu/hostid/src/hostid.rs b/src/uu/hostid/src/hostid.rs index 52981313544..cbfeae10612 100644 --- a/src/uu/hostid/src/hostid.rs +++ b/src/uu/hostid/src/hostid.rs @@ -7,7 +7,7 @@ use clap::Command; use libc::{c_long, gethostid}; -use std::io::{Write, stdout}; +use std::io::{Write as _, stdout}; use uucore::{error::UResult, format_usage}; use uucore::translate; diff --git a/src/uu/hostname/src/hostname.rs b/src/uu/hostname/src/hostname.rs index 37bcc607474..7c0c9b532d2 100644 --- a/src/uu/hostname/src/hostname.rs +++ b/src/uu/hostname/src/hostname.rs @@ -6,7 +6,7 @@ // spell-checker:ignore hashset Addrs addrs #[cfg(not(any(target_os = "freebsd", target_os = "openbsd")))] -use std::net::ToSocketAddrs; +use std::net::ToSocketAddrs as _; use std::str; use std::{collections::hash_set::HashSet, ffi::OsString}; @@ -18,7 +18,7 @@ use dns_lookup::lookup_host; use uucore::translate; use uucore::{ - error::{FromIo, UResult}, + error::{FromIo as _, UResult}, format_usage, }; diff --git a/src/uu/join/benches/join_bench.rs b/src/uu/join/benches/join_bench.rs index 800bfa96d73..e5e65b3bc49 100644 --- a/src/uu/join/benches/join_bench.rs +++ b/src/uu/join/benches/join_bench.rs @@ -4,7 +4,7 @@ // file that was distributed with this source code. use divan::{Bencher, black_box}; -use std::{fs::File, io::Write}; +use std::{fs::File, io::Write as _}; use tempfile::TempDir; use uu_join::uumain; use uucore::benchmark::run_util_function; diff --git a/src/uu/join/src/join.rs b/src/uu/join/src/join.rs index 45aa79cef7d..06a3f478ea3 100644 --- a/src/uu/join/src/join.rs +++ b/src/uu/join/src/join.rs @@ -14,10 +14,10 @@ use std::fs::File; use std::io::{BufRead, BufReader, BufWriter, Split, Stdin, Write, stdin, stdout}; use std::num::IntErrorKind; #[cfg(unix)] -use std::os::unix::ffi::OsStrExt; +use std::os::unix::ffi::OsStrExt as _; use thiserror::Error; -use uucore::display::Quotable; -use uucore::error::{FromIo, UError, UResult, USimpleError, set_exit_code}; +use uucore::display::Quotable as _; +use uucore::error::{FromIo as _, UError, UResult, USimpleError, set_exit_code}; use uucore::format_usage; use uucore::i18n::collator::{ AlternateHandling, CollatorOptions, locale_cmp, should_use_locale_collation, try_init_collator, diff --git a/src/uu/kill/src/kill.rs b/src/uu/kill/src/kill.rs index 94aa81964b6..77de8ba6b55 100644 --- a/src/uu/kill/src/kill.rs +++ b/src/uu/kill/src/kill.rs @@ -9,8 +9,8 @@ use clap::{Arg, ArgAction, Command}; use nix::sys::signal::{self, Signal}; use nix::unistd::Pid; use std::io::Error; -use uucore::display::Quotable; -use uucore::error::{FromIo, UResult, USimpleError}; +use uucore::display::Quotable as _; +use uucore::error::{FromIo as _, UResult, USimpleError}; use uucore::translate; use uucore::signals::{ALL_SIGNALS, signal_by_name_or_value, signal_name_by_value}; diff --git a/src/uu/link/src/link.rs b/src/uu/link/src/link.rs index d19e84be498..c7e10c158c7 100644 --- a/src/uu/link/src/link.rs +++ b/src/uu/link/src/link.rs @@ -8,8 +8,8 @@ use clap::{Arg, Command}; use std::ffi::OsString; use std::fs::hard_link; use std::path::Path; -use uucore::display::Quotable; -use uucore::error::{FromIo, UResult}; +use uucore::display::Quotable as _; +use uucore::error::{FromIo as _, UResult}; use uucore::format_usage; use uucore::translate; diff --git a/src/uu/ln/src/ln.rs b/src/uu/ln/src/ln.rs index 541586625f9..14eae31ee2d 100644 --- a/src/uu/ln/src/ln.rs +++ b/src/uu/ln/src/ln.rs @@ -6,9 +6,9 @@ // spell-checker:ignore (ToDO) srcpath targetpath EEXIST use clap::{Arg, ArgAction, Command}; -use std::io::{Write, stdout}; -use uucore::display::Quotable; -use uucore::error::{FromIo, UError, UResult}; +use std::io::{Write as _, stdout}; +use uucore::display::Quotable as _; +use uucore::error::{FromIo as _, UError, UResult}; use uucore::fs::{make_path_relative_to, paths_refer_to_same_file}; use uucore::translate; use uucore::{format_usage, prompt_yes, show_error}; diff --git a/src/uu/logname/src/logname.rs b/src/uu/logname/src/logname.rs index 8790fea3cf8..11b1b332a5a 100644 --- a/src/uu/logname/src/logname.rs +++ b/src/uu/logname/src/logname.rs @@ -7,7 +7,7 @@ use clap::Command; use std::ffi::CStr; -use std::io::{Write, stdout}; +use std::io::{Write as _, stdout}; use uucore::translate; use uucore::{error::UResult, show_error}; diff --git a/src/uu/ls/src/colors.rs b/src/uu/ls/src/colors.rs index fa9a8903bb8..95fd253bb64 100644 --- a/src/uu/ls/src/colors.rs +++ b/src/uu/ls/src/colors.rs @@ -10,7 +10,7 @@ use std::env; use std::ffi::OsString; use std::fs::{self, Metadata}; #[cfg(unix)] -use std::os::unix::fs::{FileTypeExt, MetadataExt}; +use std::os::unix::fs::{FileTypeExt as _, MetadataExt as _}; /// ANSI CSI (Control Sequence Introducer) const ANSI_CSI: &str = "\x1b["; diff --git a/src/uu/ls/src/dired.rs b/src/uu/ls/src/dired.rs index 69122ccd08b..0e970ec4445 100644 --- a/src/uu/ls/src/dired.rs +++ b/src/uu/ls/src/dired.rs @@ -36,7 +36,7 @@ /// use crate::Config; use std::fmt; -use std::io::{BufWriter, Stdout, Write}; +use std::io::{BufWriter, Stdout, Write as _}; use uucore::error::UResult; #[derive(Debug, Clone, PartialEq)] diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 489fa301b97..9a10fee315d 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -12,7 +12,7 @@ use rustc_hash::FxHashSet; use std::borrow::Cow; use std::cell::RefCell; #[cfg(unix)] -use std::os::unix::fs::{FileTypeExt, MetadataExt}; +use std::os::unix::fs::{FileTypeExt as _, MetadataExt as _}; #[cfg(windows)] use std::os::windows::fs::MetadataExt; use std::{ @@ -21,7 +21,7 @@ use std::{ ffi::{OsStr, OsString}, fmt::Write as _, fs::{self, DirEntry, FileType, Metadata, ReadDir}, - io::{BufWriter, ErrorKind, IsTerminal, Stdout, Write, stdout}, + io::{BufWriter, ErrorKind, IsTerminal as _, Stdout, Write, stdout}, iter, num::IntErrorKind, ops::RangeInclusive, @@ -59,7 +59,7 @@ use uucore::libc::{S_IXGRP, S_IXOTH, S_IXUSR}; ))] use uucore::libc::{dev_t, major, minor}; use uucore::{ - display::Quotable, + display::Quotable as _, error::{UError, UResult, set_exit_code}, format::human::{SizeFormat, human_readable}, format_usage, diff --git a/src/uu/mktemp/src/mktemp.rs b/src/uu/mktemp/src/mktemp.rs index 3efd0690188..eaa185157f6 100644 --- a/src/uu/mktemp/src/mktemp.rs +++ b/src/uu/mktemp/src/mktemp.rs @@ -7,8 +7,8 @@ use clap::builder::{TypedValueParser, ValueParserFactory}; use clap::{Arg, ArgAction, ArgMatches, Command}; -use uucore::display::{Quotable, println_verbatim}; -use uucore::error::{FromIo, UError, UResult, UUsageError}; +use uucore::display::{Quotable as _, println_verbatim}; +use uucore::error::{FromIo as _, UError, UResult, UUsageError}; use uucore::format_usage; use uucore::translate; @@ -21,9 +21,9 @@ use std::path::{MAIN_SEPARATOR, Path, PathBuf}; #[cfg(unix)] use std::fs; #[cfg(unix)] -use std::os::unix::prelude::PermissionsExt; +use std::os::unix::prelude::PermissionsExt as _; -use rand::Rng; +use rand::Rng as _; use tempfile::Builder; use thiserror::Error; diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index f31521a6e08..344afe8bedd 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -6,7 +6,7 @@ use std::{ ffi::OsString, fs::File, - io::{BufRead, BufReader, Stdin, Stdout, Write, stdin, stdout}, + io::{BufRead as _, BufReader, Stdin, Stdout, Write, stdin, stdout}, panic::set_hook, path::{Path, PathBuf}, time::Duration, @@ -14,8 +14,8 @@ use std::{ use clap::{Arg, ArgAction, ArgMatches, Command, value_parser}; use crossterm::{ - ExecutableCommand, - QueueableCommand, // spell-checker:disable-line + ExecutableCommand as _, + QueueableCommand as _, // spell-checker:disable-line cursor::{Hide, MoveTo, Show}, event::{self, Event, KeyCode, KeyEvent, KeyEventKind, KeyModifiers}, style::Attribute, @@ -25,7 +25,7 @@ use crossterm::{ use uucore::error::{UResult, USimpleError, UUsageError}; use uucore::format_usage; -use uucore::{display::Quotable, show}; +use uucore::{display::Quotable as _, show}; use uucore::translate; @@ -894,7 +894,7 @@ impl<'a> Pager<'a> { #[cfg(test)] mod tests { use std::{ - io::Seek, + io::Seek as _, ops::{Deref, DerefMut}, }; diff --git a/src/uu/nice/src/nice.rs b/src/uu/nice/src/nice.rs index 1abb7e96ff1..ba7553ac576 100644 --- a/src/uu/nice/src/nice.rs +++ b/src/uu/nice/src/nice.rs @@ -8,9 +8,9 @@ use clap::{Arg, ArgAction, Command}; use libc::PRIO_PROCESS; use std::ffi::OsString; -use std::io::{Error, ErrorKind, Write, stdout}; +use std::io::{Error, ErrorKind, Write as _, stdout}; use std::num::IntErrorKind; -use std::os::unix::process::CommandExt; +use std::os::unix::process::CommandExt as _; use std::process; use uucore::translate; diff --git a/src/uu/nl/src/nl.rs b/src/uu/nl/src/nl.rs index 4fd323c260a..2afdf49033a 100644 --- a/src/uu/nl/src/nl.rs +++ b/src/uu/nl/src/nl.rs @@ -6,10 +6,10 @@ use clap::{Arg, ArgAction, Command}; use std::ffi::{OsStr, OsString}; use std::fs::File; -use std::io::{BufRead, BufReader, BufWriter, Read, Write, stdin, stdout}; +use std::io::{BufRead as _, BufReader, BufWriter, Read, Write, stdin, stdout}; use std::path::Path; -use uucore::display::Quotable; -use uucore::error::{FromIo, UResult, USimpleError, set_exit_code}; +use uucore::display::Quotable as _; +use uucore::error::{FromIo as _, UResult, USimpleError, set_exit_code}; use uucore::{format_usage, show_error, translate}; mod helper; diff --git a/src/uu/nohup/src/nohup.rs b/src/uu/nohup/src/nohup.rs index 6280d44e1e3..138f17f1876 100644 --- a/src/uu/nohup/src/nohup.rs +++ b/src/uu/nohup/src/nohup.rs @@ -9,13 +9,13 @@ use clap::{Arg, ArgAction, Command}; use libc::{SIG_IGN, SIGHUP, dup2, signal}; use std::env; use std::fs::{File, OpenOptions}; -use std::io::{Error, ErrorKind, IsTerminal}; +use std::io::{Error, ErrorKind, IsTerminal as _}; use std::os::unix::prelude::*; -use std::os::unix::process::CommandExt; +use std::os::unix::process::CommandExt as _; use std::path::{Path, PathBuf}; use std::process; use thiserror::Error; -use uucore::display::Quotable; +use uucore::display::Quotable as _; use uucore::error::{UError, UResult, set_exit_code}; use uucore::translate; use uucore::{format_usage, show_error}; diff --git a/src/uu/nproc/src/nproc.rs b/src/uu/nproc/src/nproc.rs index 615a705948c..87bf329b5fc 100644 --- a/src/uu/nproc/src/nproc.rs +++ b/src/uu/nproc/src/nproc.rs @@ -6,9 +6,9 @@ // spell-checker:ignore (ToDO) NPROCESSORS nprocs numstr sysconf use clap::{Arg, ArgAction, Command}; -use std::io::{Write, stdout}; +use std::io::{Write as _, stdout}; use std::{env, thread}; -use uucore::display::Quotable; +use uucore::display::Quotable as _; use uucore::error::{UResult, USimpleError}; use uucore::format_usage; use uucore::translate; diff --git a/src/uu/numfmt/src/format.rs b/src/uu/numfmt/src/format.rs index b6946cdf8c4..16115164560 100644 --- a/src/uu/numfmt/src/format.rs +++ b/src/uu/numfmt/src/format.rs @@ -3,7 +3,7 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. // spell-checker:ignore powf -use uucore::display::Quotable; +use uucore::display::Quotable as _; use uucore::translate; use crate::options::{NumfmtOptions, RoundMethod, TransformOptions}; diff --git a/src/uu/numfmt/src/numfmt.rs b/src/uu/numfmt/src/numfmt.rs index 69f1257f6cf..eec35e1f6b2 100644 --- a/src/uu/numfmt/src/numfmt.rs +++ b/src/uu/numfmt/src/numfmt.rs @@ -14,12 +14,12 @@ use crate::options::{ use crate::units::{Result, Unit}; use clap::{Arg, ArgAction, ArgMatches, Command, builder::ValueParser, parser::ValueSource}; use std::ffi::OsString; -use std::io::{BufRead, Error, Write, stderr}; +use std::io::{BufRead, Error, Write as _, stderr}; use std::result::Result as StdResult; -use std::str::FromStr; +use std::str::FromStr as _; use units::{IEC_BASES, SI_BASES}; -use uucore::display::Quotable; +use uucore::display::Quotable as _; use uucore::error::UResult; use uucore::parser::shortcut_value_parser::ShortcutValueParser; diff --git a/src/uu/od/src/byteorder_io.rs b/src/uu/od/src/byteorder_io.rs index 8cc7a8bac05..bbc3e4927b4 100644 --- a/src/uu/od/src/byteorder_io.rs +++ b/src/uu/od/src/byteorder_io.rs @@ -7,7 +7,7 @@ // workaround until https://github.com/BurntSushi/byteorder/issues/41 has been fixed // based on: https://github.com/netvl/immeta/blob/4460ee/src/utils.rs#L76 -use byteorder::ByteOrder as ByteOrderTrait; +use byteorder::ByteOrder as _; use byteorder::{BigEndian, LittleEndian, NativeEndian}; #[derive(Copy, Clone, Debug, Eq, PartialEq)] diff --git a/src/uu/od/src/multifile_reader.rs b/src/uu/od/src/multifile_reader.rs index 48e1f1225db..87ab1053a43 100644 --- a/src/uu/od/src/multifile_reader.rs +++ b/src/uu/od/src/multifile_reader.rs @@ -7,9 +7,9 @@ use std::fs::File; use std::io; #[cfg(unix)] -use std::os::fd::{AsRawFd, FromRawFd}; +use std::os::fd::{AsRawFd as _, FromRawFd as _}; -use uucore::display::Quotable; +use uucore::display::Quotable as _; use uucore::show_error; pub enum InputSource<'a> { @@ -154,7 +154,7 @@ impl HasError for MultifileReader<'_> { mod tests { use super::*; use crate::mockstream::*; - use std::io::{Cursor, ErrorKind, Read}; + use std::io::{Cursor, ErrorKind, Read as _}; #[test] fn test_multi_file_reader_one_read() { diff --git a/src/uu/od/src/od.rs b/src/uu/od/src/od.rs index 4da705aae59..4e78debe47c 100644 --- a/src/uu/od/src/od.rs +++ b/src/uu/od/src/od.rs @@ -25,8 +25,8 @@ mod prn_float; mod prn_int; use std::cmp; -use std::fmt::Write; -use std::io::{BufReader, Read, Write as IoWrite}; +use std::fmt::Write as _; +use std::io::{BufReader, Read as _, Write as IoWrite}; use crate::byteorder_io::ByteOrder; use crate::formatter_item_info::FormatWriter; @@ -42,7 +42,7 @@ use crate::peek_reader::{PeekRead, PeekReader}; use crate::prn_char::format_ascii_dump; use clap::ArgAction; use clap::{Arg, ArgMatches, Command, parser::ValueSource}; -use uucore::display::Quotable; +use uucore::display::Quotable as _; use uucore::error::{UResult, USimpleError}; use uucore::translate; diff --git a/src/uu/od/src/parse_formats.rs b/src/uu/od/src/parse_formats.rs index 1103b77cac3..ba0194d7238 100644 --- a/src/uu/od/src/parse_formats.rs +++ b/src/uu/od/src/parse_formats.rs @@ -4,7 +4,7 @@ // file that was distributed with this source code. // spell-checker:ignore formatteriteminfo docopt fvox fvoxw vals acdx -use uucore::display::Quotable; +use uucore::display::Quotable as _; use uucore::translate; use crate::formatter_item_info::FormatterItemInfo; diff --git a/src/uu/od/src/partial_reader.rs b/src/uu/od/src/partial_reader.rs index 31367181a85..079f5e5eb1f 100644 --- a/src/uu/od/src/partial_reader.rs +++ b/src/uu/od/src/partial_reader.rs @@ -101,7 +101,7 @@ impl HasError for PartialReader { mod tests { use super::*; use crate::mockstream::*; - use std::io::{Cursor, ErrorKind, Read}; + use std::io::{Cursor, ErrorKind, Read as _}; #[test] fn test_read_without_limits() { diff --git a/src/uu/od/src/peek_reader.rs b/src/uu/od/src/peek_reader.rs index 6287306ef76..6af251e2197 100644 --- a/src/uu/od/src/peek_reader.rs +++ b/src/uu/od/src/peek_reader.rs @@ -8,7 +8,7 @@ //! Contains the trait `PeekRead` and type `PeekReader` implementing it. use std::io; -use std::io::{Read, Write}; +use std::io::{Read, Write as _}; use crate::multifile_reader::HasError; @@ -119,7 +119,7 @@ impl HasError for PeekReader { #[cfg(test)] mod tests { use super::*; - use std::io::{Cursor, Read}; + use std::io::{Cursor, Read as _}; #[test] fn test_read_normal() { diff --git a/src/uu/paste/src/paste.rs b/src/uu/paste/src/paste.rs index 5d6ae5ed93d..f05d601cac7 100644 --- a/src/uu/paste/src/paste.rs +++ b/src/uu/paste/src/paste.rs @@ -7,7 +7,7 @@ use clap::{Arg, ArgAction, Command}; use std::cell::{OnceCell, RefCell}; use std::ffi::OsString; use std::fs::File; -use std::io::{BufRead, BufReader, Stdin, Write, stdin, stdout}; +use std::io::{BufRead as _, BufReader, Stdin, Write as _, stdin, stdout}; use std::iter::Cycle; use std::path::Path; use std::rc::Rc; diff --git a/src/uu/pathchk/src/pathchk.rs b/src/uu/pathchk/src/pathchk.rs index d0a35c33160..e9dd06c2b42 100644 --- a/src/uu/pathchk/src/pathchk.rs +++ b/src/uu/pathchk/src/pathchk.rs @@ -8,8 +8,8 @@ use clap::{Arg, ArgAction, Command}; use std::ffi::OsString; use std::fs; -use std::io::{ErrorKind, Write}; -use uucore::display::Quotable; +use std::io::{ErrorKind, Write as _}; +use uucore::display::Quotable as _; use uucore::error::{UResult, UUsageError, set_exit_code}; use uucore::format_usage; use uucore::translate; diff --git a/src/uu/pinky/src/platform/unix.rs b/src/uu/pinky/src/platform/unix.rs index 486f8b3ca09..f0cd7273a43 100644 --- a/src/uu/pinky/src/platform/unix.rs +++ b/src/uu/pinky/src/platform/unix.rs @@ -5,11 +5,11 @@ // spell-checker:ignore (ToDO) BUFSIZE gecos fullname, mesg iobuf -use crate::Capitalize; +use crate::Capitalize as _; use crate::options; use crate::uu_app; -use uucore::entries::{Locate, Passwd}; +use uucore::entries::{Locate as _, Passwd}; use uucore::error::UResult; use uucore::libc::S_IWGRP; use uucore::translate; @@ -19,7 +19,7 @@ use std::io::BufReader; use std::io::prelude::*; use std::fs::File; -use std::os::unix::fs::MetadataExt; +use std::os::unix::fs::MetadataExt as _; use std::path::PathBuf; diff --git a/src/uu/pr/src/pr.rs b/src/uu/pr/src/pr.rs index 25a1e2e3e96..860c0af0f1e 100644 --- a/src/uu/pr/src/pr.rs +++ b/src/uu/pr/src/pr.rs @@ -7,15 +7,15 @@ // spell-checker:ignore (ToDO) adFfmprt, kmerge use clap::{Arg, ArgAction, ArgMatches, Command}; -use itertools::Itertools; +use itertools::Itertools as _; use regex::Regex; use std::fs::metadata; -use std::io::{Read, Write, stderr, stdin, stdout}; +use std::io::{Read as _, Write, stderr, stdin, stdout}; use std::string::FromUtf8Error; use std::time::SystemTime; use thiserror::Error; -use uucore::display::Quotable; +use uucore::display::Quotable as _; use uucore::error::UResult; use uucore::format_usage; use uucore::time::{FormatSystemTimeFallback, format, format_system_time}; diff --git a/src/uu/printenv/src/printenv.rs b/src/uu/printenv/src/printenv.rs index bfdf6934cd7..f7099797484 100644 --- a/src/uu/printenv/src/printenv.rs +++ b/src/uu/printenv/src/printenv.rs @@ -4,11 +4,11 @@ // file that was distributed with this source code. use std::env; -use std::io::Write; +use std::io::Write as _; use clap::{Arg, ArgAction, Command}; -use uucore::display::{OsWrite, print_all_env_vars}; +use uucore::display::{OsWrite as _, print_all_env_vars}; use uucore::error::UResult; use uucore::line_ending::LineEnding; use uucore::{format_usage, translate}; diff --git a/src/uu/printf/src/printf.rs b/src/uu/printf/src/printf.rs index 69be56c911d..c30fbafcae4 100644 --- a/src/uu/printf/src/printf.rs +++ b/src/uu/printf/src/printf.rs @@ -6,7 +6,7 @@ use clap::{Arg, ArgAction, Command}; use std::ffi::OsString; use std::io::stdout; use std::ops::ControlFlow; -use uucore::display::Quotable; +use uucore::display::Quotable as _; use uucore::error::{UResult, UUsageError}; use uucore::format::{FormatArgument, FormatArguments, FormatItem, parse_spec_and_escape}; use uucore::translate; diff --git a/src/uu/ptx/src/ptx.rs b/src/uu/ptx/src/ptx.rs index 7749ecc998a..22788b06e2b 100644 --- a/src/uu/ptx/src/ptx.rs +++ b/src/uu/ptx/src/ptx.rs @@ -9,7 +9,7 @@ use std::cmp; use std::cmp::PartialEq; use std::collections::{BTreeSet, HashSet}; use std::ffi::{OsStr, OsString}; -use std::fmt::Write as FmtWrite; +use std::fmt::Write as _; use std::fs::File; use std::io::{BufRead, BufReader, BufWriter, Read, Write, stdin, stdout}; use std::num::ParseIntError; @@ -18,8 +18,8 @@ use std::path::Path; use clap::{Arg, ArgAction, Command}; use regex::Regex; use thiserror::Error; -use uucore::display::Quotable; -use uucore::error::{FromIo, UError, UResult, USimpleError, UUsageError}; +use uucore::display::Quotable as _; +use uucore::error::{FromIo as _, UError, UResult, USimpleError, UUsageError}; use uucore::format_usage; use uucore::translate; diff --git a/src/uu/pwd/src/pwd.rs b/src/uu/pwd/src/pwd.rs index cefdee8986f..b7fca88d166 100644 --- a/src/uu/pwd/src/pwd.rs +++ b/src/uu/pwd/src/pwd.rs @@ -11,7 +11,7 @@ use std::path::PathBuf; use uucore::format_usage; use uucore::display::println_verbatim; -use uucore::error::{FromIo, UResult}; +use uucore::error::{FromIo as _, UResult}; use uucore::translate; const OPT_LOGICAL: &str = "logical"; @@ -81,7 +81,7 @@ fn logical_path() -> io::Result { #[cfg(unix)] { use std::fs::metadata; - use std::os::unix::fs::MetadataExt; + use std::os::unix::fs::MetadataExt as _; match (metadata(path), metadata(".")) { (Ok(info1), Ok(info2)) => { info1.dev() == info2.dev() && info1.ino() == info2.ino() diff --git a/src/uu/readlink/src/readlink.rs b/src/uu/readlink/src/readlink.rs index f220d6a0515..2ebaee08e1c 100644 --- a/src/uu/readlink/src/readlink.rs +++ b/src/uu/readlink/src/readlink.rs @@ -8,10 +8,10 @@ use clap::{Arg, ArgAction, Command}; use std::ffi::OsString; use std::fs; -use std::io::{Write, stdout}; +use std::io::{Write as _, stdout}; use std::path::{Path, PathBuf}; -use uucore::display::Quotable; -use uucore::error::{FromIo, UResult, UUsageError}; +use uucore::display::Quotable as _; +use uucore::error::{FromIo as _, UResult, UUsageError}; use uucore::fs::{MissingHandling, ResolveMode, canonicalize}; use uucore::libc::EINVAL; use uucore::line_ending::LineEnding; diff --git a/src/uu/realpath/src/realpath.rs b/src/uu/realpath/src/realpath.rs index 43bfa78adbb..60e31799cd8 100644 --- a/src/uu/realpath/src/realpath.rs +++ b/src/uu/realpath/src/realpath.rs @@ -11,14 +11,14 @@ use clap::{ }; use std::{ ffi::{OsStr, OsString}, - io::{Write, stdout}, + io::{Write as _, stdout}, path::{Path, PathBuf}, }; use uucore::fs::make_path_relative_to; use uucore::translate; use uucore::{ - display::{Quotable, print_verbatim}, - error::{FromIo, UResult}, + display::{Quotable as _, print_verbatim}, + error::{FromIo as _, UResult}, format_usage, fs::{MissingHandling, ResolveMode, canonicalize}, line_ending::LineEnding, diff --git a/src/uu/rm/src/platform/unix.rs b/src/uu/rm/src/platform/unix.rs index e890ab15823..e3d0237ce48 100644 --- a/src/uu/rm/src/platform/unix.rs +++ b/src/uu/rm/src/platform/unix.rs @@ -10,11 +10,11 @@ use indicatif::ProgressBar; use std::ffi::OsStr; use std::fs; -use std::io::{IsTerminal, stdin}; -use std::os::unix::fs::PermissionsExt; +use std::io::{IsTerminal as _, stdin}; +use std::os::unix::fs::PermissionsExt as _; use std::path::Path; -use uucore::display::Quotable; -use uucore::error::FromIo; +use uucore::display::Quotable as _; +use uucore::error::FromIo as _; use uucore::prompt_yes; use uucore::safe_traversal::DirFd; use uucore::show_error; diff --git a/src/uu/rm/src/rm.rs b/src/uu/rm/src/rm.rs index b1c7d1dedb8..23b7b8520ec 100644 --- a/src/uu/rm/src/rm.rs +++ b/src/uu/rm/src/rm.rs @@ -10,17 +10,17 @@ use clap::{Arg, ArgAction, Command, parser::ValueSource}; use indicatif::{ProgressBar, ProgressStyle}; use std::ffi::{OsStr, OsString}; use std::fs::{self, Metadata}; -use std::io::{self, IsTerminal, stdin}; -use std::ops::BitOr; +use std::io::{self, IsTerminal as _, stdin}; +use std::ops::BitOr as _; #[cfg(unix)] -use std::os::unix::ffi::OsStrExt; +use std::os::unix::ffi::OsStrExt as _; #[cfg(unix)] -use std::os::unix::fs::PermissionsExt; +use std::os::unix::fs::PermissionsExt as _; use std::path::MAIN_SEPARATOR; use std::path::Path; use thiserror::Error; -use uucore::display::Quotable; -use uucore::error::{FromIo, UError, UResult}; +use uucore::display::Quotable as _; +use uucore::error::{FromIo as _, UError, UResult}; use uucore::parser::shortcut_value_parser::ShortcutValueParser; use uucore::translate; use uucore::{format_usage, os_str_as_bytes, prompt_yes, show_error}; diff --git a/src/uu/rmdir/src/rmdir.rs b/src/uu/rmdir/src/rmdir.rs index e0c9f73bcec..d0c0fa44aad 100644 --- a/src/uu/rmdir/src/rmdir.rs +++ b/src/uu/rmdir/src/rmdir.rs @@ -11,7 +11,7 @@ use std::ffi::OsString; use std::fs::{read_dir, remove_dir}; use std::io; use std::path::Path; -use uucore::display::Quotable; +use uucore::display::Quotable as _; use uucore::error::{UResult, set_exit_code, strip_errno}; use uucore::translate; @@ -60,7 +60,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { #[cfg(unix)] { use std::ffi::OsStr; - use std::os::unix::ffi::OsStrExt; + use std::os::unix::ffi::OsStrExt as _; fn points_to_directory(path: &Path) -> io::Result { Ok(path.metadata()?.file_type().is_dir()) diff --git a/src/uu/seq/src/error.rs b/src/uu/seq/src/error.rs index 2fd92938c10..4a2cde5fdbb 100644 --- a/src/uu/seq/src/error.rs +++ b/src/uu/seq/src/error.rs @@ -6,7 +6,7 @@ //! Errors returned by seq. use crate::numberparse::ParseNumberError; use thiserror::Error; -use uucore::display::Quotable; +use uucore::display::Quotable as _; use uucore::error::UError; use uucore::translate; diff --git a/src/uu/seq/src/number.rs b/src/uu/seq/src/number.rs index f23e42b1cf8..363fc740b9c 100644 --- a/src/uu/seq/src/number.rs +++ b/src/uu/seq/src/number.rs @@ -3,7 +3,7 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. // spell-checker:ignore extendedbigdecimal -use num_traits::Zero; +use num_traits::Zero as _; use uucore::extendedbigdecimal::ExtendedBigDecimal; diff --git a/src/uu/seq/src/numberparse.rs b/src/uu/seq/src/numberparse.rs index ba4ab4e4eba..c1347681a76 100644 --- a/src/uu/seq/src/numberparse.rs +++ b/src/uu/seq/src/numberparse.rs @@ -9,7 +9,7 @@ //! [`PreciseNumber`] struct. use std::str::FromStr; -use uucore::parser::num_parser::{ExtendedParser, ExtendedParserError}; +use uucore::parser::num_parser::{ExtendedParser as _, ExtendedParserError}; use crate::number::PreciseNumber; use uucore::extendedbigdecimal::ExtendedBigDecimal; diff --git a/src/uu/seq/src/seq.rs b/src/uu/seq/src/seq.rs index 24f76423b56..6323063ae6b 100644 --- a/src/uu/seq/src/seq.rs +++ b/src/uu/seq/src/seq.rs @@ -8,10 +8,10 @@ use std::io::{BufWriter, Write, stdout}; use clap::{Arg, ArgAction, Command}; use num_bigint::BigUint; -use num_traits::ToPrimitive; +use num_traits::ToPrimitive as _; use num_traits::Zero; -use uucore::error::{FromIo, UResult}; +use uucore::error::{FromIo as _, UResult}; use uucore::extendedbigdecimal::ExtendedBigDecimal; use uucore::format::num_format::FloatVariant; use uucore::format::{Format, num_format}; diff --git a/src/uu/shred/src/shred.rs b/src/uu/shred/src/shred.rs index 0b05a3a35f7..b402681dfde 100644 --- a/src/uu/shred/src/shred.rs +++ b/src/uu/shred/src/shred.rs @@ -8,16 +8,16 @@ use clap::{Arg, ArgAction, Command}; #[cfg(unix)] use libc::S_IWUSR; -use rand::{Rng, SeedableRng, rngs::StdRng, seq::SliceRandom}; +use rand::{Rng as _, SeedableRng as _, rngs::StdRng, seq::SliceRandom as _}; use std::cell::RefCell; use std::ffi::OsString; use std::fs::{self, File, OpenOptions}; -use std::io::{self, Read, Seek, SeekFrom, Write}; +use std::io::{self, Read as _, Seek as _, SeekFrom, Write as _}; #[cfg(unix)] -use std::os::unix::prelude::PermissionsExt; +use std::os::unix::prelude::PermissionsExt as _; use std::path::{Path, PathBuf}; -use uucore::display::Quotable; -use uucore::error::{FromIo, UResult, USimpleError, UUsageError}; +use uucore::display::Quotable as _; +use uucore::error::{FromIo as _, UResult, USimpleError, UUsageError}; use uucore::parser::parse_size::parse_size_u64; use uucore::parser::shortcut_value_parser::ShortcutValueParser; use uucore::translate; diff --git a/src/uu/shuf/src/compat_random_source.rs b/src/uu/shuf/src/compat_random_source.rs index 73a7191be73..16e0fb18548 100644 --- a/src/uu/shuf/src/compat_random_source.rs +++ b/src/uu/shuf/src/compat_random_source.rs @@ -5,7 +5,7 @@ use std::{io::BufRead, ops::RangeInclusive}; -use uucore::error::{FromIo, UResult, USimpleError}; +use uucore::error::{FromIo as _, UResult, USimpleError}; use uucore::translate; /// A uniform integer generator that tries to exactly match GNU shuf's --random-source. diff --git a/src/uu/shuf/src/shuf.rs b/src/uu/shuf/src/shuf.rs index f0caf445d9b..6e4223b48d6 100644 --- a/src/uu/shuf/src/shuf.rs +++ b/src/uu/shuf/src/shuf.rs @@ -7,20 +7,20 @@ use std::ffi::{OsStr, OsString}; use std::fs::File; -use std::io::{self, BufReader, BufWriter, Read, Write, stdin, stdout}; +use std::io::{self, BufReader, BufWriter, Read as _, Write as _, stdin, stdout}; use std::ops::RangeInclusive; use std::path::{Path, PathBuf}; -use std::str::FromStr; +use std::str::FromStr as _; use clap::{Arg, ArgAction, Command, builder::ValueParser}; use rand::rngs::ThreadRng; use rand::{ - Rng, - seq::{IndexedRandom, SliceRandom}, + Rng as _, + seq::{IndexedRandom as _, SliceRandom as _}, }; -use uucore::display::{OsWrite, Quotable}; -use uucore::error::{FromIo, UResult, USimpleError, UUsageError}; +use uucore::display::{OsWrite, Quotable as _}; +use uucore::error::{FromIo as _, UResult, USimpleError, UUsageError}; use uucore::format_usage; use uucore::translate; @@ -390,7 +390,7 @@ impl Writable for u64 { #[cold] #[inline(never)] fn handle_write_error(e: io::Error) -> Box { - use uucore::error::FromIo; + use uucore::error::FromIo as _; let ctx = translate!("shuf-error-write-failed"); e.map_err_context(move || ctx) } diff --git a/src/uu/sort/src/check.rs b/src/uu/sort/src/check.rs index dbf598574fe..f210015902c 100644 --- a/src/uu/sort/src/check.rs +++ b/src/uu/sort/src/check.rs @@ -10,7 +10,7 @@ use crate::{ chunks::{self, Chunk, RecycledChunk}, compare_by, open, }; -use itertools::Itertools; +use itertools::Itertools as _; use std::{ cmp::Ordering, ffi::OsStr, diff --git a/src/uu/sort/src/ext_sort.rs b/src/uu/sort/src/ext_sort.rs index d61f7d2008d..39e50c2610a 100644 --- a/src/uu/sort/src/ext_sort.rs +++ b/src/uu/sort/src/ext_sort.rs @@ -19,12 +19,12 @@ use std::{ thread, }; -use itertools::Itertools; +use itertools::Itertools as _; use uucore::error::{UResult, strip_errno}; use crate::Output; use crate::chunks::RecycledChunk; -use crate::merge::ClosedTmpFile; +use crate::merge::ClosedTmpFile as _; use crate::merge::WriteableCompressedTmpFile; use crate::merge::WriteablePlainTmpFile; use crate::merge::WriteableTmpFile; diff --git a/src/uu/sort/src/merge.rs b/src/uu/sort/src/merge.rs index 39465827e15..d3d6e1d7577 100644 --- a/src/uu/sort/src/merge.rs +++ b/src/uu/sort/src/merge.rs @@ -25,7 +25,7 @@ use std::{ }; use compare::Compare; -use uucore::error::{FromIo, UResult}; +use uucore::error::{FromIo as _, UResult}; use crate::{ GlobalSettings, Output, SortError, diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index ceaf5125612..506130e7532 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -27,31 +27,31 @@ use custom_str_cmp::custom_str_cmp; use ext_sort::ext_sort; use fnv::FnvHasher; use numeric_str_cmp::{NumInfo, NumInfoParseSettings, human_numeric_str_cmp, numeric_str_cmp}; -use rand::{Rng, rng}; +use rand::{Rng as _, rng}; use rayon::prelude::*; use std::cmp::Ordering; use std::env; use std::ffi::{OsStr, OsString}; use std::fs::{File, OpenOptions}; -use std::hash::{Hash, Hasher}; -use std::io::{BufRead, BufReader, BufWriter, Read, Write, stdin, stdout}; +use std::hash::{Hash, Hasher as _}; +use std::io::{BufRead as _, BufReader, BufWriter, Read, Write, stdin, stdout}; use std::num::{IntErrorKind, NonZero}; use std::ops::Range; #[cfg(unix)] -use std::os::unix::ffi::OsStrExt; +use std::os::unix::ffi::OsStrExt as _; use std::path::Path; use std::path::PathBuf; use std::str::Utf8Error; use thiserror::Error; -use uucore::display::Quotable; -use uucore::error::{FromIo, strip_errno}; +use uucore::display::Quotable as _; +use uucore::error::{FromIo as _, strip_errno}; use uucore::error::{UError, UResult, USimpleError, UUsageError}; use uucore::extendedbigdecimal::ExtendedBigDecimal; #[cfg(feature = "i18n-collator")] use uucore::i18n::collator::locale_cmp; use uucore::i18n::decimal::locale_decimal_separator; use uucore::line_ending::LineEnding; -use uucore::parser::num_parser::{ExtendedParser, ExtendedParserError}; +use uucore::parser::num_parser::{ExtendedParser as _, ExtendedParserError}; use uucore::parser::parse_size::{ParseSizeError, Parser}; use uucore::parser::shortcut_value_parser::ShortcutValueParser; use uucore::posix::{MODERN, TRADITIONAL}; diff --git a/src/uu/split/src/filenames.rs b/src/uu/split/src/filenames.rs index 83b43943bed..effbb07cd04 100644 --- a/src/uu/split/src/filenames.rs +++ b/src/uu/split/src/filenames.rs @@ -42,7 +42,7 @@ use clap::ArgMatches; use std::ffi::{OsStr, OsString}; use std::path::is_separator; use thiserror::Error; -use uucore::display::Quotable; +use uucore::display::Quotable as _; use uucore::error::{UResult, USimpleError}; use uucore::translate; diff --git a/src/uu/split/src/split.rs b/src/uu/split/src/split.rs index 6e1a8227900..05a7007c777 100644 --- a/src/uu/split/src/split.rs +++ b/src/uu/split/src/split.rs @@ -17,11 +17,11 @@ use std::env; use std::ffi::OsString; use std::fs::{File, metadata}; use std::io; -use std::io::{BufRead, BufReader, BufWriter, ErrorKind, Read, Seek, SeekFrom, Write, stdin}; +use std::io::{BufRead, BufReader, BufWriter, ErrorKind, Read, Seek as _, SeekFrom, Write, stdin}; use std::path::Path; use thiserror::Error; -use uucore::display::Quotable; -use uucore::error::{FromIo, UIoError, UResult, USimpleError, UUsageError}; +use uucore::display::Quotable as _; +use uucore::error::{FromIo as _, UIoError, UResult, USimpleError, UUsageError}; use uucore::translate; use uucore::parser::parse_size::parse_size_u64; diff --git a/src/uu/split/src/strategy.rs b/src/uu/split/src/strategy.rs index 6d567637d07..6a72f4cd0c3 100644 --- a/src/uu/split/src/strategy.rs +++ b/src/uu/split/src/strategy.rs @@ -9,7 +9,7 @@ use crate::{OPT_BYTES, OPT_LINE_BYTES, OPT_LINES, OPT_NUMBER}; use clap::{ArgMatches, parser::ValueSource}; use thiserror::Error; use uucore::{ - display::Quotable, + display::Quotable as _, parser::parse_size::{ParseSizeError, parse_size_u64, parse_size_u64_max}, translate, }; diff --git a/src/uu/stat/src/stat.rs b/src/uu/stat/src/stat.rs index 8e044ed77ec..742ae850b23 100644 --- a/src/uu/stat/src/stat.rs +++ b/src/uu/stat/src/stat.rs @@ -8,10 +8,10 @@ use uucore::error::{UError, UResult, USimpleError}; use uucore::translate; use clap::builder::ValueParser; -use uucore::display::Quotable; +use uucore::display::Quotable as _; use uucore::fs::{display_permissions, major, minor}; use uucore::fsext::{ - FsMeta, MetadataTimeField, StatFs, metadata_get_time, pretty_filetype, pretty_fstype, + FsMeta as _, MetadataTimeField, StatFs, metadata_get_time, pretty_filetype, pretty_fstype, read_fs_list, statfs, }; use uucore::libc::mode_t; @@ -22,7 +22,7 @@ use std::borrow::Cow; use std::ffi::{OsStr, OsString}; use std::fs::{FileType, Metadata}; use std::io::Write; -use std::os::unix::fs::{FileTypeExt, MetadataExt}; +use std::os::unix::fs::{FileTypeExt as _, MetadataExt as _}; use std::path::Path; use std::{env, fs}; @@ -418,7 +418,7 @@ fn print_str(s: &str, flags: Flags, width: usize, precision: Precision) { fn print_os_str(s: &OsString, flags: Flags, width: usize, precision: Precision) { #[cfg(unix)] { - use std::os::unix::ffi::OsStrExt; + use std::os::unix::ffi::OsStrExt as _; let bytes = s.as_bytes(); @@ -1408,7 +1408,7 @@ fn pretty_time(meta: &Metadata, md_time_field: MetadataTimeField) -> String { mod tests { use crate::{pad_and_print_bytes, quote_file_name, write_padding}; - use super::{Flags, Precision, ScanUtil, Stater, Token, group_num, precision_trunc}; + use super::{Flags, Precision, ScanUtil as _, Stater, Token, group_num, precision_trunc}; #[test] fn test_scanners() { diff --git a/src/uu/stdbuf/src/stdbuf.rs b/src/uu/stdbuf/src/stdbuf.rs index bffe1f7b145..f65e59b0a36 100644 --- a/src/uu/stdbuf/src/stdbuf.rs +++ b/src/uu/stdbuf/src/stdbuf.rs @@ -8,7 +8,7 @@ use clap::{Arg, ArgAction, ArgMatches, Command}; use std::ffi::OsString; #[cfg(unix)] -use std::os::unix::process::CommandExt; +use std::os::unix::process::CommandExt as _; use std::path::PathBuf; use std::process; use tempfile::TempDir; diff --git a/src/uu/stty/src/stty.rs b/src/uu/stty/src/stty.rs index af54db3e9fe..61f63f15ec0 100644 --- a/src/uu/stty/src/stty.rs +++ b/src/uu/stty/src/stty.rs @@ -34,11 +34,11 @@ use std::fs::File; use std::io::{self, Stdin, stdin, stdout}; use std::num::IntErrorKind; use std::os::fd::{AsFd, BorrowedFd}; -use std::os::unix::fs::OpenOptionsExt; +use std::os::unix::fs::OpenOptionsExt as _; use std::os::unix::io::{AsRawFd, RawFd}; -use uucore::error::{FromIo, UError, UResult, USimpleError, UUsageError}; +use uucore::error::{FromIo as _, UError, UResult, USimpleError, UUsageError}; use uucore::format_usage; -use uucore::parser::num_parser::ExtendedParser; +use uucore::parser::num_parser::ExtendedParser as _; use uucore::translate; #[cfg(not(bsd))] diff --git a/src/uu/sum/src/sum.rs b/src/uu/sum/src/sum.rs index 70c40b15cf2..67185fa4b12 100644 --- a/src/uu/sum/src/sum.rs +++ b/src/uu/sum/src/sum.rs @@ -8,10 +8,10 @@ use clap::{Arg, ArgAction, Command}; use std::ffi::OsString; use std::fs::File; -use std::io::{ErrorKind, Read, Write, stdin, stdout}; +use std::io::{ErrorKind, Read, Write as _, stdin, stdout}; use std::path::Path; -use uucore::display::{OsWrite, Quotable}; -use uucore::error::{FromIo, UResult, USimpleError}; +use uucore::display::{OsWrite as _, Quotable as _}; +use uucore::error::{FromIo as _, UResult, USimpleError}; use uucore::translate; use uucore::{format_usage, show}; diff --git a/src/uu/sync/src/sync.rs b/src/uu/sync/src/sync.rs index 0e5b864b9cd..443f661a83e 100644 --- a/src/uu/sync/src/sync.rs +++ b/src/uu/sync/src/sync.rs @@ -13,7 +13,7 @@ use nix::fcntl::{OFlag, open}; #[cfg(any(target_os = "linux", target_os = "android"))] use nix::sys::stat::Mode; use std::path::Path; -use uucore::display::Quotable; +use uucore::display::Quotable as _; #[cfg(any(target_os = "linux", target_os = "android"))] use uucore::error::FromIo; use uucore::error::{UResult, USimpleError}; diff --git a/src/uu/tac/src/error.rs b/src/uu/tac/src/error.rs index 098e997d4af..88853e02c58 100644 --- a/src/uu/tac/src/error.rs +++ b/src/uu/tac/src/error.rs @@ -6,7 +6,7 @@ use std::ffi::OsString; use thiserror::Error; -use uucore::display::Quotable; +use uucore::display::Quotable as _; use uucore::error::UError; use uucore::translate; diff --git a/src/uu/tac/src/tac.rs b/src/uu/tac/src/tac.rs index ec8ae450344..e8a44c50ab7 100644 --- a/src/uu/tac/src/tac.rs +++ b/src/uu/tac/src/tac.rs @@ -11,7 +11,7 @@ use clap::{Arg, ArgAction, Command}; use memchr::memmem; use memmap2::Mmap; use std::ffi::OsString; -use std::io::{BufWriter, Read, Write, stdin, stdout}; +use std::io::{BufWriter, Read as _, Write as _, stdin, stdout}; use std::{ fs::{File, read}, io::copy, diff --git a/src/uu/tail/src/args.rs b/src/uu/tail/src/args.rs index 63bd2b0da01..24878c18a8b 100644 --- a/src/uu/tail/src/args.rs +++ b/src/uu/tail/src/args.rs @@ -6,11 +6,11 @@ // spell-checker:ignore (ToDO) kqueue Signum use crate::paths::Input; -use crate::{Quotable, parse, platform}; +use crate::{Quotable as _, parse, platform}; use clap::{Arg, ArgAction, ArgMatches, Command, value_parser}; use same_file::Handle; use std::ffi::OsString; -use std::io::IsTerminal; +use std::io::IsTerminal as _; use std::time::Duration; use uucore::error::{UResult, USimpleError, UUsageError}; use uucore::parser::parse_signed_num::{SignPrefix, parse_signed_num_max}; diff --git a/src/uu/tail/src/chunks.rs b/src/uu/tail/src/chunks.rs index 3ab7cf4e3ba..5c359fbdf6a 100644 --- a/src/uu/tail/src/chunks.rs +++ b/src/uu/tail/src/chunks.rs @@ -12,7 +12,7 @@ use std::collections::VecDeque; use std::fs::File; -use std::io::{BufRead, Read, Seek, SeekFrom, Write}; +use std::io::{BufRead, Read as _, Seek as _, SeekFrom, Write}; use uucore::error::UResult; /// When reading files in reverse in `bounded_tail`, this is the size of each diff --git a/src/uu/tail/src/follow/files.rs b/src/uu/tail/src/follow/files.rs index af9ed39d4eb..43853c46fca 100644 --- a/src/uu/tail/src/follow/files.rs +++ b/src/uu/tail/src/follow/files.rs @@ -7,12 +7,12 @@ use crate::args::Settings; use crate::chunks::BytesChunkBuffer; -use crate::paths::{HeaderPrinter, PathExtTail}; +use crate::paths::{HeaderPrinter, PathExtTail as _}; use crate::text; use std::collections::HashMap; use std::collections::hash_map::Keys; use std::fs::{File, Metadata}; -use std::io::{BufRead, BufReader, BufWriter, Write, stdout}; +use std::io::{BufRead, BufReader, BufWriter, Write as _, stdout}; use std::path::{Path, PathBuf}; use uucore::error::UResult; diff --git a/src/uu/tail/src/follow/watch.rs b/src/uu/tail/src/follow/watch.rs index 06a355b2217..2cdb9214408 100644 --- a/src/uu/tail/src/follow/watch.rs +++ b/src/uu/tail/src/follow/watch.rs @@ -7,13 +7,13 @@ use crate::args::{FollowMode, Settings}; use crate::follow::files::{FileHandling, PathData}; -use crate::paths::{Input, InputKind, MetadataExtTail, PathExtTail}; +use crate::paths::{Input, InputKind, MetadataExtTail as _, PathExtTail as _}; use crate::{platform, text}; use notify::{RecommendedWatcher, RecursiveMode, Watcher, WatcherKind}; use std::io::BufRead; use std::path::{Path, PathBuf}; use std::sync::mpsc::{self, Receiver, channel}; -use uucore::display::Quotable; +use uucore::display::Quotable as _; use uucore::error::{UResult, USimpleError, set_exit_code}; #[cfg(target_os = "linux")] use uucore::signals::ensure_stdout_not_broken; diff --git a/src/uu/tail/src/paths.rs b/src/uu/tail/src/paths.rs index 6eaeae9801b..048defd7ea9 100644 --- a/src/uu/tail/src/paths.rs +++ b/src/uu/tail/src/paths.rs @@ -8,9 +8,9 @@ use crate::text; use std::ffi::OsStr; use std::fs::{File, Metadata}; -use std::io::{Seek, SeekFrom}; +use std::io::{Seek as _, SeekFrom}; #[cfg(unix)] -use std::os::unix::fs::{FileTypeExt, MetadataExt}; +use std::os::unix::fs::{FileTypeExt as _, MetadataExt as _}; use std::path::{Path, PathBuf}; use uucore::error::UResult; use uucore::translate; diff --git a/src/uu/tail/src/tail.rs b/src/uu/tail/src/tail.rs index ad568db7628..f84cfc73d7c 100644 --- a/src/uu/tail/src/tail.rs +++ b/src/uu/tail/src/tail.rs @@ -26,14 +26,16 @@ use args::{FilterMode, Settings, Signum, parse_args}; use chunks::ReverseChunks; use follow::Observer; use memchr::{memchr_iter, memrchr_iter}; -use paths::{FileExtTail, HeaderPrinter, Input, InputKind}; +use paths::{FileExtTail as _, HeaderPrinter, Input, InputKind}; use same_file::Handle; use std::cmp::Ordering; use std::fs::File; -use std::io::{self, BufReader, BufWriter, ErrorKind, Read, Seek, SeekFrom, Write, stdin, stdout}; +use std::io::{ + self, BufReader, BufWriter, ErrorKind, Read, Seek as _, SeekFrom, Write as _, stdin, stdout, +}; use std::path::{Path, PathBuf}; use uucore::display::Quotable; -use uucore::error::{FromIo, UResult, USimpleError, set_exit_code}; +use uucore::error::{FromIo as _, UResult, USimpleError, set_exit_code}; use uucore::translate; use uucore::{show, show_error}; @@ -213,8 +215,8 @@ fn tail_file( fn open_file(path: &Path, use_nonblock_for_fifo: bool) -> io::Result { use nix::fcntl::{FcntlArg, OFlag, fcntl}; use std::fs::OpenOptions; - use std::os::fd::AsFd; - use std::os::unix::fs::{FileTypeExt, OpenOptionsExt}; + use std::os::fd::AsFd as _; + use std::os::unix::fs::{FileTypeExt as _, OpenOptionsExt as _}; let is_fifo = path .metadata() diff --git a/src/uu/tee/src/tee.rs b/src/uu/tee/src/tee.rs index b9912c42ebf..973941c1f62 100644 --- a/src/uu/tee/src/tee.rs +++ b/src/uu/tee/src/tee.rs @@ -8,7 +8,7 @@ use std::ffi::OsString; use std::fs::OpenOptions; use std::io::{Error, ErrorKind, Read, Result, Write, stderr, stdin, stdout}; use std::path::PathBuf; -use uucore::display::Quotable; +use uucore::display::Quotable as _; use uucore::error::UResult; use uucore::format_usage; use uucore::parser::shortcut_value_parser::ShortcutValueParser; diff --git a/src/uu/test/src/parser.rs b/src/uu/test/src/parser.rs index f391752512a..ed55968814c 100644 --- a/src/uu/test/src/parser.rs +++ b/src/uu/test/src/parser.rs @@ -10,7 +10,7 @@ use std::iter::Peekable; use super::error::{ParseError, ParseResult}; -use uucore::display::Quotable; +use uucore::display::Quotable as _; /// Represents one of the binary comparison operators for strings, integers, or files #[derive(Debug, PartialEq, Eq)] diff --git a/src/uu/test/src/test.rs b/src/uu/test/src/test.rs index 48d691a39dc..4c2fd69c2bd 100644 --- a/src/uu/test/src/test.rs +++ b/src/uu/test/src/test.rs @@ -14,8 +14,8 @@ use parser::{Operator, Symbol, UnaryOperator, parse}; use std::ffi::{OsStr, OsString}; use std::fs; #[cfg(unix)] -use std::os::unix::fs::MetadataExt; -use uucore::display::Quotable; +use std::os::unix::fs::MetadataExt as _; +use uucore::display::Quotable as _; use uucore::error::{UResult, USimpleError}; use uucore::format_usage; #[cfg(not(windows))] @@ -262,7 +262,7 @@ enum PathCondition { #[cfg(not(windows))] fn path(path: &OsStr, condition: &PathCondition) -> bool { use std::fs::Metadata; - use std::os::unix::fs::FileTypeExt; + use std::os::unix::fs::FileTypeExt as _; const S_ISUID: u32 = 0o4000; const S_ISGID: u32 = 0o2000; diff --git a/src/uu/timeout/src/timeout.rs b/src/uu/timeout/src/timeout.rs index 6944794f19c..3302e75c4bf 100644 --- a/src/uu/timeout/src/timeout.rs +++ b/src/uu/timeout/src/timeout.rs @@ -9,15 +9,15 @@ mod status; use crate::status::ExitStatus; use clap::{Arg, ArgAction, Command}; -use std::io::{ErrorKind, Write}; -use std::os::unix::process::ExitStatusExt; +use std::io::{ErrorKind, Write as _}; +use std::os::unix::process::ExitStatusExt as _; use std::process::{self, Child, Stdio}; use std::sync::atomic::{self, AtomicBool}; use std::time::Duration; -use uucore::display::Quotable; +use uucore::display::Quotable as _; use uucore::error::{UResult, USimpleError, UUsageError}; use uucore::parser::parse_time; -use uucore::process::ChildExt; +use uucore::process::ChildExt as _; use uucore::translate; use uucore::{ @@ -28,7 +28,7 @@ use uucore::{ use nix::sys::signal::{SigHandler, Signal, kill}; use nix::unistd::{Pid, getpid, setpgid}; #[cfg(unix)] -use std::os::unix::process::CommandExt; +use std::os::unix::process::CommandExt as _; pub mod options { pub static FOREGROUND: &str = "foreground"; diff --git a/src/uu/touch/src/error.rs b/src/uu/touch/src/error.rs index 47823cde93d..dabf51e922f 100644 --- a/src/uu/touch/src/error.rs +++ b/src/uu/touch/src/error.rs @@ -7,7 +7,7 @@ use filetime::FileTime; use std::path::PathBuf; use thiserror::Error; -use uucore::display::Quotable; +use uucore::display::Quotable as _; use uucore::error::{UError, UIoError}; use uucore::translate; diff --git a/src/uu/touch/src/touch.rs b/src/uu/touch/src/touch.rs index e50686417e2..bb91b632db7 100644 --- a/src/uu/touch/src/touch.rs +++ b/src/uu/touch/src/touch.rs @@ -14,15 +14,15 @@ use filetime::{FileTime, set_file_times, set_symlink_file_times}; use jiff::civil::Time; use jiff::fmt::strtime; use jiff::tz::TimeZone; -use jiff::{Timestamp, ToSpan, Zoned}; +use jiff::{Timestamp, ToSpan as _, Zoned}; use std::borrow::Cow; use std::ffi::{OsStr, OsString}; use std::fs::{self, File}; use std::io::{Error, ErrorKind}; use std::path::{Path, PathBuf}; use std::time::SystemTime; -use uucore::display::Quotable; -use uucore::error::{FromIo, UResult, USimpleError}; +use uucore::display::Quotable as _; +use uucore::error::{FromIo as _, UResult, USimpleError}; #[cfg(target_os = "linux")] use uucore::libc; use uucore::parser::shortcut_value_parser::ShortcutValueParser; diff --git a/src/uu/tr/src/operation.rs b/src/uu/tr/src/operation.rs index 0c62840e044..6e3cc9e9ea4 100644 --- a/src/uu/tr/src/operation.rs +++ b/src/uu/tr/src/operation.rs @@ -7,7 +7,7 @@ use crate::unicode_table; use nom::{ - IResult, Parser, + IResult, Parser as _, branch::alt, bytes::complete::{tag, take, take_till, take_until}, character::complete::one_of, @@ -21,7 +21,7 @@ use std::{ fmt::{Debug, Display}, io::{BufRead, Write}, }; -use uucore::error::{FromIo, UError, UResult}; +use uucore::error::{FromIo as _, UError, UResult}; use uucore::translate; use uucore::show_warning; diff --git a/src/uu/tr/src/simd.rs b/src/uu/tr/src/simd.rs index 7bf2427daf6..46ff1359925 100644 --- a/src/uu/tr/src/simd.rs +++ b/src/uu/tr/src/simd.rs @@ -7,7 +7,7 @@ use crate::operation::ChunkProcessor; use std::io::{BufRead, Write}; -use uucore::error::{FromIo, UResult}; +use uucore::error::{FromIo as _, UResult}; use uucore::translate; /// Helper to detect single-character operations for optimization diff --git a/src/uu/tr/src/tr.rs b/src/uu/tr/src/tr.rs index 3a0ee625371..81a6b8bbb33 100644 --- a/src/uu/tr/src/tr.rs +++ b/src/uu/tr/src/tr.rs @@ -9,13 +9,13 @@ mod unicode_table; use clap::{Arg, ArgAction, Command, value_parser}; use operation::{ - DeleteOperation, Sequence, SqueezeOperation, SymbolTranslator, TranslateOperation, + DeleteOperation, Sequence, SqueezeOperation, SymbolTranslator as _, TranslateOperation, flush_output, translate_input, }; use simd::process_input; use std::ffi::OsString; use std::io::{stdin, stdout}; -use uucore::display::Quotable; +use uucore::display::Quotable as _; use uucore::error::{UResult, USimpleError, UUsageError}; use uucore::fs::is_stdin_directory; use uucore::translate; diff --git a/src/uu/true/src/true.rs b/src/uu/true/src/true.rs index fe8c762e0ec..ee4f25d1e62 100644 --- a/src/uu/true/src/true.rs +++ b/src/uu/true/src/true.rs @@ -3,7 +3,7 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. use clap::{Arg, ArgAction, Command}; -use std::{ffi::OsString, io::Write}; +use std::{ffi::OsString, io::Write as _}; use uucore::error::{UResult, set_exit_code}; use uucore::translate; diff --git a/src/uu/truncate/src/truncate.rs b/src/uu/truncate/src/truncate.rs index 997916b24a8..2c2e74b09c6 100644 --- a/src/uu/truncate/src/truncate.rs +++ b/src/uu/truncate/src/truncate.rs @@ -9,10 +9,10 @@ use std::ffi::OsString; use std::fs::{OpenOptions, metadata}; use std::io::ErrorKind; #[cfg(unix)] -use std::os::unix::fs::FileTypeExt; +use std::os::unix::fs::FileTypeExt as _; use std::path::Path; -use uucore::display::Quotable; -use uucore::error::{FromIo, UResult, USimpleError, UUsageError}; +use uucore::display::Quotable as _; +use uucore::error::{FromIo as _, UResult, USimpleError, UUsageError}; use uucore::format_usage; use uucore::translate; diff --git a/src/uu/tsort/src/tsort.rs b/src/uu/tsort/src/tsort.rs index a689cd05be4..8df7b087931 100644 --- a/src/uu/tsort/src/tsort.rs +++ b/src/uu/tsort/src/tsort.rs @@ -14,7 +14,7 @@ use std::io::{self, BufRead, BufReader}; use string_interner::StringInterner; use string_interner::backend::BucketBackend; use thiserror::Error; -use uucore::display::Quotable; +use uucore::display::Quotable as _; use uucore::error::{UError, UResult, USimpleError}; use uucore::{format_usage, show, translate}; diff --git a/src/uu/tty/src/tty.rs b/src/uu/tty/src/tty.rs index e2c541cff26..c1838767ab2 100644 --- a/src/uu/tty/src/tty.rs +++ b/src/uu/tty/src/tty.rs @@ -6,8 +6,8 @@ // spell-checker:ignore (ToDO) ttyname filedesc use clap::{Arg, ArgAction, Command}; -use std::io::{IsTerminal, Write}; -use uucore::display::OsWrite; +use std::io::{IsTerminal as _, Write as _}; +use uucore::display::OsWrite as _; use uucore::error::{UResult, set_exit_code}; use uucore::format_usage; diff --git a/src/uu/uname/src/uname.rs b/src/uu/uname/src/uname.rs index 862257339b4..b8a677ba1db 100644 --- a/src/uu/uname/src/uname.rs +++ b/src/uu/uname/src/uname.rs @@ -8,7 +8,7 @@ use std::ffi::{OsStr, OsString}; use clap::{Arg, ArgAction, Command}; -use platform_info::{PlatformInfo, PlatformInfoAPI, UNameAPI}; +use platform_info::{PlatformInfo, PlatformInfoAPI as _, UNameAPI as _}; use uucore::display::println_verbatim; use uucore::translate; use uucore::{ diff --git a/src/uu/unexpand/src/unexpand.rs b/src/uu/unexpand/src/unexpand.rs index 14c2b8b0b0a..23471c2710a 100644 --- a/src/uu/unexpand/src/unexpand.rs +++ b/src/uu/unexpand/src/unexpand.rs @@ -8,13 +8,13 @@ use clap::{Arg, ArgAction, Command}; use std::ffi::OsString; use std::fs::File; -use std::io::{BufRead, BufReader, BufWriter, Read, Stdout, Write, stdin, stdout}; +use std::io::{BufRead as _, BufReader, BufWriter, Read, Stdout, Write as _, stdin, stdout}; use std::num::IntErrorKind; use std::path::Path; use std::str::from_utf8; use thiserror::Error; -use uucore::display::Quotable; -use uucore::error::{FromIo, UError, UResult, USimpleError, set_exit_code}; +use uucore::display::Quotable as _; +use uucore::error::{FromIo as _, UError, UResult, USimpleError, set_exit_code}; use uucore::translate; use uucore::{format_usage, show}; diff --git a/src/uu/uniq/src/uniq.rs b/src/uu/uniq/src/uniq.rs index 3288241e4ef..3c63fa218df 100644 --- a/src/uu/uniq/src/uniq.rs +++ b/src/uu/uniq/src/uniq.rs @@ -11,8 +11,8 @@ use std::ffi::{OsStr, OsString}; use std::fs::File; use std::io::{BufRead, BufReader, BufWriter, Write, stdin, stdout}; use std::num::IntErrorKind; -use uucore::display::Quotable; -use uucore::error::{FromIo, UError, UResult, USimpleError}; +use uucore::display::Quotable as _; +use uucore::error::{FromIo as _, UError, UResult, USimpleError}; use uucore::format_usage; use uucore::parser::shortcut_value_parser::ShortcutValueParser; use uucore::posix::{OBSOLETE, posix_version}; diff --git a/src/uu/unlink/src/unlink.rs b/src/uu/unlink/src/unlink.rs index 0e03c3cd1ce..ea5d07de6ea 100644 --- a/src/uu/unlink/src/unlink.rs +++ b/src/uu/unlink/src/unlink.rs @@ -9,8 +9,8 @@ use std::path::Path; use clap::builder::ValueParser; use clap::{Arg, Command}; -use uucore::display::Quotable; -use uucore::error::{FromIo, UResult}; +use uucore::display::Quotable as _; +use uucore::error::{FromIo as _, UResult}; use uucore::format_usage; use uucore::translate; diff --git a/src/uu/uptime/src/uptime.rs b/src/uu/uptime/src/uptime.rs index 936725d52c1..b7715de0fa5 100644 --- a/src/uu/uptime/src/uptime.rs +++ b/src/uu/uptime/src/uptime.rs @@ -6,7 +6,7 @@ // spell-checker:ignore getloadavg behaviour loadavg uptime upsecs updays upmins uphours boottime nusers utmpxname gettime clockid couldnt use jiff::tz::TimeZone; -use jiff::{Timestamp, ToSpan}; +use jiff::{Timestamp, ToSpan as _}; #[cfg(unix)] use std::ffi::OsString; use std::io; @@ -110,7 +110,7 @@ pub fn uu_app() -> Command { #[cfg(unix)] fn uptime_with_file(file_path: &OsString) -> UResult<()> { use std::fs; - use std::os::unix::fs::FileTypeExt; + use std::os::unix::fs::FileTypeExt as _; use uucore::error::set_exit_code; use uucore::show_error; @@ -141,7 +141,7 @@ fn uptime_with_file(file_path: &OsString) -> UResult<()> { #[cfg(target_os = "macos")] { - use std::os::unix::ffi::OsStrExt; + use std::os::unix::ffi::OsStrExt as _; let bytes = file_path.as_os_str().as_bytes(); if bytes[bytes.len() - 1] != b'x' { diff --git a/src/uu/users/src/users.rs b/src/uu/users/src/users.rs index 6586c879f8b..ce92c1ad605 100644 --- a/src/uu/users/src/users.rs +++ b/src/uu/users/src/users.rs @@ -6,7 +6,7 @@ // spell-checker:ignore (paths) wtmp use std::ffi::OsString; -use std::io::{Write, stdout}; +use std::io::{Write as _, stdout}; use std::path::Path; use clap::builder::ValueParser; diff --git a/src/uu/wc/src/count_fast.rs b/src/uu/wc/src/count_fast.rs index d20c53d4fb8..7060ef30aec 100644 --- a/src/uu/wc/src/count_fast.rs +++ b/src/uu/wc/src/count_fast.rs @@ -18,9 +18,9 @@ use libc::{_SC_PAGESIZE, S_IFREG, sysconf}; #[cfg(unix)] use nix::sys::stat; #[cfg(unix)] -use std::io::{Seek, SeekFrom}; +use std::io::{Seek as _, SeekFrom}; #[cfg(unix)] -use std::os::fd::{AsFd, AsRawFd}; +use std::os::fd::{AsFd as _, AsRawFd as _}; #[cfg(windows)] use std::os::windows::fs::MetadataExt; #[cfg(windows)] diff --git a/src/uu/wc/src/wc.rs b/src/uu/wc/src/wc.rs index 3c762353ca3..afa85881a03 100644 --- a/src/uu/wc/src/wc.rs +++ b/src/uu/wc/src/wc.rs @@ -11,24 +11,24 @@ mod utf8; mod word_count; use std::{ - borrow::{Borrow, Cow}, + borrow::{Borrow as _, Cow}, cmp::max, env, ffi::{OsStr, OsString}, fs::{self, File}, - io::{self, Write, stderr}, + io::{self, Write as _, stderr}, iter, path::{Path, PathBuf}, }; use clap::{Arg, ArgAction, ArgMatches, Command, builder::ValueParser}; use thiserror::Error; -use unicode_width::UnicodeWidthChar; +use unicode_width::UnicodeWidthChar as _; use utf8::{BufReadDecoder, BufReadDecoderError}; -use uucore::{display::Quotable, translate}; +use uucore::{display::Quotable as _, translate}; use uucore::{ - error::{FromIo, UError, UResult}, + error::{FromIo as _, UError, UResult}, format_usage, hardware::{HardwareFeature, HasHardwareFeatures as _, SimdPolicy}, parser::shortcut_value_parser::ShortcutValueParser, @@ -297,7 +297,7 @@ impl<'a> Input<'a> { #[cfg(unix)] fn is_stdin_small_file() -> bool { - use std::os::unix::io::{AsRawFd, FromRawFd}; + use std::os::unix::io::{AsRawFd as _, FromRawFd as _}; // Safety: we'll rely on Rust to give us a valid RawFd for stdin with which we can attempt to // open a File, but only for the sake of fetching .metadata(). ManuallyDrop will ensure we // don't do anything else to the FD if anything unexpected happens. @@ -793,7 +793,7 @@ fn files0_iter<'a>( r: impl io::Read + 'static, err_path: OsString, ) -> impl Iterator> { - use std::io::BufRead; + use std::io::BufRead as _; let mut i = Some( io::BufReader::new(r) .split(b'\0') @@ -803,7 +803,7 @@ fn files0_iter<'a>( // On Unix systems, OsStrings are just strings of bytes, not necessarily UTF-8. #[cfg(unix)] { - use std::os::unix::ffi::OsStringExt; + use std::os::unix::ffi::OsStringExt as _; Ok(Input::Path(PathBuf::from(OsString::from_vec(p)).into())) } diff --git a/src/uu/who/src/platform/unix.rs b/src/uu/who/src/platform/unix.rs index 5db18f23e03..7eea8d00385 100644 --- a/src/uu/who/src/platform/unix.rs +++ b/src/uu/who/src/platform/unix.rs @@ -8,8 +8,8 @@ use crate::options; use crate::uu_app; -use uucore::display::Quotable; -use uucore::error::{FromIo, UResult}; +use uucore::display::Quotable as _; +use uucore::error::{FromIo as _, UResult}; use uucore::libc::{S_IWGRP, STDIN_FILENO, ttyname}; use uucore::translate; @@ -17,8 +17,8 @@ use uucore::utmpx::{self, UtmpxRecord, time}; use std::borrow::Cow; use std::ffi::CStr; -use std::fmt::Write; -use std::os::unix::fs::MetadataExt; +use std::fmt::Write as _; +use std::os::unix::fs::MetadataExt as _; use std::path::PathBuf; fn get_long_usage() -> String { diff --git a/src/uu/whoami/src/whoami.rs b/src/uu/whoami/src/whoami.rs index f56bb80b1a5..17c705ea89c 100644 --- a/src/uu/whoami/src/whoami.rs +++ b/src/uu/whoami/src/whoami.rs @@ -6,7 +6,7 @@ use clap::Command; use std::ffi::OsString; use uucore::display::println_verbatim; -use uucore::error::{FromIo, UResult}; +use uucore::error::{FromIo as _, UResult}; use uucore::translate; mod platform; diff --git a/src/uu/yes/src/yes.rs b/src/uu/yes/src/yes.rs index 22c84a1a212..031a6956afe 100644 --- a/src/uu/yes/src/yes.rs +++ b/src/uu/yes/src/yes.rs @@ -8,7 +8,7 @@ use clap::{Arg, ArgAction, Command, builder::ValueParser}; use std::error::Error; use std::ffi::OsString; -use std::io::{self, Write}; +use std::io::{self, Write as _}; use uucore::error::{UResult, USimpleError}; use uucore::format_usage; use uucore::translate; @@ -66,7 +66,7 @@ fn args_into_buffer<'a>( #[cfg(any(unix, target_os = "wasi"))] { #[cfg(unix)] - use std::os::unix::ffi::OsStrExt; + use std::os::unix::ffi::OsStrExt as _; #[cfg(target_os = "wasi")] use std::os::wasi::ffi::OsStrExt; diff --git a/src/uucore/build.rs b/src/uucore/build.rs index 15068f28aab..df2250c28b7 100644 --- a/src/uucore/build.rs +++ b/src/uucore/build.rs @@ -5,7 +5,7 @@ use std::env; use std::fs::File; -use std::io::Write; +use std::io::Write as _; use std::path::{Path, PathBuf}; pub fn main() -> Result<(), Box> { diff --git a/src/uucore/src/lib/features/backup_control.rs b/src/uucore/src/lib/features/backup_control.rs index 6c26b9d5809..ee2ef89c706 100644 --- a/src/uucore/src/lib/features/backup_control.rs +++ b/src/uucore/src/lib/features/backup_control.rs @@ -82,7 +82,7 @@ // spell-checker:ignore backupopt use crate::{ - display::Quotable, + display::Quotable as _, error::{UError, UResult}, }; use clap::ArgMatches; diff --git a/src/uucore/src/lib/features/benchmark.rs b/src/uucore/src/lib/features/benchmark.rs index e2dfac1e72a..1239606acfc 100644 --- a/src/uucore/src/lib/features/benchmark.rs +++ b/src/uucore/src/lib/features/benchmark.rs @@ -9,7 +9,7 @@ //! including test data generation and binary execution helpers. use std::fs::File; -use std::io::{BufWriter, Write}; +use std::io::{BufWriter, Write as _}; use std::path::{Path, PathBuf}; use itertools::Itertools as _; @@ -295,7 +295,7 @@ pub mod text_data { /// Binary data generation utilities for benchmarking pub mod binary_data { use std::fs::File; - use std::io::Write; + use std::io::Write as _; use std::path::Path; /// Create a binary file filled with a repeated pattern @@ -335,7 +335,7 @@ pub mod fs_utils { /// Filesystem tree generation utilities for benchmarking pub mod fs_tree { use std::fs::{self, File}; - use std::io::Write; + use std::io::Write as _; use std::path::Path; /// Create a balanced directory tree for benchmarking @@ -430,7 +430,7 @@ pub mod fs_tree { // Set permissions only on Unix platforms #[cfg(unix)] { - use std::os::unix::fs::PermissionsExt; + use std::os::unix::fs::PermissionsExt as _; let perms = fs::Permissions::from_mode(match (i + j) % 4 { 0 => 0o644, 1 => 0o755, diff --git a/src/uucore/src/lib/features/buf_copy.rs b/src/uucore/src/lib/features/buf_copy.rs index 3ab2814bc24..0e3878733fc 100644 --- a/src/uucore/src/lib/features/buf_copy.rs +++ b/src/uucore/src/lib/features/buf_copy.rs @@ -32,12 +32,12 @@ mod tests { crate::pipes, std::fs::OpenOptions, std::{ - io::{Seek, SeekFrom}, + io::{Seek as _, SeekFrom}, thread, }, }; - use std::io::{Read, Write}; + use std::io::{Read as _, Write as _}; #[cfg(unix)] fn new_temp_file() -> File { diff --git a/src/uucore/src/lib/features/checksum/compute.rs b/src/uucore/src/lib/features/checksum/compute.rs index 4a51f81d790..b2004987483 100644 --- a/src/uucore/src/lib/features/checksum/compute.rs +++ b/src/uucore/src/lib/features/checksum/compute.rs @@ -7,13 +7,13 @@ use std::ffi::{OsStr, OsString}; use std::fs::File; -use std::io::{self, BufReader, Read, Write}; +use std::io::{self, BufReader, Read, Write as _}; use std::path::Path; use crate::checksum::{ AlgoKind, ChecksumError, ReadingMode, SizedAlgoKind, digest_reader, escape_filename, }; -use crate::error::{FromIo, UResult, USimpleError}; +use crate::error::{FromIo as _, UResult, USimpleError}; use crate::line_ending::LineEnding; use crate::sum::DigestOutput; use crate::{show, translate}; diff --git a/src/uucore/src/lib/features/checksum/mod.rs b/src/uucore/src/lib/features/checksum/mod.rs index 0c6dc54f3b5..037c2d2a3f1 100644 --- a/src/uucore/src/lib/features/checksum/mod.rs +++ b/src/uucore/src/lib/features/checksum/mod.rs @@ -9,7 +9,7 @@ use std::ffi::OsStr; use std::io::{self, Read}; use std::num::IntErrorKind; -use os_display::Quotable; +use os_display::Quotable as _; use thiserror::Error; use crate::error::{UError, UResult}; diff --git a/src/uucore/src/lib/features/checksum/validate.rs b/src/uucore/src/lib/features/checksum/validate.rs index 7fede1c4978..1ec20c5e87f 100644 --- a/src/uucore/src/lib/features/checksum/validate.rs +++ b/src/uucore/src/lib/features/checksum/validate.rs @@ -12,12 +12,12 @@ use std::fmt::Display; use std::fs::File; use std::io::{self, BufReader, Read, Write, stderr, stdin}; -use os_display::Quotable; +use os_display::Quotable as _; use crate::checksum::{ AlgoKind, ChecksumError, ReadingMode, SizedAlgoKind, digest_reader, unescape_filename, }; -use crate::error::{FromIo, UError, UIoError, UResult, USimpleError}; +use crate::error::{FromIo as _, UError, UIoError, UResult, USimpleError}; use crate::quoting_style::{QuotingStyle, locale_aware_escape_name}; use crate::sum::DigestOutput; use crate::{ diff --git a/src/uucore/src/lib/features/extendedbigdecimal.rs b/src/uucore/src/lib/features/extendedbigdecimal.rs index d119da4f77b..d9dbcef9782 100644 --- a/src/uucore/src/lib/features/extendedbigdecimal.rs +++ b/src/uucore/src/lib/features/extendedbigdecimal.rs @@ -26,8 +26,8 @@ use std::ops::Neg; use bigdecimal::BigDecimal; use bigdecimal::num_bigint::BigUint; -use num_traits::FromPrimitive; -use num_traits::Signed; +use num_traits::FromPrimitive as _; +use num_traits::Signed as _; use num_traits::Zero; #[derive(Debug, Clone)] @@ -261,7 +261,7 @@ impl Neg for ExtendedBigDecimal { mod tests { use bigdecimal::BigDecimal; - use num_traits::Zero; + use num_traits::Zero as _; use crate::extendedbigdecimal::ExtendedBigDecimal; diff --git a/src/uucore/src/lib/features/format/argument.rs b/src/uucore/src/lib/features/format/argument.rs index b4eea031384..470d986a235 100644 --- a/src/uucore/src/lib/features/format/argument.rs +++ b/src/uucore/src/lib/features/format/argument.rs @@ -12,7 +12,7 @@ use crate::{ quoting_style::{QuotingStyle, locale_aware_escape_name}, show_error, show_warning, }; -use os_display::Quotable; +use os_display::Quotable as _; use std::{ ffi::{OsStr, OsString}, num::NonZero, diff --git a/src/uucore/src/lib/features/format/mod.rs b/src/uucore/src/lib/features/format/mod.rs index 66e4d8bdedd..cc6ac29b28e 100644 --- a/src/uucore/src/lib/features/format/mod.rs +++ b/src/uucore/src/lib/features/format/mod.rs @@ -52,7 +52,7 @@ use std::{ ops::ControlFlow, }; -use os_display::Quotable; +use os_display::Quotable as _; #[derive(Debug)] pub enum FormatError { diff --git a/src/uucore/src/lib/features/format/num_format.rs b/src/uucore/src/lib/features/format/num_format.rs index 9a09b3f7dec..76040804334 100644 --- a/src/uucore/src/lib/features/format/num_format.rs +++ b/src/uucore/src/lib/features/format/num_format.rs @@ -6,9 +6,9 @@ //! Utilities for formatting numbers in various formats use bigdecimal::BigDecimal; -use bigdecimal::num_bigint::ToBigInt; -use num_traits::Signed; -use num_traits::Zero; +use bigdecimal::num_bigint::ToBigInt as _; +use num_traits::Signed as _; +use num_traits::Zero as _; use std::cmp::min; use std::io::Write; @@ -737,8 +737,8 @@ fn write_output( #[cfg(test)] mod test { use bigdecimal::BigDecimal; - use num_traits::FromPrimitive; - use std::str::FromStr; + use num_traits::FromPrimitive as _; + use std::str::FromStr as _; use crate::format::{ ExtendedBigDecimal, Format, @@ -749,7 +749,7 @@ mod test { #[test] fn unsigned_octal() { - use super::{Formatter, NumberAlignment, Prefix, UnsignedInt, UnsignedIntVariant}; + use super::{Formatter as _, NumberAlignment, Prefix, UnsignedInt, UnsignedIntVariant}; let f = |x| { let mut s = Vec::new(); UnsignedInt { diff --git a/src/uucore/src/lib/features/format/spec.rs b/src/uucore/src/lib/features/format/spec.rs index 3587816b771..050dd9c173d 100644 --- a/src/uucore/src/lib/features/format/spec.rs +++ b/src/uucore/src/lib/features/format/spec.rs @@ -6,10 +6,10 @@ // spell-checker:ignore (vars) intmax ptrdiff padlen use super::{ - ExtendedBigDecimal, FormatChar, FormatError, OctalParsing, + ExtendedBigDecimal, FormatChar as _, FormatError, OctalParsing, num_format::{ - self, Case, FloatVariant, ForceDecimal, Formatter, NumberAlignment, PositiveSign, Prefix, - UnsignedIntVariant, + self, Case, FloatVariant, ForceDecimal, Formatter as _, NumberAlignment, PositiveSign, + Prefix, UnsignedIntVariant, }, parse_escape_only, }; diff --git a/src/uucore/src/lib/features/fs.rs b/src/uucore/src/lib/features/fs.rs index 615316238bc..22d6f245069 100644 --- a/src/uucore/src/lib/features/fs.rs +++ b/src/uucore/src/lib/features/fs.rs @@ -29,7 +29,7 @@ use std::io::{Error, ErrorKind, Result as IOResult}; #[cfg(unix)] use std::os::fd::AsFd; #[cfg(unix)] -use std::os::unix::fs::MetadataExt; +use std::os::unix::fs::MetadataExt as _; use std::path::{Component, MAIN_SEPARATOR, Path, PathBuf}; #[cfg(target_os = "windows")] use winapi_util::AsHandleRef; @@ -701,7 +701,7 @@ pub fn are_hardlinks_or_one_way_symlink_to_same_file(source: &Path, target: &Pat /// * `path` - A reference to the path to be checked. #[cfg(unix)] pub fn path_ends_with_terminator(path: &Path) -> bool { - use std::os::unix::prelude::OsStrExt; + use std::os::unix::prelude::OsStrExt as _; path.as_os_str() .as_bytes() .last() @@ -750,7 +750,7 @@ pub fn is_stdin_directory(stdin: &Stdin) -> bool { pub mod sane_blksize { #[cfg(not(target_os = "windows"))] - use std::os::unix::fs::MetadataExt; + use std::os::unix::fs::MetadataExt as _; use std::{fs::metadata, path::Path}; pub const DEFAULT: u64 = 512; @@ -872,11 +872,11 @@ mod tests { // Note this useful idiom: importing names from outer (for mod tests) scope. use super::*; #[cfg(unix)] - use std::io::Write; + use std::io::Write as _; #[cfg(unix)] use std::os::unix; #[cfg(unix)] - use std::os::unix::fs::FileTypeExt; + use std::os::unix::fs::FileTypeExt as _; #[cfg(unix)] use tempfile::{NamedTempFile, tempdir}; diff --git a/src/uucore/src/lib/features/fsext.rs b/src/uucore/src/lib/features/fsext.rs index 173fe918fd2..f9378a884e7 100644 --- a/src/uucore/src/lib/features/fsext.rs +++ b/src/uucore/src/lib/features/fsext.rs @@ -30,7 +30,7 @@ use crate::show_warning; use std::ffi::OsStr; #[cfg(unix)] -use std::os::unix::ffi::OsStrExt; +use std::os::unix::ffi::OsStrExt as _; #[cfg(windows)] use std::os::windows::ffi::OsStrExt; #[cfg(windows)] @@ -76,7 +76,7 @@ use std::{borrow::Cow, ffi::OsString}; use std::fs::Metadata; #[cfg(unix)] -use std::os::unix::fs::MetadataExt; +use std::os::unix::fs::MetadataExt as _; #[cfg(unix)] use std::time::Duration; @@ -416,7 +416,7 @@ fn is_remote_filesystem(dev_name: &str, fs_type: &str) -> bool { #[cfg(all(unix, not(any(target_os = "aix", target_os = "redox"))))] fn mount_dev_id(mount_dir: &OsStr) -> String { - use std::os::unix::fs::MetadataExt; + use std::os::unix::fs::MetadataExt as _; if let Ok(stat) = std::fs::metadata(mount_dir) { // Why do we cast this to i32? diff --git a/src/uucore/src/lib/features/fsxattr.rs b/src/uucore/src/lib/features/fsxattr.rs index e9ae84c5f68..86bd71eed0f 100644 --- a/src/uucore/src/lib/features/fsxattr.rs +++ b/src/uucore/src/lib/features/fsxattr.rs @@ -6,11 +6,11 @@ // spell-checker:ignore getxattr posix_acl_default //! Set of functions to manage xattr on files and dirs -use itertools::Itertools; +use itertools::Itertools as _; use std::collections::HashMap; use std::ffi::{OsStr, OsString}; #[cfg(unix)] -use std::os::unix::ffi::OsStrExt; +use std::os::unix::ffi::OsStrExt as _; use std::path::Path; /// Copies extended attributes (xattrs) from one file or directory to another. diff --git a/src/uucore/src/lib/features/i18n/datetime.rs b/src/uucore/src/lib/features/i18n/datetime.rs index dae7fef07d7..0c7eb4f1ac3 100644 --- a/src/uucore/src/lib/features/i18n/datetime.rs +++ b/src/uucore/src/lib/features/i18n/datetime.rs @@ -13,7 +13,7 @@ use icu_datetime::DateTimeFormatter; use icu_datetime::fieldsets; use icu_locale::Locale; use jiff::civil::Date as JiffDate; -use jiff_icu::ConvertFrom; +use jiff_icu::ConvertFrom as _; use std::sync::OnceLock; use crate::i18n::get_locale_from_env; diff --git a/src/uucore/src/lib/features/parser/num_parser.rs b/src/uucore/src/lib/features/parser/num_parser.rs index f87be3052b4..e0075a8bb2e 100644 --- a/src/uucore/src/lib/features/parser/num_parser.rs +++ b/src/uucore/src/lib/features/parser/num_parser.rs @@ -11,8 +11,8 @@ use bigdecimal::{ BigDecimal, num_bigint::{BigInt, BigUint, Sign}, }; -use num_traits::Signed; -use num_traits::ToPrimitive; +use num_traits::Signed as _; +use num_traits::ToPrimitive as _; use num_traits::Zero; use crate::extendedbigdecimal::ExtendedBigDecimal; @@ -564,13 +564,13 @@ pub(crate) fn parse( #[cfg(test)] mod tests { - use std::str::FromStr; + use std::str::FromStr as _; use bigdecimal::BigDecimal; use crate::extendedbigdecimal::ExtendedBigDecimal; - use super::{ExtendedParser, ExtendedParserError}; + use super::{ExtendedParser as _, ExtendedParserError}; #[test] fn test_decimal_u64() { diff --git a/src/uucore/src/lib/features/parser/parse_size.rs b/src/uucore/src/lib/features/parser/parse_size.rs index 05c270e4cf8..4478322e17f 100644 --- a/src/uucore/src/lib/features/parser/parse_size.rs +++ b/src/uucore/src/lib/features/parser/parse_size.rs @@ -10,7 +10,7 @@ use std::error::Error; use std::fmt; use std::num::{IntErrorKind, ParseIntError}; -use crate::display::Quotable; +use crate::display::Quotable as _; #[cfg(target_os = "linux")] use procfs::{Current, Meminfo}; diff --git a/src/uucore/src/lib/features/parser/parse_time.rs b/src/uucore/src/lib/features/parser/parse_time.rs index 5435bd8231a..db04ae56cac 100644 --- a/src/uucore/src/lib/features/parser/parse_time.rs +++ b/src/uucore/src/lib/features/parser/parse_time.rs @@ -9,13 +9,13 @@ //! Use the [`from_str`] function to parse a [`Duration`] from a string. use crate::{ - display::Quotable, + display::Quotable as _, extendedbigdecimal::ExtendedBigDecimal, parser::num_parser::{self, ExtendedParserError, ParseTarget}, }; -use num_traits::ToPrimitive; -use num_traits::Zero; -use num_traits::{FromPrimitive, Signed}; +use num_traits::ToPrimitive as _; +use num_traits::Zero as _; +use num_traits::{FromPrimitive as _, Signed as _}; use std::time::Duration; /// Parse a duration from a string. diff --git a/src/uucore/src/lib/features/parser/shortcut_value_parser.rs b/src/uucore/src/lib/features/parser/shortcut_value_parser.rs index 5800a91f8a2..70b795df9c5 100644 --- a/src/uucore/src/lib/features/parser/shortcut_value_parser.rs +++ b/src/uucore/src/lib/features/parser/shortcut_value_parser.rs @@ -136,7 +136,7 @@ where mod tests { use std::ffi::OsStr; - use clap::{Command, builder::PossibleValue, builder::TypedValueParser, error::ErrorKind}; + use clap::{Command, builder::PossibleValue, builder::TypedValueParser as _, error::ErrorKind}; use super::ShortcutValueParser; @@ -196,7 +196,7 @@ mod tests { #[test] #[cfg(unix)] fn test_parse_ref_with_invalid_utf8() { - use std::os::unix::prelude::OsStrExt; + use std::os::unix::prelude::OsStrExt as _; let parser = ShortcutValueParser::new(["abcd"]); let cmd = Command::new("cmd"); diff --git a/src/uucore/src/lib/features/perms.rs b/src/uucore/src/lib/features/perms.rs index e9aaf875dc6..bf58b948e0d 100644 --- a/src/uucore/src/lib/features/perms.rs +++ b/src/uucore/src/lib/features/perms.rs @@ -7,7 +7,7 @@ // spell-checker:ignore (jargon) TOCTOU fchownat fchown -use crate::display::Quotable; +use crate::display::Quotable as _; use crate::error::{UResult, USimpleError, strip_errno}; pub use crate::features::entries; use crate::show_error; @@ -28,9 +28,9 @@ use std::ffi::CString; use std::fs::Metadata; use std::io::Error as IOError; use std::io::Result as IOResult; -use std::os::unix::fs::MetadataExt; +use std::os::unix::fs::MetadataExt as _; -use std::os::unix::ffi::OsStrExt; +use std::os::unix::ffi::OsStrExt as _; use std::path::{MAIN_SEPARATOR, Path}; /// The various level of verbosity diff --git a/src/uucore/src/lib/features/ranges.rs b/src/uucore/src/lib/features/ranges.rs index 0797a3bd5ec..7f8dbb7b276 100644 --- a/src/uucore/src/lib/features/ranges.rs +++ b/src/uucore/src/lib/features/ranges.rs @@ -10,7 +10,7 @@ use std::cmp::max; use std::str::FromStr; -use crate::display::Quotable; +use crate::display::Quotable as _; /// A range of values #[derive(PartialEq, Eq, PartialOrd, Ord, Debug)] @@ -166,7 +166,7 @@ pub fn contain(ranges: &[Range], n: usize) -> bool { #[cfg(test)] mod test { use super::{Range, complement}; - use std::str::FromStr; + use std::str::FromStr as _; fn m(a: Vec, b: &[Range]) { assert_eq!(Range::merge(a), b); diff --git a/src/uucore/src/lib/features/safe_traversal.rs b/src/uucore/src/lib/features/safe_traversal.rs index 05c456ad4ce..f3a89656388 100644 --- a/src/uucore/src/lib/features/safe_traversal.rs +++ b/src/uucore/src/lib/features/safe_traversal.rs @@ -12,12 +12,12 @@ // spell-checker:ignore RAII dirfd fchownat fchown FchmodatFlags fchmodat fchmod #[cfg(test)] -use std::os::unix::ffi::OsStringExt; +use std::os::unix::ffi::OsStringExt as _; use std::ffi::{CString, OsStr, OsString}; use std::io; -use std::os::unix::ffi::OsStrExt; -use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, OwnedFd, RawFd}; +use std::os::unix::ffi::OsStrExt as _; +use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd as _, OwnedFd, RawFd}; use std::path::{Path, PathBuf}; use nix::dir::Dir; @@ -25,7 +25,7 @@ use nix::fcntl::{OFlag, openat}; use nix::libc; use nix::sys::stat::{FchmodatFlags, FileStat, Mode, fchmodat, fstatat}; use nix::unistd::{Gid, Uid, UnlinkatFlags, fchown, fchownat, unlinkat}; -use os_display::Quotable; +use os_display::Quotable as _; use crate::translate; @@ -545,7 +545,7 @@ mod tests { use super::*; use std::fs; use std::os::unix::fs::symlink; - use std::os::unix::io::IntoRawFd; + use std::os::unix::io::IntoRawFd as _; use tempfile::TempDir; #[test] diff --git a/src/uucore/src/lib/features/sum.rs b/src/uucore/src/lib/features/sum.rs index 5272ab3c139..1592ca91b07 100644 --- a/src/uucore/src/lib/features/sum.rs +++ b/src/uucore/src/lib/features/sum.rs @@ -562,7 +562,7 @@ mod tests { assert_eq!(result_crlf, result_lf); } - use super::{Crc, Digest}; + use super::{Crc, Digest as _}; #[test] fn test_crc_basic_functionality() { diff --git a/src/uucore/src/lib/features/uptime.rs b/src/uucore/src/lib/features/uptime.rs index 2aba7cd27d4..dc91cce06f9 100644 --- a/src/uucore/src/lib/features/uptime.rs +++ b/src/uucore/src/lib/features/uptime.rs @@ -139,7 +139,7 @@ pub fn get_uptime(boot_time: Option) -> UResult { use crate::utmpx::Utmpx; use libc::BOOT_TIME; use std::fs::File; - use std::io::Read; + use std::io::Read as _; let mut proc_uptime_s = String::new(); diff --git a/src/uucore/src/lib/features/utmpx.rs b/src/uucore/src/lib/features/utmpx.rs index 8a6d03fd546..2bab96d8eab 100644 --- a/src/uucore/src/lib/features/utmpx.rs +++ b/src/uucore/src/lib/features/utmpx.rs @@ -36,7 +36,7 @@ pub extern crate time; use std::ffi::CString; use std::io::Result as IOResult; use std::marker::PhantomData; -use std::os::unix::ffi::OsStrExt; +use std::os::unix::ffi::OsStrExt as _; use std::path::Path; use std::ptr; use std::sync::{Mutex, MutexGuard}; diff --git a/src/uucore/src/lib/lib.rs b/src/uucore/src/lib/lib.rs index 5b89829288e..6dab9855042 100644 --- a/src/uucore/src/lib/lib.rs +++ b/src/uucore/src/lib/lib.rs @@ -138,10 +138,10 @@ use nix::sys::signal::{ }; use std::borrow::Cow; use std::ffi::{OsStr, OsString}; -use std::io::{BufRead, BufReader}; +use std::io::{BufRead as _, BufReader}; use std::iter; #[cfg(unix)] -use std::os::unix::ffi::{OsStrExt, OsStringExt}; +use std::os::unix::ffi::{OsStrExt as _, OsStringExt as _}; use std::str; use std::str::Utf8Chunk; use std::sync::{LazyLock, atomic::Ordering}; @@ -285,7 +285,7 @@ pub fn localized_help_template_with_colors( util_name: &str, colors_enabled: bool, ) -> clap::builder::StyledStr { - use std::fmt::Write; + use std::fmt::Write as _; // Ensure localization is initialized for this utility let _ = locale::setup_localization(util_name); @@ -419,7 +419,7 @@ pub struct NonUtf8OsStrError { impl std::fmt::Display for NonUtf8OsStrError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - use os_display::Quotable; + use os_display::Quotable as _; let quoted = self.input_lossy_string.quote(); f.write_fmt(format_args!( "invalid UTF-8 input {quoted} encountered when converting to bytes on a platform that doesn't expose byte arguments", @@ -726,7 +726,7 @@ mod tests { #[cfg(any(unix, target_os = "redox"))] #[test] fn invalid_utf8_args_unix() { - use std::os::unix::ffi::OsStrExt; + use std::os::unix::ffi::OsStrExt as _; let source = [0x66, 0x6f, 0x80, 0x6f]; let os_str = OsStr::from_bytes(&source[..]); diff --git a/src/uucore/src/lib/mods/clap_localization.rs b/src/uucore/src/lib/mods/clap_localization.rs index cfc30ab22fd..4db1b246d45 100644 --- a/src/uucore/src/lib/mods/clap_localization.rs +++ b/src/uucore/src/lib/mods/clap_localization.rs @@ -17,7 +17,7 @@ use crate::locale::translate; use clap::error::{ContextKind, ErrorKind}; use clap::{ArgMatches, Command, Error}; -use std::error::Error as StdError; +use std::error::Error as _; use std::ffi::OsString; /// Color enum for consistent styling diff --git a/src/uucore/src/lib/mods/display.rs b/src/uucore/src/lib/mods/display.rs index ee259ef596c..360bdcadf27 100644 --- a/src/uucore/src/lib/mods/display.rs +++ b/src/uucore/src/lib/mods/display.rs @@ -28,10 +28,10 @@ use std::env; use std::ffi::OsStr; use std::fmt; use std::fs::File; -use std::io::{self, BufWriter, Stdout, StdoutLock, Write as IoWrite}; +use std::io::{self, BufWriter, Stdout, StdoutLock, Write as _}; #[cfg(unix)] -use std::os::unix::ffi::OsStrExt; +use std::os::unix::ffi::OsStrExt as _; #[cfg(target_os = "wasi")] use std::os::wasi::ffi::OsStrExt; diff --git a/src/uucore/src/lib/mods/error.rs b/src/uucore/src/lib/mods/error.rs index d2239d12875..4ea3bb77c87 100644 --- a/src/uucore/src/lib/mods/error.rs +++ b/src/uucore/src/lib/mods/error.rs @@ -58,7 +58,7 @@ use std::{ cell::Cell, error::Error, fmt::{Display, Formatter}, - io::Write, + io::Write as _, sync::atomic::{AtomicI32, Ordering}, }; @@ -781,7 +781,7 @@ mod tests { #[test] #[cfg(unix)] fn test_nix_error_conversion() { - use super::{FromIo, UIoError}; + use super::{FromIo as _, UIoError}; use nix::errno::Errno; use std::io::ErrorKind; diff --git a/src/uucore/src/lib/mods/locale.rs b/src/uucore/src/lib/mods/locale.rs index b670f897620..c4b18b6debd 100644 --- a/src/uucore/src/lib/mods/locale.rs +++ b/src/uucore/src/lib/mods/locale.rs @@ -11,10 +11,10 @@ use fluent_syntax::parser::ParserError; use std::fs; use std::path::{Path, PathBuf}; -use std::str::FromStr; +use std::str::FromStr as _; use std::sync::OnceLock; -use os_display::Quotable; +use os_display::Quotable as _; use thiserror::Error; use unic_langid::LanguageIdentifier; diff --git a/tests/uutests/src/lib/util.rs b/tests/uutests/src/lib/util.rs index eaa9c868d03..6e4d96e492a 100644 --- a/tests/uutests/src/lib/util.rs +++ b/tests/uutests/src/lib/util.rs @@ -31,17 +31,17 @@ use std::collections::VecDeque; use std::ffi::CString; use std::ffi::{OsStr, OsString}; use std::fs::{self, File, OpenOptions, hard_link, remove_file}; -use std::io::{self, BufWriter, Read, Result, Write}; +use std::io::{self, BufWriter, Read as _, Result, Write}; #[cfg(unix)] use std::os::fd::OwnedFd; #[cfg(unix)] -use std::os::unix::fs::{PermissionsExt, symlink as symlink_dir, symlink as symlink_file}; +use std::os::unix::fs::{PermissionsExt as _, symlink as symlink_dir, symlink as symlink_file}; #[cfg(unix)] use std::os::unix::net::UnixListener; #[cfg(unix)] -use std::os::unix::process::CommandExt; +use std::os::unix::process::CommandExt as _; #[cfg(unix)] -use std::os::unix::process::ExitStatusExt; +use std::os::unix::process::ExitStatusExt as _; #[cfg(windows)] use std::os::windows::fs::{symlink_dir, symlink_file}; #[cfg(windows)]