]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #53217 - strake:inline, r=nagisa
authorkennytm <kennytm@gmail.com>
Thu, 9 Aug 2018 13:33:49 +0000 (21:33 +0800)
committerkennytm <kennytm@gmail.com>
Thu, 9 Aug 2018 17:01:27 +0000 (01:01 +0800)
inline some short functions

I found these were outline in binaries i link. I think they ought to be inline, considering their size.

src/libcore/cmp.rs
src/libcore/option.rs
src/libcore/result.rs

index 3626a266ad5d3f0d86cd059ede2c21fbae92c816..58d6c4f5e09236640c8be496f352e6797c84c5ef 100644 (file)
@@ -469,6 +469,7 @@ pub trait Ord: Eq + PartialOrd<Self> {
     /// assert_eq!(2, 2.max(2));
     /// ```
     #[stable(feature = "ord_max_min", since = "1.21.0")]
+    #[inline]
     fn max(self, other: Self) -> Self
     where Self: Sized {
         if other >= self { other } else { self }
@@ -485,6 +486,7 @@ fn max(self, other: Self) -> Self
     /// assert_eq!(2, 2.min(2));
     /// ```
     #[stable(feature = "ord_max_min", since = "1.21.0")]
+    #[inline]
     fn min(self, other: Self) -> Self
     where Self: Sized {
         if self <= other { self } else { other }
index 2b6c376f8a71ca9da8632260c4cb8588455c3a25..f743fbfd0752b6931151abf9c54146d64141e2d1 100644 (file)
@@ -1141,6 +1141,7 @@ unsafe impl<'a, A> TrustedLen for Iter<'a, A> {}
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a, A> Clone for Iter<'a, A> {
+    #[inline]
     fn clone(&self) -> Iter<'a, A> {
         Iter { inner: self.inner.clone() }
     }
@@ -1307,14 +1308,17 @@ impl<T> ops::Try for Option<T> {
     type Ok = T;
     type Error = NoneError;
 
+    #[inline]
     fn into_result(self) -> Result<T, NoneError> {
         self.ok_or(NoneError)
     }
 
+    #[inline]
     fn from_ok(v: T) -> Self {
         Some(v)
     }
 
+    #[inline]
     fn from_error(_: NoneError) -> Self {
         None
     }
index fb496836c2c104d41f5b4a6c5d60a5cf3bb8831d..ac908342655b6ea88229c123dd63a05e72f407c2 100644 (file)
@@ -1084,6 +1084,7 @@ unsafe impl<'a, A> TrustedLen for Iter<'a, A> {}
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a, T> Clone for Iter<'a, T> {
+    #[inline]
     fn clone(&self) -> Iter<'a, T> { Iter { inner: self.inner } }
 }
 
@@ -1235,14 +1236,17 @@ impl<T,E> ops::Try for Result<T, E> {
     type Ok = T;
     type Error = E;
 
+    #[inline]
     fn into_result(self) -> Self {
         self
     }
 
+    #[inline]
     fn from_ok(v: T) -> Self {
         Ok(v)
     }
 
+    #[inline]
     fn from_error(v: E) -> Self {
         Err(v)
     }