Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/uu/dd/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ use crate::parseargs::ParseError;
/// when they were not kept.
/// * `operand` - The `KEY=VALUE` operand at fault, as typed.
/// * `error` - What the parser made of it.
#[cold]
#[inline(never)]
pub fn operand_error(
diag_args: Option<&[OsString]>,
operand: &str,
Expand Down
2 changes: 2 additions & 0 deletions src/uu/df/src/df.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ enum OptionsError {
/// * `error` - What the size parser rejected the value with.
/// * `matches` - The parsed command line, for the value as it was typed.
/// * `diag_args` - The arguments as typed, or `None` when they were not kept.
#[cold]
#[inline(never)]
fn block_size_error(
error: &ParseSizeError,
matches: &ArgMatches,
Expand Down
2 changes: 2 additions & 0 deletions src/uu/env/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,8 @@ struct ParsedArguments {
}

impl EnvAppData {
#[cold]
#[inline(never)]
fn make_error_no_such_file_or_dir(&self, prog: &OsStr) -> Box<dyn UError> {
uucore::show_error!(
"{}",
Expand Down
2 changes: 2 additions & 0 deletions src/uu/sort/src/sort.rs
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,8 @@ fn incompatible_options_message(opts: &str) -> String {
)
}

#[cold]
#[inline(never)]
fn incompatible_options_error(opts: &str) -> Box<dyn UError> {
USimpleError::new(2, incompatible_options_message(opts))
}
Expand Down
2 changes: 2 additions & 0 deletions src/uu/stat/src/stat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ impl DirectiveError {
/// * `option` - The format as typed and the option it was given to, or
/// `None` for a format stat built itself, which is not on the command
/// line and has nothing to point at.
#[cold]
#[inline(never)]
fn to_error(
&self,
diag_args: Option<&[OsString]>,
Expand Down
2 changes: 2 additions & 0 deletions src/uu/uniq/src/uniq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,8 @@ fn handle_extract_obs_skip_chars(
/// Unfortunately these overrides are necessary, since several GNU tests
/// for `uniq` hardcode and require the exact wording of the error message
/// and it is not compatible with how Clap formats and displays those error messages.
#[cold]
#[inline(never)]
fn map_clap_errors(clap_error: Error) -> Box<dyn UError> {
let footer = translate!("uniq-error-try-help");
let override_arg_conflict = translate!("uniq-error-group-mutually-exclusive") + "\n" + &footer;
Expand Down
12 changes: 9 additions & 3 deletions src/uucore/src/lib/mods/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@ pub struct USimpleError {

impl USimpleError {
/// Create a new `USimpleError` with a given exit code and message.
#[cold]
Comment thread
xtqqczze marked this conversation as resolved.
#[inline(never)]
Comment thread
xtqqczze marked this conversation as resolved.
#[allow(clippy::new_ret_no_self)]
pub fn new<S: Into<String>>(code: i32, message: S) -> Box<dyn UError> {
Box::new(Self {
Expand Down Expand Up @@ -340,8 +342,10 @@ pub struct UUsageError {
}

impl UUsageError {
#[allow(clippy::new_ret_no_self)]
/// Create a new `UUsageError` with a given exit code and message.
#[cold]
#[inline(never)]
#[allow(clippy::new_ret_no_self)]
pub fn new<S: Into<String>>(code: i32, message: S) -> Box<dyn UError> {
Box::new(Self {
code,
Expand Down Expand Up @@ -401,8 +405,8 @@ pub struct UIoError {
}

impl UIoError {
#[allow(clippy::new_ret_no_self)]
/// Create a new `UIoError` with a given exit code and message.
#[allow(clippy::new_ret_no_self)]
pub fn new<S: Into<String>>(kind: std::io::ErrorKind, context: S) -> Box<dyn UError> {
Box::new(Self {
context: Some(context.into()),
Expand Down Expand Up @@ -696,8 +700,10 @@ macro_rules! uio_error(
pub struct ExitCode(pub i32);

impl ExitCode {
#[allow(clippy::new_ret_no_self)]
/// Create a new `ExitCode` with a given exit code.
#[cold]
#[inline(never)]
#[allow(clippy::new_ret_no_self)]
pub fn new(code: i32) -> Box<dyn UError> {
Box::new(Self(code))
}
Expand Down
Loading