Skip to content

Commit 410f63d

Browse files
committed
Rollup merge of rust-lang#53217 - strake:inline, r=nagisa
inline some short functions I found these were outline in binaries i link. I think they ought to be inline, considering their size.
2 parents db74946 + b78201a commit 410f63d

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

src/libcore/cmp.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,7 @@ pub trait Ord: Eq + PartialOrd<Self> {
469469
/// assert_eq!(2, 2.max(2));
470470
/// ```
471471
#[stable(feature = "ord_max_min", since = "1.21.0")]
472+
#[inline]
472473
fn max(self, other: Self) -> Self
473474
where Self: Sized {
474475
if other >= self { other } else { self }
@@ -485,6 +486,7 @@ pub trait Ord: Eq + PartialOrd<Self> {
485486
/// assert_eq!(2, 2.min(2));
486487
/// ```
487488
#[stable(feature = "ord_max_min", since = "1.21.0")]
489+
#[inline]
488490
fn min(self, other: Self) -> Self
489491
where Self: Sized {
490492
if self <= other { self } else { other }

src/libcore/option.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,6 +1141,7 @@ unsafe impl<'a, A> TrustedLen for Iter<'a, A> {}
11411141

11421142
#[stable(feature = "rust1", since = "1.0.0")]
11431143
impl<'a, A> Clone for Iter<'a, A> {
1144+
#[inline]
11441145
fn clone(&self) -> Iter<'a, A> {
11451146
Iter { inner: self.inner.clone() }
11461147
}
@@ -1307,14 +1308,17 @@ impl<T> ops::Try for Option<T> {
13071308
type Ok = T;
13081309
type Error = NoneError;
13091310

1311+
#[inline]
13101312
fn into_result(self) -> Result<T, NoneError> {
13111313
self.ok_or(NoneError)
13121314
}
13131315

1316+
#[inline]
13141317
fn from_ok(v: T) -> Self {
13151318
Some(v)
13161319
}
13171320

1321+
#[inline]
13181322
fn from_error(_: NoneError) -> Self {
13191323
None
13201324
}

src/libcore/result.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,6 +1084,7 @@ unsafe impl<'a, A> TrustedLen for Iter<'a, A> {}
10841084

10851085
#[stable(feature = "rust1", since = "1.0.0")]
10861086
impl<'a, T> Clone for Iter<'a, T> {
1087+
#[inline]
10871088
fn clone(&self) -> Iter<'a, T> { Iter { inner: self.inner } }
10881089
}
10891090

@@ -1235,14 +1236,17 @@ impl<T,E> ops::Try for Result<T, E> {
12351236
type Ok = T;
12361237
type Error = E;
12371238

1239+
#[inline]
12381240
fn into_result(self) -> Self {
12391241
self
12401242
}
12411243

1244+
#[inline]
12421245
fn from_ok(v: T) -> Self {
12431246
Ok(v)
12441247
}
12451248

1249+
#[inline]
12461250
fn from_error(v: E) -> Self {
12471251
Err(v)
12481252
}

0 commit comments

Comments
 (0)