Merge pull request #4151 from miles170/issue-4149-refactor-use

uu: use normal use declarations to import macros
This commit is contained in:
Sylvestre Ledru
2022-11-17 08:48:15 +01:00
committed by GitHub
52 changed files with 63 additions and 185 deletions
+3
View File
@@ -18,6 +18,9 @@ use indicatif::ProgressBar;
use uucore::display::Quotable;
use uucore::error::UIoError;
use uucore::fs::{canonicalize, FileInformation, MissingHandling, ResolveMode};
use uucore::show;
use uucore::show_error;
use uucore::uio_error;
use walkdir::{DirEntry, WalkDir};
use crate::{
+2 -6
View File
@@ -11,11 +11,7 @@
// spell-checker:ignore (ToDO) copydir ficlone fiemap ftruncate linkgs lstat nlink nlinks pathbuf pwrite reflink strs xattrs symlinked deduplicated advcpmv
#[macro_use]
extern crate quick_error;
#[macro_use]
extern crate uucore;
use quick_error::quick_error;
use std::borrow::Cow;
use std::collections::HashSet;
use std::env;
@@ -40,10 +36,10 @@ use quick_error::ResultExt;
use uucore::backup_control::{self, BackupMode};
use uucore::display::Quotable;
use uucore::error::{set_exit_code, UClapError, UError, UResult, UUsageError};
use uucore::format_usage;
use uucore::fs::{
canonicalize, paths_refer_to_same_file, FileInformation, MissingHandling, ResolveMode,
};
use uucore::{crash, crash_if_err, format_usage, show_error, show_warning};
mod copydir;
use crate::copydir::copy_directory;
+1 -4
View File
@@ -2,9 +2,6 @@
// spell-checker:ignore rustdoc
#![allow(rustdoc::private_intra_doc_links)]
#[macro_use]
extern crate uucore;
use std::cmp::Ordering;
use std::io::{self, BufReader};
use std::{
@@ -16,7 +13,7 @@ use clap::{crate_version, Arg, ArgAction, ArgMatches, Command};
use regex::Regex;
use uucore::display::Quotable;
use uucore::error::{FromIo, UResult};
use uucore::format_usage;
use uucore::{crash_if_err, format_usage};
mod csplit_error;
mod patterns;
+1
View File
@@ -2,6 +2,7 @@
use crate::csplit_error::CsplitError;
use regex::Regex;
use uucore::show_warning;
/// The definition of a pattern to match on a line.
#[derive(Debug)]
+1 -4
View File
@@ -7,9 +7,6 @@
// spell-checker:ignore (ToDO) delim sourcefiles
#[macro_use]
extern crate uucore;
use bstr::io::BufReadExt;
use clap::{crate_version, Arg, ArgAction, Command};
use std::fs::File;
@@ -19,8 +16,8 @@ use uucore::display::Quotable;
use uucore::error::{FromIo, UResult, USimpleError};
use self::searcher::Searcher;
use uucore::format_usage;
use uucore::ranges::Range;
use uucore::{format_usage, show, show_error, show_if_err};
mod searcher;
+1 -4
View File
@@ -5,9 +5,6 @@
// * For the full copyright and license information, please view the LICENSE
// * file that was distributed with this source code.
#[macro_use]
extern crate uucore;
use chrono::prelude::DateTime;
use chrono::Local;
use clap::ArgAction;
@@ -37,9 +34,9 @@ use std::{error::Error, fmt::Display};
use uucore::display::{print_verbatim, Quotable};
use uucore::error::FromIo;
use uucore::error::{UError, UResult};
use uucore::format_usage;
use uucore::parse_glob;
use uucore::parse_size::{parse_size, ParseSizeError};
use uucore::{crash, format_usage, show, show_error, show_warning};
#[cfg(windows)]
use windows_sys::Win32::Foundation::HANDLE;
#[cfg(windows)]
+2 -8
View File
@@ -10,13 +10,7 @@
// spell-checker:ignore (ToDO) chdir execvp progname subcommand subcommands unsets setenv putenv spawnp SIGSEGV SIGBUS sigaction
#[macro_use]
extern crate clap;
#[macro_use]
extern crate uucore;
use clap::{Arg, ArgAction, Command};
use clap::{crate_name, crate_version, Arg, ArgAction, Command};
use ini::Ini;
#[cfg(unix)]
use nix::sys::signal::{raise, sigaction, SaFlags, SigAction, SigHandler, SigSet, Signal};
@@ -29,7 +23,7 @@ use std::os::unix::process::ExitStatusExt;
use std::process;
use uucore::display::Quotable;
use uucore::error::{UClapError, UResult, USimpleError, UUsageError};
use uucore::format_usage;
use uucore::{format_usage, show_warning};
const ABOUT: &str = "set each NAME to VALUE in the environment and run COMMAND";
const USAGE: &str = "{} [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...]";
+1 -4
View File
@@ -9,9 +9,6 @@
// spell-checker:ignore (ToDO) ctype cwidth iflag nbytes nspaces nums tspaces uflag Preprocess
#[macro_use]
extern crate uucore;
use clap::{crate_version, Arg, ArgAction, ArgMatches, Command};
use std::error::Error;
use std::fmt;
@@ -22,7 +19,7 @@ use std::str::from_utf8;
use unicode_width::UnicodeWidthChar;
use uucore::display::Quotable;
use uucore::error::{FromIo, UError, UResult};
use uucore::format_usage;
use uucore::{crash, format_usage};
static ABOUT: &str = "Convert tabs in each FILE to spaces, writing to standard output.
With no FILE, or when FILE is -, read standard input.";
+1 -3
View File
@@ -6,9 +6,6 @@
// * For the full copyright and license information, please view the LICENSE file
// * that was distributed with this source code.
#[macro_use]
extern crate uucore;
use std::error::Error;
use std::fmt::Write as FmtWrite;
use std::io::BufRead;
@@ -19,6 +16,7 @@ use clap::{crate_version, Arg, ArgAction, Command};
pub use factor::*;
use uucore::display::Quotable;
use uucore::error::UResult;
use uucore::{show_error, show_warning};
mod miller_rabin;
pub mod numeric;
+1 -4
View File
@@ -7,9 +7,6 @@
// spell-checker:ignore (ToDO) PSKIP linebreak ostream parasplit tabwidth xanti xprefix
#[macro_use]
extern crate uucore;
use clap::{crate_version, Arg, ArgAction, Command};
use std::cmp;
use std::fs::File;
@@ -17,7 +14,7 @@ use std::io::{stdin, stdout, Write};
use std::io::{BufReader, BufWriter, Read};
use uucore::display::Quotable;
use uucore::error::{FromIo, UResult, USimpleError};
use uucore::format_usage;
use uucore::{format_usage, show_warning};
use self::linebreak::break_lines;
use self::parasplit::ParagraphStream;
+2
View File
@@ -12,6 +12,8 @@ use std::i64;
use std::io::{BufWriter, Stdout, Write};
use std::mem;
use uucore::crash;
use crate::parasplit::{ParaWords, Paragraph, WordInfo};
use crate::FmtOptions;
+1 -3
View File
@@ -15,15 +15,13 @@
// spell-checker:ignore (ToDO) passwd
#[macro_use]
extern crate uucore;
use std::error::Error;
use std::fmt::Display;
use uucore::{
display::Quotable,
entries::{get_groups_gnu, gid2grp, Locate, Passwd},
error::{UError, UResult},
format_usage,
format_usage, show,
};
use clap::{crate_version, Arg, ArgAction, Command};
-6
View File
@@ -6,12 +6,6 @@
//! [`DigestWriter`] struct provides a wrapper around [`Digest`] that
//! implements the [`Write`] trait, for use in situations where calling
//! [`write`] would be useful.
extern crate digest;
extern crate md5;
extern crate sha1;
extern crate sha2;
extern crate sha3;
use std::io::Write;
use hex::encode;
+3 -6
View File
@@ -9,18 +9,13 @@
// spell-checker:ignore (ToDO) algo, algoname, regexes, nread, nonames
#[macro_use]
extern crate clap;
#[macro_use]
extern crate uucore;
mod digest;
use self::digest::Digest;
use self::digest::DigestWriter;
use clap::builder::ValueParser;
use clap::crate_version;
use clap::ArgAction;
use clap::{Arg, ArgMatches, Command};
use hex::encode;
@@ -37,8 +32,10 @@ use std::io::{self, stdin, BufRead, BufReader, Read};
use std::iter;
use std::num::ParseIntError;
use std::path::Path;
use uucore::crash;
use uucore::display::Quotable;
use uucore::error::{FromIo, UError, UResult};
use uucore::show_warning;
const NAME: &str = "hashsum";
+1 -4
View File
@@ -36,19 +36,16 @@
#![allow(non_camel_case_types)]
#![allow(dead_code)]
#[macro_use]
extern crate uucore;
use clap::{crate_version, Arg, ArgAction, Command};
use std::ffi::CStr;
use uucore::display::Quotable;
use uucore::entries::{self, Group, Locate, Passwd};
use uucore::error::UResult;
use uucore::error::{set_exit_code, USimpleError};
use uucore::format_usage;
pub use uucore::libc;
use uucore::libc::{getlogin, uid_t};
use uucore::process::{getegid, geteuid, getgid, getuid};
use uucore::{format_usage, show_error};
macro_rules! cstr2cow {
($v:expr) => {
+1 -4
View File
@@ -9,9 +9,6 @@
mod mode;
#[macro_use]
extern crate uucore;
use clap::{crate_version, Arg, ArgAction, ArgMatches, Command};
use file_diff::diff;
use filetime::{set_file_times, FileTime};
@@ -19,10 +16,10 @@ use uucore::backup_control::{self, BackupMode};
use uucore::display::Quotable;
use uucore::entries::{grp2gid, usr2uid};
use uucore::error::{FromIo, UError, UIoError, UResult, UUsageError};
use uucore::format_usage;
use uucore::fs::dir_strip_dot_for_creation;
use uucore::mode::get_umask;
use uucore::perms::{wrap_chown, Verbosity, VerbosityLevel};
use uucore::{format_usage, show, show_error, show_if_err, uio_error};
use libc::{getegid, geteuid};
use std::error::Error;
+1 -1
View File
@@ -22,7 +22,7 @@ pub fn parse(mode_string: &str, considering_dir: bool, umask: u32) -> Result<u32
#[cfg(any(unix, target_os = "redox"))]
pub fn chmod(path: &Path, mode: u32) -> Result<(), ()> {
use std::os::unix::fs::PermissionsExt;
use uucore::display::Quotable;
use uucore::{display::Quotable, show_error};
fs::set_permissions(path, fs::Permissions::from_mode(mode)).map_err(|err| {
show_error!("{}: chmod failed with error {}", path.maybe_quote(), err);
})
+1 -3
View File
@@ -7,9 +7,6 @@
// spell-checker:ignore (ToDO) autoformat FILENUM whitespaces pairable unpairable nocheck
#[macro_use]
extern crate uucore;
use clap::builder::ValueParser;
use clap::{crate_version, Arg, ArgAction, Command};
use memchr::{memchr3_iter, memchr_iter};
@@ -25,6 +22,7 @@ use std::num::IntErrorKind;
use std::os::unix::ffi::OsStrExt;
use uucore::display::Quotable;
use uucore::error::{set_exit_code, UError, UResult, USimpleError};
use uucore::{crash, crash_if_err};
static NAME: &str = "join";
+1 -4
View File
@@ -7,17 +7,14 @@
// spell-checker:ignore (ToDO) signalname pids killpg
#[macro_use]
extern crate uucore;
use clap::{crate_version, 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, UError, UResult, USimpleError};
use uucore::format_usage;
use uucore::signals::{signal_by_name_or_value, ALL_SIGNALS};
use uucore::{format_usage, show};
static ABOUT: &str = "Send signal to processes or list information about signals.";
const USAGE: &str = "{} [OPTIONS]... PID...";
+1 -4
View File
@@ -7,14 +7,11 @@
// spell-checker:ignore (ToDO) srcpath targetpath EEXIST
#[macro_use]
extern crate uucore;
use clap::{crate_version, Arg, ArgAction, Command};
use uucore::display::Quotable;
use uucore::error::{FromIo, UError, UResult};
use uucore::format_usage;
use uucore::fs::{make_path_relative_to, paths_refer_to_same_file};
use uucore::{format_usage, show_error};
use std::borrow::Cow;
use std::error::Error;

Some files were not shown because too many files have changed in this diff Show More