diff --git a/src/uu/cp/src/copydir.rs b/src/uu/cp/src/copydir.rs index db2f4ff1986..42e30b452d4 100644 --- a/src/uu/cp/src/copydir.rs +++ b/src/uu/cp/src/copydir.rs @@ -135,7 +135,7 @@ impl<'a> Context<'a> { /// /// For convenience while traversing a directory, the [`Entry::new`] /// function allows creating an entry from a [`Context`] and a -/// [`walkdir::DirEntry`]. +/// [`DirEntry`]. /// /// # Examples /// @@ -549,7 +549,7 @@ pub(crate) fn copy_directory( /// Decide whether the second path is a prefix of the first. /// /// This function canonicalizes the paths via -/// [`uucore::fs::canonicalize`] before comparing. +/// [`fs::canonicalize`] before comparing. /// /// # Errors /// diff --git a/src/uu/dd/src/dd.rs b/src/uu/dd/src/dd.rs index 20470f23ecd..7c63af29072 100644 --- a/src/uu/dd/src/dd.rs +++ b/src/uu/dd/src/dd.rs @@ -236,8 +236,8 @@ impl Source { /// Create a source from stdin using its raw file descriptor. /// /// This returns an instance of the `Source::StdinFile` variant, - /// using the raw file descriptor of [`std::io::Stdin`] to create - /// the [`std::fs::File`] parameter. You can use this instead of + /// using the raw file descriptor of [`io::Stdin`] to create + /// the [`File`] parameter. You can use this instead of /// `Source::Stdin` to allow reading from stdin without consuming /// the entire contents of stdin when this process terminates. #[cfg(unix)] diff --git a/src/uu/numfmt/src/numfmt.rs b/src/uu/numfmt/src/numfmt.rs index 16e8e304387..bb8af2229ff 100644 --- a/src/uu/numfmt/src/numfmt.rs +++ b/src/uu/numfmt/src/numfmt.rs @@ -341,9 +341,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { } pub fn uu_app() -> Command { - Command::new(uucore::util_name()) + Command::new(util_name()) .version(uucore::crate_version!()) - .help_template(uucore::localized_help_template(uucore::util_name())) + .help_template(uucore::localized_help_template(util_name())) .about(translate!("numfmt-about")) .after_help(translate!("numfmt-after-help")) .override_usage(format_usage(&translate!("numfmt-usage"))) diff --git a/src/uucore/build.rs b/src/uucore/build.rs index dbc313122fb..15068f28aab 100644 --- a/src/uucore/build.rs +++ b/src/uucore/build.rs @@ -6,7 +6,7 @@ use std::env; use std::fs::File; use std::io::Write; -use std::path::Path; +use std::path::{Path, PathBuf}; pub fn main() -> Result<(), Box> { let out_dir = env::var("OUT_DIR")?; @@ -63,7 +63,7 @@ pub fn main() -> Result<(), Box> { /// /// Returns an error if the `CARGO_MANIFEST_DIR` environment variable is not set /// or if the current directory structure does not allow determining the project root. -fn project_root() -> Result> { +fn project_root() -> Result> { let manifest_dir = env::var("CARGO_MANIFEST_DIR")?; let uucore_path = Path::new(&manifest_dir); @@ -354,7 +354,7 @@ fn embed_component_locales( path_builder: F, ) -> Result<(), Box> where - F: Fn(&str) -> std::path::PathBuf, + F: Fn(&str) -> PathBuf, { for_each_locale(locales, |locale| { let locale_path = path_builder(locale); diff --git a/src/uucore/src/lib/features/backup_control.rs b/src/uucore/src/lib/features/backup_control.rs index 8456b28c191..6c26b9d5809 100644 --- a/src/uucore/src/lib/features/backup_control.rs +++ b/src/uucore/src/lib/features/backup_control.rs @@ -245,7 +245,7 @@ pub mod arguments { /// 2. From the "SIMPLE_BACKUP_SUFFIX" environment variable, if present /// 3. By using the default '~' if none of the others apply /// -/// This function directly takes [`clap::ArgMatches`] as argument and looks for +/// This function directly takes [`ArgMatches`] as argument and looks for /// the '-S' and '--suffix' arguments itself. pub fn determine_backup_suffix(matches: &ArgMatches) -> String { let supplied_suffix = matches.get_one::(arguments::OPT_SUFFIX); @@ -261,7 +261,7 @@ pub fn determine_backup_suffix(matches: &ArgMatches) -> String { /// Parses the backup options according to the [GNU manual][1], and converts /// them to an instance of `BackupMode` for further processing. /// -/// Takes [`clap::ArgMatches`] as argument which **must** contain the options +/// Takes [`ArgMatches`] as argument which **must** contain the options /// from [`arguments::backup()`] and [`arguments::backup_no_args()`]. Otherwise /// the `NoBackup` mode is returned unconditionally. /// diff --git a/src/uucore/src/lib/features/benchmark.rs b/src/uucore/src/lib/features/benchmark.rs index a5f0b88b67a..e2dfac1e72a 100644 --- a/src/uucore/src/lib/features/benchmark.rs +++ b/src/uucore/src/lib/features/benchmark.rs @@ -173,7 +173,7 @@ pub mod text_data { pub fn generate_ascii_data_simple(num_lines: usize) -> Vec { let mut data = Vec::new(); for i in 0..num_lines { - let line = format!("line_{:06}\n", (num_lines - i - 1)); + let line = format!("line_{:06}\n", num_lines - i - 1); data.extend_from_slice(line.as_bytes()); } data diff --git a/tests/by-util/test_tee.rs b/tests/by-util/test_tee.rs index 4a3e169129a..8d03328b6f5 100644 --- a/tests/by-util/test_tee.rs +++ b/tests/by-util/test_tee.rs @@ -198,8 +198,9 @@ mod linux_only { use std::os::unix::io::FromRawFd; let mut fds: [c_int; 2] = [0, 0]; - assert!( - (unsafe { libc::pipe(std::ptr::from_mut::(&mut fds[0])) } == 0), + assert_eq!( + unsafe { libc::pipe(std::ptr::from_mut::(&mut fds[0])) }, + 0, "Failed to create pipe" ); @@ -215,8 +216,9 @@ mod linux_only { use std::os::unix::io::FromRawFd; let mut fds: [c_int; 2] = [0, 0]; - assert!( - (unsafe { libc::pipe(std::ptr::from_mut::(&mut fds[0])) } == 0), + assert_eq!( + unsafe { libc::pipe(std::ptr::from_mut::(&mut fds[0])) }, + 0, "Failed to create pipe" );