refactor: use fully-qualified syntax for Error types#12037
refactor: use fully-qualified syntax for Error types#12037xtqqczze wants to merge 4 commits intouutils:mainfrom
Error types#12037Conversation
|
GNU testsuite comparison: |
Merging this PR will not alter performance
Comparing Footnotes
|
There was a problem hiding this comment.
Pull request overview
This PR refactors error-related imports and trait paths to reduce reliance on importing Error types directly (from std, clap, and thiserror), favoring fully-qualified paths and core::error::Error where applicable to improve refactor-safety.
Changes:
- Replace
use ... Errorimports with fully-qualified references (e.g.,std::io::Error::...,clap::error::Error). - Update many custom error derives to
#[derive(..., thiserror::Error)]without importingthiserror::Error. - Switch various trait bounds/return types/impls from
std::error::Errortocore::error::Error.
Reviewed changes
Copilot reviewed 76 out of 76 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/by-util/test_cat.rs | Avoid importing std::io::Error; use fully-qualified constructor. |
| src/uucore/src/lib/mods/locale.rs | Remove thiserror::Error import; use thiserror::Error in derive path. |
| src/uucore/src/lib/mods/error.rs | Prefer core::error::Error in docs/trait bounds/impls to avoid std::error::Error import. |
| src/uucore/src/lib/mods/clap_localization.rs | Bring core::error::Error trait into scope without naming conflicts. |
| src/uucore/src/lib/lib.rs | Implement core::error::Error for a local error type. |
| src/uucore/src/lib/features/uptime.rs | Remove thiserror::Error import; qualify derive. |
| src/uucore/src/lib/features/systemd_logind.rs | Return Box<dyn core::error::Error> instead of std path. |
| src/uucore/src/lib/features/smack.rs | Remove thiserror::Error import; qualify derive. |
| src/uucore/src/lib/features/selinux.rs | Use core::error::Error in error-chain formatting API. |
| src/uucore/src/lib/features/safe_traversal.rs | Normalize derive order with qualified thiserror::Error. |
| src/uucore/src/lib/features/perms.rs | Avoid importing std::io::Error alias; fully qualify last_os_error. |
| src/uucore/src/lib/features/parser/parse_size.rs | Implement core::error::Error instead of importing std::error::Error. |
| src/uucore/src/lib/features/fsext.rs | Remove IOError alias; fully qualify std::io::Error::last_os_error. |
| src/uucore/src/lib/features/fs.rs | Avoid importing std::io::Error; use fully-qualified constructors. |
| src/uucore/src/lib/features/format/mod.rs | Implement core::error::Error without importing std::error::Error. |
| src/uucore/src/lib/features/entries.rs | Remove IOError alias; fully qualify std::io::Error constructors. |
| src/uucore/src/lib/features/checksum/mod.rs | Remove thiserror::Error import; qualify derive. |
| src/uucore/src/lib/features/buf_copy/common.rs | Implement core::error::Error for local error type. |
| src/uucore/src/lib/features/backup_control.rs | Implement core::error::Error without importing std::error::Error. |
| src/uucore/build.rs | Use Box<dyn core::error::Error> for build-script error types. |
| src/uu/wc/src/wc.rs | Remove thiserror::Error import; qualify derive. |
| src/uu/wc/src/utf8/read.rs | Remove thiserror::Error import; qualify derive. |
| src/uu/uptime/src/uptime.rs | Remove thiserror::Error import; qualify derive. |
| src/uu/uniq/src/uniq.rs | Avoid importing clap’s Error; use fully-qualified clap::error::Error. |
| src/uu/unexpand/src/unexpand.rs | Remove thiserror::Error import; qualify derive. |
| src/uu/tsort/src/tsort.rs | Remove thiserror::Error import; qualify derive. |
| src/uu/tr/src/operation.rs | Implement core::error::Error without importing std::error::Error. |
| src/uu/touch/src/touch.rs | Avoid importing std::io::Error; use fully-qualified constructors. |
| src/uu/touch/src/error.rs | Remove thiserror::Error import; qualify derive. |
| src/uu/test/src/error.rs | Remove thiserror::Error import; qualify derive. |
| src/uu/tee/src/tee.rs | Avoid importing std::io::Error; fully qualify error creation and parameter types. |
| src/uu/tac/src/error.rs | Remove thiserror::Error import; qualify derive. |
| src/uu/stdbuf/src/stdbuf.rs | Remove thiserror::Error import; qualify derive. |
| src/uu/stat/src/stat.rs | Remove thiserror::Error import; qualify derive. |
| src/uu/split/src/strategy.rs | Remove thiserror::Error import; qualify derive. |
| src/uu/split/src/split.rs | Remove thiserror::Error import; qualify derive. |
| src/uu/split/src/platform/windows.rs | Avoid importing std::io::Error; fully qualify Error::other. |
| src/uu/split/src/platform/unix.rs | Avoid importing std::io::Error; fully qualify Error::other. |
| src/uu/split/src/number.rs | Implement core::error::Error without importing std::error::Error. |
| src/uu/split/src/filenames.rs | Remove thiserror::Error import; qualify derive. |
| src/uu/sort/src/sort.rs | Remove thiserror::Error import; qualify derive. |
| src/uu/seq/src/error.rs | Remove thiserror::Error import; qualify derive. |
| src/uu/runcon/src/errors.rs | Use core::error::Error for error-chain formatting and impls. |
| src/uu/rm/src/rm.rs | Remove thiserror::Error import; qualify derive. |
| src/uu/ptx/src/ptx.rs | Remove thiserror::Error import; qualify derive. |
| src/uu/pr/src/pr.rs | Remove thiserror::Error import; qualify derive. |
| src/uu/od/src/mockstream.rs | Avoid importing std::io::Error; use fully-qualified constructor. |
| src/uu/numfmt/src/numfmt.rs | Avoid importing std::io::Error; use fully-qualified error type and constructor. |
| src/uu/numfmt/src/errors.rs | Remove thiserror::Error import; qualify derive. |
| src/uu/nohup/src/nohup.rs | Avoid importing std::io::Error; fully qualify error types and last_os_error. |
| src/uu/mv/src/hardlink.rs | Implement core::error::Error and update source() signature accordingly. |
| src/uu/mv/src/error.rs | Remove thiserror::Error import; qualify derive. |
| src/uu/more/src/more.rs | Implement core::error::Error for local error type. |
| src/uu/mktemp/src/mktemp.rs | Remove thiserror::Error import; qualify derive. |
| src/uu/ls/src/ls.rs | Remove thiserror::Error import; qualify derive. |
| src/uu/ln/src/ln.rs | Remove thiserror::Error import; qualify derive. |
| src/uu/kill/src/kill.rs | Avoid importing std::io::Error; fully qualify from_raw_os_error. |
| src/uu/join/src/join.rs | Remove thiserror::Error import; qualify derive. |
| src/uu/install/src/install.rs | Remove thiserror::Error import; qualify derive. |
| src/uu/head/src/head.rs | Remove thiserror::Error import; qualify derive. |
| src/uu/groups/src/groups.rs | Remove thiserror::Error import; qualify derive. |
| src/uu/fmt/src/fmt.rs | Remove thiserror::Error import; qualify derive. |
| src/uu/expr/src/expr.rs | Remove thiserror::Error import; qualify derive. |
| src/uu/expand/src/expand.rs | Remove thiserror::Error import; qualify derive. |
| src/uu/env/src/env.rs | Remove thiserror::Error import; qualify derive. |
| src/uu/du/src/du.rs | Remove thiserror::Error import; qualify derive. |
| src/uu/df/src/df.rs | Remove thiserror::Error import; qualify derive. |
| src/uu/df/src/columns.rs | Remove thiserror::Error import; qualify derive. |
| src/uu/dd/src/parseargs.rs | Remove thiserror::Error import; qualify derive. |
| src/uu/csplit/src/csplit_error.rs | Remove thiserror::Error import; qualify derive. |
| src/uu/cp/src/cp.rs | Remove thiserror::Error import; qualify derive and implement core::error::Error for BackupError. |
| src/uu/chroot/src/error.rs | Avoid importing std::io::Error; fully qualify error types in variants and derive. |
| src/uu/chroot/src/chroot.rs | Avoid importing std::io::Error; fully qualify last_os_error usage. |
| src/uu/chmod/src/chmod.rs | Remove thiserror::Error import; qualify derive. |
| src/uu/chcon/src/errors.rs | Remove thiserror::Error import; use core::error::Error for error-chain formatting. |
| src/uu/cat/src/cat.rs | Remove thiserror::Error import; qualify derive. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Error types
Error typesError types
Errortypes from external crates with locally defined or fully qualified error handling paths.cc: @cakebaker