about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBen Kimock <kimockb@gmail.com>2023-03-18 13:25:47 -0400
committerBen Kimock <kimockb@gmail.com>2023-03-19 14:47:31 -0400
commitd3352def96f9bd8e32fddfc1d8cdfb56c47040f2 (patch)
tree72d00aefefe763fa21f4677d5ddb7852774e6527
parent511364e7874dba9649a264100407e4bffe7b5425 (diff)
downloadrust-d3352def96f9bd8e32fddfc1d8cdfb56c47040f2.tar.gz
rust-d3352def96f9bd8e32fddfc1d8cdfb56c47040f2.zip
Add #[inline] to as_deref
-rw-r--r--library/core/src/option.rs2
-rw-r--r--library/core/src/result.rs2
2 files changed, 4 insertions, 0 deletions
diff --git a/library/core/src/option.rs b/library/core/src/option.rs
index 0f2475a8bde..aab3bf1bc12 100644
--- a/library/core/src/option.rs
+++ b/library/core/src/option.rs
@@ -1310,6 +1310,7 @@ impl<T> Option<T> {
     /// let x: Option<String> = None;
     /// assert_eq!(x.as_deref(), None);
     /// ```
+    #[inline]
     #[stable(feature = "option_deref", since = "1.40.0")]
     #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
     pub const fn as_deref(&self) -> Option<&T::Target>
@@ -1336,6 +1337,7 @@ impl<T> Option<T> {
     ///     x
     /// }), Some("HEY".to_owned().as_mut_str()));
     /// ```
+    #[inline]
     #[stable(feature = "option_deref", since = "1.40.0")]
     #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
     pub const fn as_deref_mut(&mut self) -> Option<&mut T::Target>
diff --git a/library/core/src/result.rs b/library/core/src/result.rs
index 208b220c24a..c8168c3f358 100644
--- a/library/core/src/result.rs
+++ b/library/core/src/result.rs
@@ -908,6 +908,7 @@ impl<T, E> Result<T, E> {
     /// let y: Result<&str, &u32> = Err(&42);
     /// assert_eq!(x.as_deref(), y);
     /// ```
+    #[inline]
     #[stable(feature = "inner_deref", since = "1.47.0")]
     pub fn as_deref(&self) -> Result<&T::Target, &E>
     where
@@ -934,6 +935,7 @@ impl<T, E> Result<T, E> {
     /// let y: Result<&mut str, &mut u32> = Err(&mut i);
     /// assert_eq!(x.as_deref_mut().map(|x| { x.make_ascii_uppercase(); x }), y);
     /// ```
+    #[inline]
     #[stable(feature = "inner_deref", since = "1.47.0")]
     pub fn as_deref_mut(&mut self) -> Result<&mut T::Target, &mut E>
     where