diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2017-08-11 15:58:26 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2017-08-11 15:58:26 -0700 |
| commit | a83d2afbba772f474872aacc6c21f2b5270fc517 (patch) | |
| tree | 74b31771067a57bc01309c9c47bc19a014b9cb22 | |
| parent | edd82ee9f09c74188f88440db6586ef8e5b1c0b2 (diff) | |
| download | rust-a83d2afbba772f474872aacc6c21f2b5270fc517.tar.gz rust-a83d2afbba772f474872aacc6c21f2b5270fc517.zip | |
std: Tag `AllocErr` functions as `#[inline]`
None of these require a significant amount of code and using `#[inline]` will allow constructors to get inlined, improving codegen at allocation callsites.
| -rw-r--r-- | src/liballoc/allocator.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/liballoc/allocator.rs b/src/liballoc/allocator.rs index 42111301a9f..181eb7466d7 100644 --- a/src/liballoc/allocator.rs +++ b/src/liballoc/allocator.rs @@ -354,15 +354,19 @@ pub enum AllocErr { } impl AllocErr { + #[inline] pub fn invalid_input(details: &'static str) -> Self { AllocErr::Unsupported { details: details } } + #[inline] pub fn is_memory_exhausted(&self) -> bool { if let AllocErr::Exhausted { .. } = *self { true } else { false } } + #[inline] pub fn is_request_unsupported(&self) -> bool { if let AllocErr::Unsupported { .. } = *self { true } else { false } } + #[inline] pub fn description(&self) -> &str { match *self { AllocErr::Exhausted { .. } => "allocator memory exhausted", |
