std: Inline some Termination-related methods
These were showing up in tests and in binaries but are trivially optimize-able away, so add `#[inline]` attributes so LLVM has an opportunity to optimize them out.
This commit is contained in:
parent
56714acc5e
commit
323f808791
3 changed files with 4 additions and 0 deletions
|
|
@ -1452,6 +1452,7 @@ pub trait Termination {
|
|||
|
||||
#[unstable(feature = "termination_trait_lib", issue = "43301")]
|
||||
impl Termination for () {
|
||||
#[inline]
|
||||
fn report(self) -> i32 { ExitCode::SUCCESS.report() }
|
||||
}
|
||||
|
||||
|
|
@ -1481,6 +1482,7 @@ impl<E: fmt::Debug> Termination for Result<!, E> {
|
|||
|
||||
#[unstable(feature = "termination_trait_lib", issue = "43301")]
|
||||
impl Termination for ExitCode {
|
||||
#[inline]
|
||||
fn report(self) -> i32 {
|
||||
self.0.as_i32()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -404,6 +404,7 @@ impl ExitCode {
|
|||
pub const SUCCESS: ExitCode = ExitCode(EXIT_SUCCESS as _);
|
||||
pub const FAILURE: ExitCode = ExitCode(EXIT_FAILURE as _);
|
||||
|
||||
#[inline]
|
||||
pub fn as_i32(&self) -> i32 {
|
||||
self.0 as i32
|
||||
}
|
||||
|
|
|
|||
|
|
@ -414,6 +414,7 @@ impl ExitCode {
|
|||
pub const SUCCESS: ExitCode = ExitCode(EXIT_SUCCESS as _);
|
||||
pub const FAILURE: ExitCode = ExitCode(EXIT_FAILURE as _);
|
||||
|
||||
#[inline]
|
||||
pub fn as_i32(&self) -> i32 {
|
||||
self.0 as i32
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue