Skip to content

Commit a83d2af

Browse files
committed
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.
1 parent edd82ee commit a83d2af

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/liballoc/allocator.rs

+4
Original file line numberDiff line numberDiff line change
@@ -354,15 +354,19 @@ pub enum AllocErr {
354354
}
355355

356356
impl AllocErr {
357+
#[inline]
357358
pub fn invalid_input(details: &'static str) -> Self {
358359
AllocErr::Unsupported { details: details }
359360
}
361+
#[inline]
360362
pub fn is_memory_exhausted(&self) -> bool {
361363
if let AllocErr::Exhausted { .. } = *self { true } else { false }
362364
}
365+
#[inline]
363366
pub fn is_request_unsupported(&self) -> bool {
364367
if let AllocErr::Unsupported { .. } = *self { true } else { false }
365368
}
369+
#[inline]
366370
pub fn description(&self) -> &str {
367371
match *self {
368372
AllocErr::Exhausted { .. } => "allocator memory exhausted",

0 commit comments

Comments
 (0)