Skip to content

Commit 2a2cafd

Browse files
authored
Re-enable unused_qualifications lint (#10571)
1 parent a3eab5c commit 2a2cafd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+157
-185
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@ lib*.a
2121

2222
### direnv ###
2323
/.direnv/
24+
25+
*.code-workspace

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ unexpected_cfgs = { level = "warn", check-cfg = [
641641
'cfg(fuzzing)',
642642
'cfg(target_os, values("cygwin"))',
643643
] }
644-
#unused_qualifications = "warn" // TODO: fix warnings in uucore, then re-enable this lint
644+
unused_qualifications = "warn"
645645

646646
[workspace.lints.clippy]
647647
# The counts were generated with this command:

build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ pub fn main() {
6666
\n\
6767
#[allow(clippy::too_many_lines)]
6868
#[allow(clippy::unreadable_literal)]
69-
fn util_map<T: uucore::Args>() -> UtilityMap<T> {\n"
69+
fn util_map<T: Args>() -> UtilityMap<T> {\n"
7070
.as_bytes(),
7171
)
7272
.unwrap();

src/bin/coreutils.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use std::cmp;
1010
use std::ffi::OsString;
1111
use std::io::{self, Write};
1212
use std::process;
13+
use uucore::Args;
1314

1415
const VERSION: &str = env!("CARGO_PKG_VERSION");
1516

src/bin/uudoc.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,16 @@ fn usage<T: Args>(utils: &UtilityMap<T>) {
4545
}
4646

4747
/// Generates the coreutils app for the utility map
48-
fn gen_coreutils_app<T: Args>(util_map: &UtilityMap<T>) -> clap::Command {
49-
let mut command = clap::Command::new("coreutils");
48+
fn gen_coreutils_app<T: Args>(util_map: &UtilityMap<T>) -> Command {
49+
let mut command = Command::new("coreutils");
5050
for (name, (_, sub_app)) in util_map {
5151
// Recreate a small subcommand with only the relevant info
5252
// (name & short description)
5353
let about = sub_app()
5454
.get_about()
5555
.expect("Could not get the 'about'")
5656
.to_string();
57-
let sub_app = clap::Command::new(name).about(about);
57+
let sub_app = Command::new(name).about(about);
5858
command = command.subcommand(sub_app);
5959
}
6060
command
@@ -172,7 +172,7 @@ fn main() -> io::Result<()> {
172172
}
173173
let utils = util_map::<Box<dyn Iterator<Item = OsString>>>();
174174
match std::fs::create_dir("docs/src/utils/") {
175-
Err(e) if e.kind() == std::io::ErrorKind::AlreadyExists => Ok(()),
175+
Err(e) if e.kind() == io::ErrorKind::AlreadyExists => Ok(()),
176176
x => x,
177177
}?;
178178

@@ -202,7 +202,7 @@ fn main() -> io::Result<()> {
202202
let mut map = HashMap::new();
203203
for platform in ["unix", "macos", "windows", "unix_android"] {
204204
let platform_utils: Vec<String> = String::from_utf8(
205-
std::process::Command::new("./util/show-utils.sh")
205+
process::Command::new("./util/show-utils.sh")
206206
.arg(format!("--features=feat_os_{platform}"))
207207
.output()?
208208
.stdout,
@@ -217,7 +217,7 @@ fn main() -> io::Result<()> {
217217

218218
// Linux is a special case because it can support selinux
219219
let platform_utils: Vec<String> = String::from_utf8(
220-
std::process::Command::new("./util/show-utils.sh")
220+
process::Command::new("./util/show-utils.sh")
221221
.arg("--features=feat_os_unix feat_selinux")
222222
.output()?
223223
.stdout,
@@ -547,7 +547,7 @@ fn write_zip_examples(
547547
};
548548

549549
match format_examples(content, output_markdown) {
550-
Err(e) => Err(std::io::Error::other(format!(
550+
Err(e) => Err(io::Error::other(format!(
551551
"Failed to format the tldr examples of {name}: {e}"
552552
))),
553553
Ok(s) => Ok(s),

src/uu/base32/src/base_common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,7 @@ fn format_read_error(error: &io::Error) -> String {
925925

926926
/// Determines if the input buffer contains any padding ('=') ignoring trailing whitespace.
927927
#[cfg(test)]
928-
fn read_and_has_padding<R: std::io::Read>(input: &mut R) -> UResult<(bool, Vec<u8>)> {
928+
fn read_and_has_padding<R: io::Read>(input: &mut R) -> UResult<(bool, Vec<u8>)> {
929929
let mut buf = Vec::new();
930930
input
931931
.read_to_end(&mut buf)

src/uu/dd/src/dd.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use crate::bufferedoutput::BufferedOutput;
1717
use blocks::conv_block_unblock_helper;
1818
use datastructures::*;
1919
#[cfg(any(target_os = "linux", target_os = "android"))]
20-
use nix::fcntl::FcntlArg::F_SETFL;
20+
use nix::fcntl::FcntlArg;
2121
#[cfg(any(target_os = "linux", target_os = "android"))]
2222
use nix::fcntl::OFlag;
2323
use parseargs::Parser;
@@ -897,7 +897,7 @@ impl<'a> Output<'a> {
897897
if let Some(libc_flags) = make_linux_oflags(&settings.oflags) {
898898
nix::fcntl::fcntl(
899899
fx.as_raw().as_fd(),
900-
F_SETFL(OFlag::from_bits_retain(libc_flags)),
900+
FcntlArg::F_SETFL(OFlag::from_bits_retain(libc_flags)),
901901
)?;
902902
}
903903

src/uu/env/src/env.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,11 +1027,9 @@ where
10271027

10281028
// Set environment variable to communicate to Rust child processes
10291029
// that SIGPIPE should be default (not ignored)
1030-
if matches!(action_kind, SignalActionKind::Default)
1031-
&& sig_value == nix::libc::SIGPIPE as usize
1032-
{
1030+
if matches!(action_kind, SignalActionKind::Default) && sig_value == libc::SIGPIPE as usize {
10331031
unsafe {
1034-
std::env::set_var("RUST_SIGPIPE", "default");
1032+
env::set_var("RUST_SIGPIPE", "default");
10351033
}
10361034
}
10371035

src/uu/fold/src/fold.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ fn process_utf8_chars<W: Write>(line: &str, ctx: &mut FoldContext<'_, W>) -> URe
514514
// not coalesce zero-width scalars there.
515515
if ctx.mode == WidthMode::Columns {
516516
while let Some(&(_, next_ch)) = iter.peek() {
517-
if unicode_width::UnicodeWidthChar::width(next_ch).unwrap_or(1) == 0 {
517+
if UnicodeWidthChar::width(next_ch).unwrap_or(1) == 0 {
518518
iter.next();
519519
} else {
520520
break;

src/uu/ls/src/colors.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ impl<'a> StyleManager<'a> {
478478
}
479479

480480
#[cfg(unix)]
481-
fn indicator_for_special_file(&self, file_type: &std::fs::FileType) -> Option<Indicator> {
481+
fn indicator_for_special_file(&self, file_type: &fs::FileType) -> Option<Indicator> {
482482
if file_type.is_fifo() && self.has_indicator_style(Indicator::FIFO) {
483483
return Some(Indicator::FIFO);
484484
}
@@ -495,7 +495,7 @@ impl<'a> StyleManager<'a> {
495495
}
496496

497497
#[cfg(not(unix))]
498-
fn indicator_for_special_file(&self, _file_type: &std::fs::FileType) -> Option<Indicator> {
498+
fn indicator_for_special_file(&self, _file_type: &fs::FileType) -> Option<Indicator> {
499499
None
500500
}
501501

0 commit comments

Comments
 (0)