Skip to content

Commit 773bd28

Browse files
committed
reasons
1 parent 7b78134 commit 773bd28

File tree

12 files changed

+39
-13
lines changed

12 files changed

+39
-13
lines changed

src/uu/du/src/du.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,10 @@ fn get_blocks(path: &Path, _metadata: &Metadata) -> u64 {
233233
}
234234

235235
#[cfg(not(windows))]
236-
#[expect(clippy::unnecessary_wraps)] // To match all platforms
236+
#[expect(
237+
clippy::unnecessary_wraps,
238+
reason = "fn sig must match on all platforms"
239+
)]
237240
fn get_file_info(_path: &Path, metadata: &Metadata) -> Option<FileInfo> {
238241
Some(FileInfo {
239242
file_id: metadata.ino() as u128,

src/uu/false/src/false.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ use uucore::error::{UResult, set_exit_code};
99
use uucore::translate;
1010

1111
#[uucore::main]
12-
#[expect(clippy::unnecessary_wraps)] // TODO: modify proc macro to allow no-result uumain
12+
// TODO: modify proc macro to allow no-result uumain
13+
#[expect(clippy::unnecessary_wraps, reason = "proc macro requires UResult")]
1314
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
1415
// Mirror GNU options, always return `1`. In particular even the 'successful' cases of no-op,
1516
// and the interrupted display of help and version should return `1`. Also, we return Ok in all

src/uu/head/src/parse.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ mod tests {
138138
}
139139
}
140140

141-
#[expect(clippy::unnecessary_wraps)] // test helper
141+
#[expect(clippy::unnecessary_wraps, reason = "test helper")]
142142
fn obsolete_result(src: &[&str]) -> Option<Result<Vec<String>, ParseError>> {
143143
Some(Ok(src.iter().map(|&s| s.to_string()).collect()))
144144
}

src/uu/ls/src/ls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ fn parse_time_style(options: &clap::ArgMatches) -> Result<(String, Option<String
262262
const LOCALE_FORMAT: (&str, Option<&str>) = ("%b %e %H:%M", Some("%b %e %Y"));
263263

264264
// Convert time_styles references to owned String/option.
265-
#[expect(clippy::unnecessary_wraps)] // Result helper
265+
#[expect(clippy::unnecessary_wraps, reason = "internal result helper")]
266266
fn ok((recent, older): (&str, Option<&str>)) -> Result<(String, Option<String>), LsError> {
267267
Ok((recent.to_string(), older.map(String::from)))
268268
}

src/uu/mkdir/src/mkdir.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ pub struct Config<'a> {
5151
}
5252

5353
#[cfg(windows)]
54-
#[expect(clippy::unnecessary_wraps)] // To match all platforms
54+
#[expect(
55+
clippy::unnecessary_wraps,
56+
reason = "fn sig must match on all platforms"
57+
)]
5558
fn get_mode(_matches: &ArgMatches) -> Result<u32, String> {
5659
Ok(DEFAULT_PERM)
5760
}

src/uu/mv/src/mv.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,10 @@ fn rename_fifo_fallback(from: &Path, to: &Path) -> io::Result<()> {
886886
}
887887

888888
#[cfg(not(unix))]
889-
#[expect(clippy::unnecessary_wraps)] // To match all platforms
889+
#[expect(
890+
clippy::unnecessary_wraps,
891+
reason = "fn sig must match on all platforms"
892+
)]
890893
fn rename_fifo_fallback(_from: &Path, _to: &Path) -> io::Result<()> {
891894
Ok(())
892895
}

src/uu/stdbuf/src/stdbuf.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,19 @@ enum ProgramOptionsError {
9090
target_os = "openbsd",
9191
target_os = "dragonfly"
9292
))]
93-
#[expect(clippy::unnecessary_wraps)] // To match all platforms
93+
#[expect(
94+
clippy::unnecessary_wraps,
95+
reason = "fn sig must match on all platforms"
96+
)]
9497
fn preload_strings() -> UResult<(&'static str, &'static str)> {
9598
Ok(("LD_PRELOAD", "so"))
9699
}
97100

98101
#[cfg(target_vendor = "apple")]
99-
#[expect(clippy::unnecessary_wraps)] // To match all platforms
102+
#[expect(
103+
clippy::unnecessary_wraps,
104+
reason = "fn sig must match on all platforms"
105+
)]
100106
fn preload_strings() -> UResult<(&'static str, &'static str)> {
101107
Ok(("DYLD_LIBRARY_PATH", "dylib"))
102108
}

src/uu/stty/src/stty.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,10 @@ impl WrappedPrinter {
613613
}
614614
}
615615

616-
#[allow(clippy::unnecessary_wraps)] // needed for some platforms
616+
#[allow(
617+
clippy::unnecessary_wraps,
618+
reason = "needed for some platform-specific code"
619+
)]
617620
fn print_terminal_size(
618621
termios: &Termios,
619622
opts: &Options,

src/uu/sync/src/sync.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ mod platform {
4141

4242
use uucore::error::UResult;
4343

44-
#[expect(clippy::unnecessary_wraps)] // To match all platforms
44+
#[expect(
45+
clippy::unnecessary_wraps,
46+
reason = "fn sig must match on all platforms"
47+
)]
4548
pub fn do_sync() -> UResult<()> {
4649
sync();
4750
Ok(())

src/uu/true/src/true.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ use uucore::error::{UResult, set_exit_code};
99
use uucore::translate;
1010

1111
#[uucore::main]
12-
#[expect(clippy::unnecessary_wraps)] // TODO: modify proc macro to allow no-result uumain
12+
// TODO: modify proc macro to allow no-result uumain
13+
#[expect(clippy::unnecessary_wraps, reason = "proc macro requires UResult")]
1314
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
1415
let args: Vec<OsString> = args.collect();
1516
if args.len() != 2 {

0 commit comments

Comments
 (0)