about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorM Farkas-Dyck <strake888@gmail.com>2018-08-09 01:27:48 -0800
committerM Farkas-Dyck <strake888@gmail.com>2018-08-09 01:27:48 -0800
commitb78201aee550045246e824000a35bf445a84c7ee (patch)
tree8c7413288beccd3055e90cc884ad66b00d3e01ae /src/libcore
parentebe8df41d70d8763e0a15aefe078b035d3519214 (diff)
downloadrust-b78201aee550045246e824000a35bf445a84c7ee.tar.gz
rust-b78201aee550045246e824000a35bf445a84c7ee.zip
inline some short functions
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/cmp.rs2
-rw-r--r--src/libcore/option.rs4
-rw-r--r--src/libcore/result.rs4
3 files changed, 10 insertions, 0 deletions
diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs
index 3626a266ad5..58d6c4f5e09 100644
--- a/src/libcore/cmp.rs
+++ b/src/libcore/cmp.rs
@@ -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 @@ pub trait Ord: Eq + PartialOrd<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 }
diff --git a/src/libcore/option.rs b/src/libcore/option.rs
index 2b6c376f8a7..f743fbfd075 100644
--- a/src/libcore/option.rs
+++ b/src/libcore/option.rs
@@ -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
     }
diff --git a/src/libcore/result.rs b/src/libcore/result.rs
index fb496836c2c..ac908342655 100644
--- a/src/libcore/result.rs
+++ b/src/libcore/result.rs
@@ -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)
     }